#include <limits.h>
#include <errno.h>
+#include <ctype.h>
#include "shgetc.h"
/* Lookup table for digit values. -1==255>=36 -> invalid */
errno = EINVAL;
return 0;
}
- c = shgetc(f);
+ while (isspace((c=shgetc(f))));
if (c=='+' || c=='-') {
neg = -(c=='-');
c = shgetc(f);
} else {
if (base == 0) base = 10;
if (val[c] >= base) {
+ shunget(f);
shlim(f, 0);
errno = EINVAL;
return 0;