bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Gawk


From: Aharon Robbins
Subject: Re: Gawk
Date: Tue, 20 Mar 2001 11:06:45 +0200

Greetings.  Re: this:

> Date: Wed, 14 Mar 2001 16:16:46 -0700
> From: "Richard Burns" <address@hidden>
> To: address@hidden
> CC: address@hidden
> Subject: Gawk
>
> Hi,
> I am beginning to tear out my hair over what _may_ be a gawk bug or limit.
> 
> I have an (embarrasingly) very large awk program to maintain ( 3141 lines
> of code) and am getting a parse error on function definitions as I try
> to move it into a gawk context.  I have tried relocating the offending
> function body around in the source and the result is the parse error
> message moves to another function definition. I am beginning to think
> that there is some undocumented upper limit on the number of functions
> accepted  by the gawk interpreter.
> 
> The program runs fine as a "nawk" script on a Sun box running SunOS 5.6.

Hi.  As became clear on comp.lang.awk, this was a problem with your
having a semi-colon and then a newline after the function body.  Below is
a patch relative to gawk 3.0.6 (the current released version) that
fixes the problem.

> Also, under the sunos nawk the close() function will work without the
> parens i.e. "close myCommandString;" It is easy to work around ,but
> might be useful to have it noted in the man pages.

This is a quirk of the Unix awk implementation.  Almost any builtin
function will work without parens.  But using things this way is
not documented in the awk book, and is definitely not portable.
You should fix your programs to use parentheses.

Thanks,

Arnold
-----------------------------------------------------------------
*** ../gawk-3.0.6/awk.y Sun Jul 16 18:29:50 2000
--- awk.y       Tue Mar 20 11:01:13 2001
***************
*** 293,299 ****
        ;
  
  function_body
!       : l_brace statements r_brace opt_semi
          {
                $$ = $2;
                can_return = FALSE;
--- 293,299 ----
        ;
  
  function_body
!       : l_brace statements r_brace opt_semi opt_nls
          {
                $$ = $2;
                can_return = FALSE;



reply via email to

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