+ {
+ const char * endspec = spec;
+ bool negative_scanlist = false;
+ if ( *(++endspec) == '^' )
+ {
+ negative_scanlist = true;
+ ++endspec;
+ }
+ spec = endspec;
+ do
+ {
+ // TODO: This can run beyond a malformed format string
+ ++endspec;
+ } while ( *endspec != ']' );
+ // read according to scanlist, equiv. to %s above
+ char * c = va_arg( status->arg, char * );
+ while ( ( status->current < status->width ) &&
+ ( ( rc = GET( status ) ) != EOF ) )
+ {
+ if ( negative_scanlist )
+ {
+ if ( IN_SCANSET( spec, endspec, rc ) )
+ {
+ UNGET( rc, status );
+ break;
+ }
+ }
+ else
+ {
+ if ( ! IN_SCANSET( spec, endspec, rc ) )
+ {
+ UNGET( rc, status );
+ break;
+ }
+ }
+ value_parsed = true;
+ *(c++) = rc;
+ }
+ if ( value_parsed )
+ {
+ *c = '\0';
+ ++status->n;
+ return ++endspec;
+ }
+ else
+ {
+ if ( rc == EOF )
+ {
+ status->n = -1;
+ }
+ return NULL;
+ }
+ }