All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Verych <olecom@flower.upol.cz>
To: Tim Schmielau <tim@physik3.uni-rostock.de>,
	Rob Landley <rob@landley.net>, Andrew Morton <akpm@osdl.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	Roman Zippel <zippel@linux-m68k.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: scripts/makelst: bc -> shell Re: sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution)
Date: Sat, 3 Feb 2007 14:10:11 +0100	[thread overview]
Message-ID: <20070203131011.GA26632@flower.upol.cz> (raw)
In-Reply-To: <20070203112459.GW28152@vasa.acc.umu.se>

On Sat, Feb 03, 2007 at 12:24:59PM +0100, David Weinehall wrote:
> On Sat, Jan 27, 2007 at 06:38:36AM +0000, Oleg Verych wrote:
> [snip]
> > ,-*- diff snip -*-
> > |-    t4=`echo $t3 | gawk '{ print $1 }'`
> > |-    t5=`echo $t1 | gawk '{ print $1 }'`
> > |+    t4=`pos_param 1 $t3`
> > |+    t5=`pos_param 1 $t1`
> > 5     t6=`echo $t4 - $t5 | tr a-f A-F`
> > 6     t7=`( echo  ibase=16 ; echo $t6 ) | bc`
> > `-*-
> > 
> > I've just noticed, that things on lines 5 and 6 may be optimized.
> > 
> > t7=`printf "%lu" $(( 0x$t4 - 0x$t5 ))`
> 
> %lu does not seem to agree with SuSv3:
> 
> http://www.opengroup.org/onlinepubs/009695399/utilities/printf.html
> http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap05.html

,-*- xbd_chap05.html -*-
|     The EXTENDED DESCRIPTION section almost exactly matches the
|     printf() function in the ISO C standard, although it is described
|     in terms of the file format notation in the Base Definitions volume
|     of IEEE Std 1003.1-2001, Chapter 5, File Format Notation.
`-*-
In other words, it does *not* match it at all. How it can without
the length modifiers?

As for me, "shalls" and "shoulds", "Implementations are encouraged" are
standard terms of The Standards.

Thus, i think, "%ul" is more "implementation wise":

,-*- printf test on bash, dash, busybox -*-
|olecom@flower:~$
|olecom@flower:~$ printf "%u \n" 0xffffffffffffffff
|18446744073709551615
|olecom@flower:~$ printf "%u \n" 0xffffffffffffffffA
|bash: printf: warning: 0xffffffffffffffffA: Numerical result out of range
|18446744073709551615
|olecom@flower:~$
|olecom@flower:~$ echo $BASH_VERSION
|3.1.17(1)-release
|olecom@flower:~$
|olecom@flower:~$ /bin/dash
|flower:-$ printf "%u \n" 0xffffffffffffffff
|18446744073709551615
|flower:-$ printf "%u \n" 0xffffffffffffffffA
|printf: 2: 0xffffffffffffffffA: Numerical result out of range
|18446744073709551615
|flower:-$
|flower:-$ /bin/busybox sh
|
|
|BusyBox v1.1.3 (Debian 1:1.1.3-4) Built-in shell (ash)
|Enter 'help' for a list of built-in commands.
|
|flower:-$
|flower:-$
|flower:-$ printf "%u \n" 0xffffffffffffffff
|4294967295
|flower:-$ printf "%u \n" 0xffffffffffffffffA
|0xffffffffffffffffA4294967295
|flower:-$ printf "%lu \n" 0xffffffffffffffff
|18446744073709551615
|flower:-$ printf "%lu \n" 0xffffffffffffffffA
|0xffffffffffffffffA18446744073709551615
|flower:-$
|flower:-$
`-*-

____

  reply	other threads:[~2007-02-03 13:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-15 21:24 [PATCH] sed s/gawk/awk/ scripts/gen_init_ramfs.sh Rob Landley
2007-01-15 22:11 ` Sam Ravnborg
2007-01-24  0:49   ` Andrew Morton
2007-01-24 17:30     ` Rob Landley
2007-01-24 21:03       ` [rft] (g)awk substitution (Re: [PATCH] sed s/gawk/awk/scripts/gen_init_ramfs.sh) Oleg Verych
2007-01-24 22:44         ` [patch, rft] scripts/gen_initramfs_list.sh: replace gawk with shell, whitespace cleanup Oleg Verych
2007-01-24 23:30         ` [patch, rft] scripts/makelst: replace gawk with shell, update Oleg Verych
2007-01-25  1:51         ` [rft] (g)awk substitution (Re: [PATCH] sed s/gawk/awk/scripts/gen_init_ramfs.sh) Rob Landley
2007-01-25  9:40           ` sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution) Oleg Verych
2007-01-25 18:03             ` Rob Landley
2007-01-25 19:14               ` Oleg Verych
2007-01-25 19:38                 ` Rob Landley
2007-01-25 21:18                   ` Oleg Verych
2007-01-26 17:47                     ` Rob Landley
2007-01-26 20:14                       ` Oleg Verych
2007-01-27  0:18                         ` Tim Schmielau
2007-01-27  6:38                           ` scripts/makelst: bc -> shell " Oleg Verych
2007-02-03 11:24                             ` David Weinehall
2007-02-03 13:10                               ` Oleg Verych [this message]
2007-02-03 11:13                 ` David Weinehall
2007-02-02 16:36     ` [PATCH] sed s/gawk/awk/ scripts/gen_init_ramfs.sh Adrian Bunk
2007-02-02 21:01       ` Oleg Verych

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070203131011.GA26632@flower.upol.cz \
    --to=olecom@flower.upol.cz \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob@landley.net \
    --cc=sam@ravnborg.org \
    --cc=tim@physik3.uni-rostock.de \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.