From 4ea2edafb88ba0280b3bf4eba6c3a3402aaade76 Mon Sep 17 00:00:00 2001 From: chip Date: Sat, 26 Feb 2000 08:35:33 +0000 Subject: [PATCH] Fix line numbers in tokenizer, which reads /etc/exports etc. --- support/include/xio.h | 2 +- support/nfs/xio.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/support/include/xio.h b/support/include/xio.h index 858f5bb..608d265 100644 --- a/support/include/xio.h +++ b/support/include/xio.h @@ -19,7 +19,7 @@ void xfunlock(int lockid); void xfclose(XFILE *xfp); int xgettok(XFILE *xfp, char sepa, char *tok, int len); char xgetc(XFILE *xfp); -void xungetc(char c, XFILE *xfp); +void xungetc(int c, XFILE *xfp); void xskip(XFILE *xfp, char *str); char xskipcomment(XFILE *xfp); diff --git a/support/nfs/xio.c b/support/nfs/xio.c index 1bcd41b..de51a15 100644 --- a/support/nfs/xio.c +++ b/support/nfs/xio.c @@ -92,7 +92,7 @@ xgettok(XFILE *xfp, char sepa, char *tok, int len) while (i < len && (c = xgetc(xfp)) != EOF && c != sepa && !isspace(c)) tok[i++] = c; if (c == '\n') - ungetc(c, xfp->x_fp); + xungetc(c, xfp->x_fp); if (!i) return 0; if (i >= len || (sepa && c != sepa)) @@ -126,10 +126,13 @@ xgetc(XFILE *xfp) } void -xungetc(char c, XFILE *xfp) +xungetc(int c, XFILE *xfp) { - if (c != EOF) + if (c != EOF) { ungetc(c, xfp->x_fp); + if (c == '\n') + xfp->x_line--; + } } void -- 2.39.5