Gives 0 a name and removes a little logic.
static FILE *cfile;
+#define TOK_EOF 0
#define DEFAULT 1
#define LOGIN 2
#define PASSWD 3
};
static struct toktab toktabs[] = {
+ { "", TOK_EOF },
{ "default", DEFAULT },
{ "login", LOGIN },
{ "password", PASSWD },
struct toktab *t;
if (feof(cfile))
- return (0);
+ return TOK_EOF;
while ((c = getc(cfile)) != EOF &&
(c == '\n' || c == '\t' || c == ' ' || c == ','))
continue;
if (c == EOF)
- return (0);
+ return TOK_EOF;
cp = tokval;
if (c == '"') {
while ((c = getc(cfile)) != EOF && c != '"') {
}
}
*cp = 0;
- if (tokval[0] == 0)
- return (0);
for (t = toktabs; t->tokstr; t++)
if (!strcmp(t->tokstr, tokval))
return (t->tval);