From: Neil Brown Date: Mon, 5 Jun 2006 02:36:52 +0000 (+1000) Subject: Only treat '#' as starting a comment when at the start of a token X-Git-Tag: nfs-utils-1-0-9-pre1~18 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=89572e84169557fe3c70b5de619c274ceaf7b028;p=nfs-utils.git Only treat '#' as starting a comment when at the start of a token otherwise '#' in filenames cannot be read. --- diff --git a/ChangeLog b/ChangeLog index 9cca4f9..ac8bc63 100644 --- 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" + - Only treat '#' as starting a comment when at the start of a + token, otherwise '#' in filenames cannot be read. + NeilBrown 2006-04-12 NeilBrown Remove **/Makefile.in, aclocal.m4, configure, and diff --git a/support/nfs/xio.c b/support/nfs/xio.c index 4a3f181..1ce5157 100644 --- a/support/nfs/xio.c +++ b/support/nfs/xio.c @@ -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;