bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] [PATCH] gawk: Comply with IEEE Std 1003.1


From: Samy Mahmoudi
Subject: Re: [bug-gawk] [PATCH] gawk: Comply with IEEE Std 1003.1
Date: Wed, 15 Aug 2018 19:30:07 +0200

Hi Arnold,

After some tests I could confirm gawk --posix either issues an error or runs as expected. I forgot to let you know.

Best regards,
Samy Mahmoudi

Le mar. 31 juil. 2018 à 15:17, <address@hidden> a écrit :
Hi.

> $ nawk -v x='abc\
> > def' 'BEGIN { print x }'
> abc
> def
> ----> Does this mean nawk does not fully comply with the standard ?

Yes. nawk was written before the standard was.  It's behavior is
different from gawk's. I don't intend to change gawk's though.

> What I have not noticed before submitting the patch, is that both nawk
> and gawk behaved differently depending on quoting type.

This is an issue with the shell, not nawk/gawk. The shell removes the
\-newline combination inside double quotes (along with much other
processing). nawk/gawk never see the backslash or the newline.

Characters inside single quotes are left TOTALLY ALONE so nawk/gawk sees
the backslash and the newline.

> $ gawk (--posix|--traditional|<nothing>) -v x='abc\
> > def' 'BEGIN {print x}'
> abc\def

I changed gawk to remove the \ in this case. That was a (small) bug.

> $ gawk (--posix|--traditional|<nothing>) -v x="abc\
> >
> > def" 'BEGIN {print x}'
> abc
> def

The first newline is ignored since the shell removes it. The second
one is literally there, since it's inside a quoted string. Gawk
takes it as-is. After my changes, with --posix only, gawk will
issue an error.

Hope this helps,

Arnold

reply via email to

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