bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Continuation Character not recognized in GAWK 4.1


From: Rush, Scott (CS COE)
Subject: Re: [bug-gawk] Continuation Character not recognized in GAWK 4.1
Date: Tue, 24 Feb 2015 20:11:28 +0000

Arnold,

Yup. I've been using GAWK for a very long time and, so far, I have not yet had 
a situation that I can't work out with the same version I first started using 
(that is, 3.0.3). I will definitely check out the latest version.

Until the company replaced my 32-bit PC, I've never had the need to get a 
different version of GAWK. At first, I thought I needed a 64-bit version. But, 
Eli and you have shown me that my good old trusty version (which is super fast 
and is only 134KB in size!) can still work for me.

What a relief!

Thanks again,
Scott

-----Original Message-----
From: Aharon Robbins [mailto:address@hidden 
Sent: Tuesday, February 24, 2015 1:02 PM
To: Rush, Scott (CS COE); address@hidden
Subject: Re: [bug-gawk] Continuation Character not recognized in GAWK 4.1

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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]