nvi: fix catalog generation

Upstream broke catalog generation with some over-eagre style cleanups.
This brings in my pull request.

Obtained from:	https://github.com/lichray/nvi2/pull/88
Differential Revision: https://reviews.freebsd.org/D28594
This commit is contained in:
dankm 2021-02-26 16:32:01 +01:00 committed by Baptiste Daroussin
parent 60a632f047
commit 888ae57252

View File

@ -36,24 +36,24 @@ parse(FILE *fp)
{ {
int ch, s1, s2, s3; int ch, s1, s2, s3;
#define TESTD(s) do { \ #define TESTD(s) { \
if ((s = getc(fp)) == EOF) \ if ((s = getc(fp)) == EOF) \
return; \ return; \
if (!isdigit(s)) \ if (!isdigit(s)) \
continue; \ continue; \
} while (0) }
#define TESTP do { \ #define TESTP { \
if ((ch = getc(fp)) == EOF) \ if ((ch = getc(fp)) == EOF) \
return; \ return; \
if (ch != '|') \ if (ch != '|') \
continue; \ continue; \
} while (0) }
#define MOVEC(t) do { \ #define MOVEC(t) { \
do { \ do { \
if ((ch = getc(fp)) == EOF) \ if ((ch = getc(fp)) == EOF) \
return; \ return; \
} while (ch != (t)); \ } while (ch != (t)); \
} while (0) }
for (;;) { for (;;) {
MOVEC('"'); MOVEC('"');
TESTD(s1); TESTD(s1);