Re: scripts/makelst: bc -> shell Re: sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution)

2007-02-03 Thread Oleg Verych
On Sat, Feb 03, 2007 at 12:24:59PM +0100, David Weinehall wrote:
> On Sat, Jan 27, 2007 at 06:38:36AM +, 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 -*-
|[EMAIL PROTECTED]:~$
|[EMAIL PROTECTED]:~$ printf "%u \n" 0x
|18446744073709551615
|[EMAIL PROTECTED]:~$ printf "%u \n" 0xA
|bash: printf: warning: 0xA: Numerical result out of range
|18446744073709551615
|[EMAIL PROTECTED]:~$
|[EMAIL PROTECTED]:~$ echo $BASH_VERSION
|3.1.17(1)-release
|[EMAIL PROTECTED]:~$
|[EMAIL PROTECTED]:~$ /bin/dash
|flower:-$ printf "%u \n" 0x
|18446744073709551615
|flower:-$ printf "%u \n" 0xA
|printf: 2: 0xA: 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" 0x
|4294967295
|flower:-$ printf "%u \n" 0xA
|0xA4294967295
|flower:-$ printf "%lu \n" 0x
|18446744073709551615
|flower:-$ printf "%lu \n" 0xA
|0xA18446744073709551615
|flower:-$
|flower:-$
`-*-


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: scripts/makelst: bc -> shell Re: sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution)

2007-02-03 Thread David Weinehall
On Sat, Jan 27, 2007 at 06:38:36AM +, 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

[snip]


Regards: David Weinehall
-- 
 /) David Weinehall <[EMAIL PROTECTED]> /) Northern lights wander  (\
//  Maintainer of the v2.0 kernel   //  Dance across the winter sky //
\)  http://www.acc.umu.se/~tao/(/   Full colour fire   (/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: scripts/makelst: bc - shell Re: sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution)

2007-02-03 Thread David Weinehall
On Sat, Jan 27, 2007 at 06:38:36AM +, 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

[snip]


Regards: David Weinehall
-- 
 /) David Weinehall [EMAIL PROTECTED] /) Northern lights wander  (\
//  Maintainer of the v2.0 kernel   //  Dance across the winter sky //
\)  http://www.acc.umu.se/~tao/(/   Full colour fire   (/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: scripts/makelst: bc - shell Re: sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution)

2007-02-03 Thread Oleg Verych
On Sat, Feb 03, 2007 at 12:24:59PM +0100, David Weinehall wrote:
 On Sat, Jan 27, 2007 at 06:38:36AM +, 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 -*-
|[EMAIL PROTECTED]:~$
|[EMAIL PROTECTED]:~$ printf %u \n 0x
|18446744073709551615
|[EMAIL PROTECTED]:~$ printf %u \n 0xA
|bash: printf: warning: 0xA: Numerical result out of range
|18446744073709551615
|[EMAIL PROTECTED]:~$
|[EMAIL PROTECTED]:~$ echo $BASH_VERSION
|3.1.17(1)-release
|[EMAIL PROTECTED]:~$
|[EMAIL PROTECTED]:~$ /bin/dash
|flower:-$ printf %u \n 0x
|18446744073709551615
|flower:-$ printf %u \n 0xA
|printf: 2: 0xA: 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 0x
|4294967295
|flower:-$ printf %u \n 0xA
|0xA4294967295
|flower:-$ printf %lu \n 0x
|18446744073709551615
|flower:-$ printf %lu \n 0xA
|0xA18446744073709551615
|flower:-$
|flower:-$
`-*-


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


scripts/makelst: bc -> shell Re: sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution)

2007-01-26 Thread Oleg Verych
Hallo.

