bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Change in behavior of getline


From: John Haque
Subject: Re: [bug-gawk] Change in behavior of getline
Date: Sat, 23 Jul 2011 06:46:39 -0500
User-agent: Mutt/1.4.2.2i

On Mon, Jul 18, 2011 at 07:02:47AM -0500, John Haque wrote:
> On Fri, Jul 15, 2011 at 08:37:54AM -0500, address@hidden wrote:
> > This is similar to the problem of (g)sub not preserving space
> > when there were no substitutions.
> > 
> > $ ./gawk --version | head -n 1
> > GNU Awk 3.1.8
> > $ echo ' aaa bbb' | ./gawk 'END { getline $2; print}'
> >  aaa bbb
> > 
> > $ ./gawk --version | head -n 1
> > GNU Awk 4.0.0
> > $ echo ' aaa bbb' | ./gawk 'END { getline $2; print}'
> > aaa bbb
> 
> The attached patch fixes the problem. 
> 

Please use this reworked patch instead.

Thanks.

John

---------- ChangeLog Entry -------------------------------------

        Fix handling of assign routines for 'getline var'.
        Rework the previous fix for (g)sub.

        * awk.h: New define assign_ctxt for use in Op_var_assign
        and Op_field_assign opcodes. Remove define AFTER_ASSIGN.
        * awkgram.y (snode, mk_getline): Initialize assign_ctxt.
        * builtin.c (do_sub): Adjust to take only the first two
        arguments.
        * eval.c (r_interpret): In cases Op_var_assign and Op_field_assign,
        skip the routine as appropriate. Adjust case Op_sub_builtin.
        * main.c (get_spec_varname): New function.
        * debug.c (print_instruction): Use the new function to get
        special variable name.

--------------------------------------------------------------

Attachment: getline_gsub.diff
Description: Text document


reply via email to

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