tech-userlevel archive

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

Re: bin/39002: harmful AWK extension: non-portable escaped character

On Jun 20, 2008, at 2:58 PM, Aleksey Cheusov wrote:

I think gawk does right thing here and I'd like to see the same in

Gawk is sometimes a noisy pain in the butt.  :-)

It is long standing tradition in Unix tools and languages to ignore
the backslash on non-special characters, right from C on up.
Please, do not repeat this $%^& "nawk is the only true awk...and
bla-bla-bla".  "Long standing trandition" is bad argument here. Today
is year 2008 and there is POSIX.
(I'm not big fun of GNU awk but this doesn't matter)

I personally don't think AWK should make any noisy warnings like this.
If you don't like noise, fix your programs. It's easy ;)

The fact that mawk does the wrong thing is disturbing, though I'm not
sure that justifies making a noisy warning.
The real problem is not in mawk. The problem is that NetBSD code does
not conform to POSIX and is not as portable as it is claimed.

Actually it's the script which is non-portable when it attempts to discern any behavior from \X where X isn't specifically defined.

Since you want to quote the standards, look at the table for characters not specifically listed and you find for \c:

A backslash character followed by any character not described in this table or in the table in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 5, File Format Notation ( '\\' , '\a', '\b', '\f', '\n', '\r', '\t', '\v').
Meaning: Undefined

i.e. the implementation can pretty much do what it will there. It can print error messages, it can treat it as C always has, it can pass it through, etc.


Home | Main Index | Thread Index | Old Index