=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/hexdump/parse.c,v retrieving revision 1.4 retrieving revision 1.5 diff -c -r1.4 -r1.5 *** src/usr.bin/hexdump/parse.c 1998/08/11 22:06:27 1.4 --- src/usr.bin/hexdump/parse.c 1999/02/07 20:54:09 1.5 *************** *** 1,4 **** ! /* $OpenBSD: parse.c,v 1.4 1998/08/11 22:06:27 provos Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: parse.c,v 1.5 1999/02/07 20:54:09 aaron Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. *************** *** 35,41 **** #ifndef lint /*static char sccsid[] = "from: @(#)parse.c 5.6 (Berkeley) 3/9/91";*/ ! static char rcsid[] = "$OpenBSD: parse.c,v 1.4 1998/08/11 22:06:27 provos Exp $"; #endif /* not lint */ #include --- 35,41 ---- #ifndef lint /*static char sccsid[] = "from: @(#)parse.c 5.6 (Berkeley) 3/9/91";*/ ! static char rcsid[] = "$OpenBSD: parse.c,v 1.5 1999/02/07 20:54:09 aaron Exp $"; #endif /* not lint */ #include *************** *** 53,73 **** { register char *p; FILE *fp; ! int ch; ! char buf[2048 + 1]; if (!(fp = fopen(name, "r"))) { (void)fprintf(stderr, "hexdump: can't read %s.\n", name); exit(1); } ! while (fgets(buf, sizeof(buf), fp)) { ! if (!(p = strchr(buf, '\n'))) { ! (void)fprintf(stderr, "hexdump: line too long.\n"); ! while ((ch = getchar()) != '\n' && ch != EOF); continue; } ! *p = '\0'; ! for (p = buf; *p && isspace(*p); ++p); if (!*p || *p == '#') continue; add(p); --- 53,72 ---- { register char *p; FILE *fp; ! size_t len; if (!(fp = fopen(name, "r"))) { (void)fprintf(stderr, "hexdump: can't read %s.\n", name); exit(1); } ! while ((p = fgetln(fp, &len))) { ! if (*(p + len - 1) == '\n') ! *(p + len - 1) = '\0'; ! else { ! (void)fprintf(stderr, "hexdump: incomplete line.\n"); continue; } ! for (; *p && isspace(*p); ++p); if (!*p || *p == '#') continue; add(p);