[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Continuation Character not recognized in GAWK 4.1
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] Continuation Character not recognized in GAWK 4.1 |
Date: |
Tue, 24 Feb 2015 22:01:52 +0200 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hello Scott.
Thanks for sending in a bug report.
> From: "Rush, Scott (CS COE)" <address@hidden>
> To: "address@hidden" <address@hidden>
> Date: Tue, 24 Feb 2015 00:25:26 +0000
> Subject: [bug-gawk] Continuation Character not recognized in GAWK 4.1
>
> My employer recently replaced my PC (Windows XP 32-bit) with a new one
> (Windows 7 64-bit) that resulted in GAWK no longer working. I was able to
> locate a 64-bit version of GAWK (GNU Awk 4.1.1, API: 1.1) that indicates
> that it is not an official release yet.
Just to clarify, 4.1.1 is the official released version of gawk. But
I only release source code. I don't know who supplied your build and
can't help you there.
I use Cygwin on my work Windows machine, although Eli doesn't like
Cygwin and prefers the MinGW tools. Cygwin does have 64 bit support.
> I'm having to use a 64-bit version because the 32-bit version does not
> run my programs that nest additional calls to GAWK via the system()
> function. The outer call to GAWK works but I get the "'gawk' is not
> recognized as an internal or external command, operable program or batch
> file." error as soon as the program hits the system() command.
I think Eli has addressed this issue.
> The situation I have with the 64-bit version is that I get a parsing error
> when I attempt to use the "\" continuation character in my programs. For
> example, having the following program lines produces the following error:
>
> {
> printf("Hello \
> World!\n")
> }
>
> awk: test:2: printf("Hello \
> awk: test:2: ^ unterminated string
> awk: test:2: printf("Hello \
> awk: test:2: ^ syntax error
This is a separate issue from 32/64 windows/not-windows. This occurs
because some of the gawk code understands CR-LF files and some of it
does not. The source code patch below fixes the problem, so it will be
fixed "for real" when I release 4.1.2.
Unless you can build out of the git repo, you will have to find someone
to supply you with a binary.
Thanks again for the report!
Thanks also for the kind words in the later mail. I note that you were
using 3.0.3 - that's from 18 years ago! Lots of new good stuff in the
current version.
Enjoy,
Arnold
------------------------------------
diff --git a/awkgram.y b/awkgram.y
index 0df72b4..2307c36 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -3061,7 +3061,10 @@ yylex(void)
pushback();
yyerror(_("unterminated regexp ends
with `\\' at end of file"));
goto end_regexp; /* kludge */
- } else if (c == '\n') {
+ }
+ if (c == '\r') /* allow MS-DOS files. bleah */
+ c = nextc(true);
+ if (c == '\n') {
sourceline++;
continue;
} else {
@@ -3392,6 +3395,8 @@ retry:
if ((gawk_mb_cur_max == 1 || nextc_is_1stbyte) &&
c == '\\') {
c = nextc(true);
+ if (c == '\r') /* allow MS-DOS files. bleah */
+ c = nextc(true);
if (c == '\n') {
sourceline++;
continue;