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

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

compat vs posix modes


From: Janos Barbero
Subject: compat vs posix modes
Date: Wed, 3 Mar 2010 13:28:10 -0800 (PST)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

Hello,

GNU awk's compatibility mode does not seem to include the
-Wnon-decimal-data option:
  $ echo 0x5 | gawk -Wtraditional '{printf "%d\n", $1}'
  0
  $ echo 0x5 | gawk -Wnon-decimal-data '{printf "%d\n", $1}'
  5

POSIX mode does include this, so I may just be misunderstanding the
manual.
  $ echo 0x5 | gawk -Wposix '{printf "%d\n", $1}'
  5

man:
--traditional
       Run in compatibility mode.  In compatibility mode, gawk behaves
       identically to UNIX awk; none of the GNU-specific extensions
       are recognized.  The use of --traditional is preferred over
       the other forms of this option.  See GNU EXTENSIONS, below,
       for more information.

Kernighan's awk does interpret hex data. On my Debian system, Kernighan's
awk is called original-awk, so:
  $ echo 0x5 | original-awk '{printf "%d\n", $1}'
  5

Sorry if I am wasting your time with a design question, I just thought
it might be a bug.

For reference, versions are as follows:
GNU Awk 3.1.6
gcc (Debian 4.3.2-1.1) 4.3.2

Thank you,
Janos






reply via email to

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