From: nealcrook Date: Tue, 22 Nov 2016 09:15:47 +0000 (+0000) Subject: Port support for comment-to-end-of-line via '#' from heirloom-sh: while X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=794dab68a4247d9978f7301f962781321bd940c4;p=FUZIX.git Port support for comment-to-end-of-line via '#' from heirloom-sh: while loop added to the start of word() in word.c --- diff --git a/Applications/V7/cmd/sh/sym.h b/Applications/V7/cmd/sh/sym.h index ac0d78b8..5bea3872 100644 --- a/Applications/V7/cmd/sh/sym.h +++ b/Applications/V7/cmd/sh/sym.h @@ -46,3 +46,4 @@ #define DOLLAR '$' #define ESCAPE '\\' #define BRACE '{' +#define COMCHAR '#' diff --git a/Applications/V7/cmd/sh/word.c b/Applications/V7/cmd/sh/word.c index 31b78861..5139ca08 100644 --- a/Applications/V7/cmd/sh/word.c +++ b/Applications/V7/cmd/sh/word.c @@ -28,7 +28,21 @@ int word(void) wdnum = 0; wdset = 0; - while ((c = nextc(0), space(c))); + while (1) + { + while (c = nextc(0), space(c)) /* skipc() */ + ; + + if (c == COMCHAR) + { + while ((c = readc()) != NL && c != EOF); + peekc = c; + } + else + { + break; /* out of comment - white space loop */ + } + } if (!eofmeta(c)) { do {