]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Fix line numbers in tokenizer, which reads /etc/exports etc.
authorchip <chip>
Sat, 26 Feb 2000 08:35:33 +0000 (08:35 +0000)
committerchip <chip>
Sat, 26 Feb 2000 08:35:33 +0000 (08:35 +0000)
support/include/xio.h
support/nfs/xio.c

index 858f5bbd846a38dc486b23b36ed0e11736c19a7b..608d265e38134af3243bc3be08ec7e0940ecf8af 100644 (file)
@@ -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   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);
 
 void   xskip(XFILE *xfp, char *str);
 char   xskipcomment(XFILE *xfp);
 
index 1bcd41bc8b1a9eb46bc21af60f5168276ff5688f..de51a15c0a8d4b6d30d4f7c77a1b284057671e7b 100644 (file)
@@ -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')
        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))
        if (!i)
                return 0;
        if (i >= len || (sepa && c != sepa))
@@ -126,10 +126,13 @@ xgetc(XFILE *xfp)
 }
 
 void
 }
 
 void
-xungetc(char c, XFILE *xfp)
+xungetc(int c, XFILE *xfp)
 {
 {
-       if (c != EOF)
+       if (c != EOF) {
                ungetc(c, xfp->x_fp);
                ungetc(c, xfp->x_fp);
+               if (c == '\n')
+                       xfp->x_line--;
+       }
 }
 
 void
 }
 
 void