On Sat, Jan 27, 2007 at 01:18:30AM +0100, Tim Schmielau wrote:
> On Fri, 26 Jan 2007, Oleg Verych wrote:
> 
> > In Debian's version it has no `bc', while native `bc' is producing
> > crap like that:
> > ,-*- bash -*-
> > |[EMAIL PROTECTED]:~$ printf "%u" $(( -1 )) ; echo
> > |18446744073709551615
> > |[EMAIL PROTECTED]:~$ echo -1 | bc
> > |-1
> > |[EMAIL PROTECTED]:~$ printf "%u" $(( 0xFF )) ; echo
> > |255
> > |[EMAIL PROTECTED]:~$ echo FF | bc
> > |99
> > |[EMAIL PROTECTED]:~$ echo F | bc
> > |15
> > |[EMAIL PROTECTED]:~$
> > `-*-
> > 
> > i can't understand the result... I think linux/scripts/makelst may be
> > updated to have sh's version of address calculation ;)
> 
> No, IMHO that should not be a reason to change anything in the kernel.
> Just set ibase=16 or read the fine manual:

Thank you very much ;) Maybe i must use XSLT with 0.99 kernel, or
what?

I'm talking about patch posted here:
Message-ID: <[EMAIL PROTECTED]>
Archived-At: 

,-*- 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 ))`

No tr, no bc, no pipes -- magic!
Better know and use our *fine shell*.

And if you jouined us, Tim, maybe can share your experience and test
patch above and this one, please?
Message-ID: <[EMAIL PROTECTED]>
Archived-At: 

It's just my optimization hint. I have no bc, and i'm sure
things, like that will cause silent misinformation.

Anyway, what is so bad in `sh'?

Thanks.

-*- OT -*-
>   info '(bc)About Expressions and Special Variables'
GFDL. Enough of that bull, even Documentation/ is *free* from it.

Good bye.
--
-o--=O`C  info emacs : not found  /. .\ ( is there any reason to live? )
 #oo'L O  info make  : not found  o (yes --- R.I.P. FSF+RMS)
<___=E M  man gcc: not found`-- ( viva Debian Operating System )
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


scripts/makelst: bc - shell Re: sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution)

2007-01-26 Thread Oleg Verych
Hallo.

On Sat, Jan 27, 2007 at 01:18:30AM +0100, Tim Schmielau wrote:
 On Fri, 26 Jan 2007, Oleg Verych wrote:
 
  In Debian's version it has no `bc', while native `bc' is producing
  crap like that:
  ,-*- bash -*-
  |[EMAIL PROTECTED]:~$ printf %u $(( -1 )) ; echo
  |18446744073709551615
  |[EMAIL PROTECTED]:~$ echo -1 | bc
  |-1
  |[EMAIL PROTECTED]:~$ printf %u $(( 0xFF )) ; echo
  |255
  |[EMAIL PROTECTED]:~$ echo FF | bc
  |99
  |[EMAIL PROTECTED]:~$ echo F | bc
  |15
  |[EMAIL PROTECTED]:~$
  `-*-
  
  i can't understand the result... I think linux/scripts/makelst may be
  updated to have sh's version of address calculation ;)
 
 No, IMHO that should not be a reason to change anything in the kernel.
 Just set ibase=16 or read the fine manual:

Thank you very much ;) Maybe i must use XSLT with 0.99 kernel, or
what?

I'm talking about patch posted here:
Message-ID: [EMAIL PROTECTED]
Archived-At: http://permalink.gmane.org/gmane.linux.kernel/485999

,-*- 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 ))`

No tr, no bc, no pipes -- magic!
Better know and use our *fine shell*.

And if you jouined us, Tim, maybe can share your experience and test
patch above and this one, please?
Message-ID: [EMAIL PROTECTED]
Archived-At: http://permalink.gmane.org/gmane.linux.kernel/485984

It's just my optimization hint. I have no bc, and i'm sure
things, like that will cause silent misinformation.

Anyway, what is so bad in `sh'?

Thanks.

-*- OT -*-
   info '(bc)About Expressions and Special Variables'
GFDL. Enough of that bull, even Documentation/ is *free* from it.

Good bye.
--
-o--=O`C  info emacs : not found  /. .\ ( is there any reason to live? )
 #oo'L O  info make  : not found  o (yes --- R.I.P. FSF+RMS)
___=E M  man gcc: not found`-- ( viva Debian Operating System )
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/