}
else
{
- return *((status->s)++);
+ return ( *status->s == '\0' ) ? EOF : *((status->s)++);
}
}
strtol() will return zero. In both cases, endptr will point to the
rest of the conversion specifier - just what we need.
*/
+ char const * prev_spec = spec;
status->width = (int)strtol( spec, (char**)&spec, 10 );
+ if ( spec == prev_spec )
+ {
+ status->width = SIZE_MAX;
+ }
/* Optional length modifier
We step one character ahead in any case, and step back only if we find
}
else
{
+ /* FIXME: Need two kinds of "no match" here: zero width, and input error */
return NULL;
}
}