6 static char buf
[BUFSIZE
];
9 static char name
[NAMELEN
];
17 {"static", TOK_STATIC
},
18 {"return", TOK_RETURN
},
19 {"unsigned", TOK_UNSIGNED
},
20 {"signed", TOK_SIGNED
},
25 {"struct", TOK_STRUCT
},
32 {"switch", TOK_SWITCH
},
34 {"sizeof", TOK_SIZEOF
},
37 static int id_char(int c
)
39 return isalnum(c
) || c
== '_';
49 while (cur
< len
&& isspace(buf
[cur
]))
53 if (isdigit(buf
[cur
])) {
55 while (cur
< len
&& isdigit(buf
[cur
]))
60 if (id_char(buf
[cur
])) {
63 while (cur
< len
&& id_char(buf
[cur
]))
66 for (i
= 0; i
< ARRAY_SIZE(kwds
); i
++)
67 if (!strcmp(kwds
[i
].name
, name
))
71 if (strchr(";{}()[]*=", buf
[cur
]))
86 while ((n
= read(fd
, buf
+ len
, sizeof(buf
) - len
)) > 0)