+
+ if ( status->base != -1 )
+ {
+ /* integer conversion */
+ uintmax_t value = 0;
+ bool prefix_parsed = false;
+ int sign = 0;
+ while ( ( status->this < status->width ) &&
+ ( ( rc = GET( status ) ) != EOF ) )
+ {
+ if ( ! sign )
+ {
+ switch ( rc )
+ {
+ case '-':
+ sign = -1;
+ break;
+ case '+':
+ sign = 1;
+ break;
+ default:
+ sign = 1;
+ UNGET( rc, status );
+ break;
+ }
+ }
+ else if ( ! prefix_parsed )
+ {
+ prefix_parsed = true;
+ if ( rc != '0' )
+ {
+ if ( status->base == 0 )
+ {
+ status->base = 10;
+ }
+ UNGET( rc, status );
+ }
+ else
+ {
+ if ( ( status->this < status->width ) &&
+ ( ( rc = GET( status ) ) != EOF ) )
+ {
+ if ( tolower( rc ) == 'x' )
+ {
+ if ( ( status->base == 0 ) ||
+ ( status->base == 16 ) )
+ {
+ status->base = 16;
+ }
+ else
+ {
+ UNGET( rc, status );
+ value_parsed = true;
+ }
+ }
+ else
+ {
+ UNGET( rc, status );
+ if ( status->base == 0 )
+ {
+ status->base = 8;
+ }
+ value_parsed = true;
+ }
+ }
+ }
+ }
+ else
+ {
+ char * digitptr = memchr( _PDCLIB_digits, tolower( rc ), status->base );
+ if ( digitptr == NULL )
+ {
+ /* end of input item */
+ break;
+ }
+ value *= status->base;
+ value += digitptr - _PDCLIB_digits;
+ value_parsed = true;
+ }
+ }
+ /* width exceeded, EOF, read error, non-matching character */
+ if ( ! value_parsed )
+ {
+ /* matching error */
+ return NULL;
+ }
+ switch ( status->flags & ( E_char | E_short | E_long | E_llong |
+ E_intmax | E_size | E_ptrdiff |
+ E_unsigned ) )
+ {
+ ASSIGN( E_char, char );
+ ASSIGN( E_char | E_unsigned, unsigned char );
+ ASSIGN( E_short, short );
+ ASSIGN( E_short | E_unsigned, unsigned short );
+ ASSIGN( 0, int );
+ ASSIGN( E_unsigned, unsigned int );
+ ASSIGN( E_long, long );
+ ASSIGN( E_long | E_unsigned, unsigned long );
+ ASSIGN( E_llong, long long );
+ ASSIGN( E_llong | E_unsigned, unsigned long long );
+ ASSIGN( E_intmax, intmax_t );
+ ASSIGN( E_intmax | E_unsigned, uintmax_t );
+ ASSIGN( E_size, size_t );
+ /* ASSIGN( E_size | E_unsigned, unsigned size_t ); */
+ ASSIGN( E_ptrdiff, ptrdiff_t );
+ /* ASSIGN( E_ptrdiff | E_unsigned, unsigned ptrdiff_t ); */
+ }
+ return spec;
+ }
+ /* TODO: Floats. */