Subject: Re: awk problem
To: Shin'ichiro TAYA <taya@ba2.so-net.ne.jp>
From: Andreas Kahari <ak+netbsd@freeshell.org>
List: port-powerpc
Date: 03/25/2004 14:24:23
On Thu, Mar 25, 2004 at 10:52:20PM +0900, Shin'ichiro TAYA wrote:
> Hi,
> I'm trying to make kernel of OPENBLOCKS266.
> It needs src/sys/arch/evbppc/compile/walnut-mkimg.sh to convert ELF
> kernel to platform specific format.
> In the script above, awk uses following expression.
> 
>    awk 'BEGIN { printf "\x00\x52\x50\x4f" }
> 
> It seems that nawk doesn't support this but gawk does.
> 
>    % awk 'BEGIN { printf "\x00\x52\x50\x4f" }' | hexdump -C
>    %
> 
>    % gawk 'BEGIN { printf "\x00\x52\x50\x4f" }' | hexdump -C
>    00000000  00 52 50 4f                                       |.RPO|
>    00000004
>    %
> 
> Is this a problem of nawk ?
> Or is this a GNU awk specific extention?

It's a GNU specific extention.  POSIX awk is only required to
handle the following escape sequences:

\"      Backslash quotation-mark
\/      Backslash slash
\ddd    A backslash character followed by the longest
        sequence of one, two, or three octal-digit characters
        (01234567). If all of the digits are 0 (that is,
        representation of the NUL character), the behavior is
        undefined.
\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' ).


-- 
Andreas Kähäri                      |<><>|
                                    | <> |
East Anglia                         |<><>|
England                             | <> |