version 1.4, 1998/08/11 22:06:27 |
version 1.5, 1999/02/07 20:54:09 |
|
|
{ |
{ |
register char *p; |
register char *p; |
FILE *fp; |
FILE *fp; |
int ch; |
size_t len; |
char buf[2048 + 1]; |
|
|
|
if (!(fp = fopen(name, "r"))) { |
if (!(fp = fopen(name, "r"))) { |
(void)fprintf(stderr, "hexdump: can't read %s.\n", name); |
(void)fprintf(stderr, "hexdump: can't read %s.\n", name); |
exit(1); |
exit(1); |
} |
} |
while (fgets(buf, sizeof(buf), fp)) { |
while ((p = fgetln(fp, &len))) { |
if (!(p = strchr(buf, '\n'))) { |
if (*(p + len - 1) == '\n') |
(void)fprintf(stderr, "hexdump: line too long.\n"); |
*(p + len - 1) = '\0'; |
while ((ch = getchar()) != '\n' && ch != EOF); |
else { |
|
(void)fprintf(stderr, "hexdump: incomplete line.\n"); |
continue; |
continue; |
} |
} |
*p = '\0'; |
for (; *p && isspace(*p); ++p); |
for (p = buf; *p && isspace(*p); ++p); |
|
if (!*p || *p == '#') |
if (!*p || *p == '#') |
continue; |
continue; |
add(p); |
add(p); |