*/
#include <stdio.h>
+#include <stdint.h>
#include <ctype.h>
#include <string.h>
#include <stdarg.h>
/* #define skip() do{c=getc(fp); if (c<1) goto done;}while(isspace(c))*/
-#define skip() while(isspace(c)) { if ((c=getc(fp))<1) goto done; }
+#define skip() while(isspace(c)) { if ((c=fgetc(fp))<1) goto done; }
/* fp scan actions */
#define F_NADA 0 /* just change state */
#define FC_SIGN 3
/* given transition,state do what action? */
-int fp_do[][NSTATE] = {
+static const uint8_t fp_do[][NSTATE] = {
{F_INT,F_INT,F_INT,
F_FRAC,F_FRAC,
F_EXP,F_EXP,F_EXP}, /* see digit */
F_ESIGN,F_QUIT,F_QUIT}, /* see sign */
};
/* given transition,state what is new state? */
-int fp_ns[][NSTATE] = {
+static const uint8_t fp_ns[][NSTATE] = {
{FS_DIGS,FS_DIGS,FS_DIGS,
FS_DD,FS_DD,
FS_EDIGS,FS_EDIGS,FS_EDIGS}, /* see digit */
FS_ESIGN,0,0}, /* see sign */
};
/* which states are valid terminators? */
-int fp_sval[NSTATE] = {
+static const uint8_t fp_sval[NSTATE] = {
0,0,1,0,1,0,0,1
};
if (!*fmt)
return (0);
- c = getc(fp);
+ c = fgetc(fp);
while (c > 0)
{
store = 0;
}
else if (c == '0')
{
- c = getc(fp);
+ c = fgetc(fp);
if (c < 1)
goto savnum;
if ((c != 'x')
{
if (store)
*p++ = c;
- if (((c = getc(fp)) < 1) ||
+ if (((c = fgetc(fp)) < 1) ||
(--width == 0))
break;
cmatch:
if (c != *fmt)
break;
- c = getc(fp);
+ c = fgetc(fp);
}
if (!*++fmt)