version 1.10, 1996/09/01 13:06:51 |
version 1.11, 1996/09/23 09:41:02 |
|
|
char *p; |
char *p; |
struct stat sb; |
struct stat sb; |
FILE *fp; |
FILE *fp; |
int len, alen; |
int len, alen, line; |
static char buf[LINE_MAX]; |
static char buf[LINE_MAX]; |
|
|
if (!(fp = fopen(tempname, "r"))) |
if (!(fp = fopen(tempname, "r"))) |
|
|
warnx("corrupted temporary file"); |
warnx("corrupted temporary file"); |
goto bad; |
goto bad; |
} |
} |
|
line = 0; |
while (fgets(buf, sizeof(buf), fp)) { |
while (fgets(buf, sizeof(buf), fp)) { |
|
line++; |
if (!buf[0] || buf[0] == '#') |
if (!buf[0] || buf[0] == '#') |
continue; |
continue; |
if (!(p = strchr(buf, '\n'))) { |
if (!(p = strchr(buf, '\n'))) { |
warnx("line too long"); |
warnx("line %d too long", line); |
goto bad; |
goto bad; |
} |
} |
*p = '\0'; |
*p = '\0'; |
for (ep = list;; ++ep) { |
for (ep = list;; ++ep) { |
if (!ep->prompt) { |
if (!ep->prompt) { |
warnx("unrecognized field"); |
warnx("unrecognized field on line %d", line); |
goto bad; |
goto bad; |
} |
} |
if (!strncasecmp(buf, ep->prompt, ep->len)) { |
if (!strncasecmp(buf, ep->prompt, ep->len)) { |
|
|
goto bad; |
goto bad; |
} |
} |
if (!(p = strchr(buf, ':'))) { |
if (!(p = strchr(buf, ':'))) { |
warnx("line corrupted"); |
warnx("line %d corrupted", line); |
goto bad; |
goto bad; |
} |
} |
while (isspace(*++p)); |
while (isspace(*++p)); |