[BusyBox] [patch] hex constants in ash arithmetic
johan.adolfsson at axis.com
johan.adolfsson at axis.com
Sun May 5 14:02:03 UTC 2002
How about adding support for hexescaping using \xXX as well?
echo in zsh has it and you could then easaly use sed and echo
to decode www-url-encoded query strings in CGI scripts.
/Johan
----- Original Message -----
From: "Dick Streefland" <Dick.Streefland at xs4all.nl>
To: <busybox at busybox.net>
Sent: den 5 maj 2002 21:36
Subject: [BusyBox] [patch] hex constants in ash arithmetic
> The following micro patch adds support for hex constants in ash
> arithmetic expressions, just like bash. You can use this to convert
> hex values that are used in various /proc files to decimal. Example:
>
> $ hex=100
> $ echo $((0x$hex))
> 256
>
> --
> Dick Streefland //// De Bilt
> dick.streefland at xs4all.nl (@ @) The Netherlands
> ------------------------------oOO--(_)--OOo------------------
>
> --- busybox-0.60.3/libbb/arith.c.orig Sat Oct 27 01:08:06 2001
> +++ busybox-0.60.3/libbb/arith.c Sat May 4 23:27:08 2002
> @@ -157,7 +157,7 @@
> if (arithval == ' ' || arithval == '\n' || arithval == '\t')
> goto prologue;
> if ((unsigned)arithval-'0' <= 9) /* isdigit */ {
> - *numstackptr++ = strtol(expr, (char **) &expr, 10);
> + *numstackptr++ = strtol(expr, (char **) &expr, 0);
> lasttok = TOK_NUM;
> continue;
> } if (arithval == '(') {
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/mailman/listinfo/busybox
>
More information about the busybox
mailing list