]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Only treat '#' as starting a comment when at the start of a token
authorNeil Brown <neilb@suse.de>
Mon, 5 Jun 2006 02:36:52 +0000 (12:36 +1000)
committerNeil Brown <neilb@suse.de>
Mon, 5 Jun 2006 02:36:52 +0000 (12:36 +1000)
otherwise '#' in filenames cannot be read.

ChangeLog
support/nfs/xio.c

index 9cca4f9401123b4938d5a117a8677caef854e3fe..ac8bc63d1a918be8caa64c3229c6f0b4dc4df26a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,9 @@
          escaped (as with quotes, spaces, etc.), so they won't be treated
          as a comment when they're read back in again.
                "Steinar H. Gunderson" <sesse@debian.org>
+       - Only treat '#' as starting a comment when at the start of a
+         token, otherwise '#' in filenames cannot be read.
+               NeilBrown       
        
 2006-04-12 NeilBrown <neilb@suse.de>
        Remove **/Makefile.in, aclocal.m4, configure, and
index 4a3f18176296c59db7cf91067d7bc0e989a1909b..1ce515727a0d7330143b4f7df478e12d414aa883 100644 (file)
@@ -95,6 +95,11 @@ xgettok(XFILE *xfp, char sepa, char *tok, int len)
 
        while (i < len && (c = xgetc(xfp)) != EOF &&
               (quoted || (c != sepa && !isspace(c)))) {
+               if (!quoted && i == 0 && c == '#') {
+                       c = xskipcomment(xfp);
+                       xfp->x_line++;
+                       break;
+               }
                if (c == '"') {
                        quoted = !quoted;
                        continue;
@@ -138,8 +143,6 @@ xgetc(XFILE *xfp)
                ungetc(c, xfp->x_fp);
                return ' ';
        }
-       if (c == '#')
-               c = xskipcomment(xfp);
        if (c == '\n')
                xfp->x_line++;
        return c;