Subject: [PATCH] strings: Correct output to be decimal per the help, instead of octal

Tito farmatito at tiscali.it
Tue Oct 11 18:38:31 UTC 2016


On 10/11/2016 04:00 PM, Chris Renshaw wrote:
>>From fe9333ce1d69e292e14144a61ff88a23ffed0053 Mon Sep 17 00:00:00 2001
> From: Chris Renshaw <osm0sis at outlook.com>
> Date: Thu, 22 Sep 2016 16:17:05 -0300
> Subject: [PATCH] strings: Correct output to be decimal per the help, instead of octal
>  Most smaller/incomplete implementations of strings output decimal by default,
>  so best to correct that behavior rather than just change the help to say octal
>  (it would be great to get full POSIX --radix at some point, to give the
>  output in any desired format, but this will do for now)
> 
> ---
>  miscutils/strings.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/miscutils/strings.c b/miscutils/strings.c
> index 9f50182..cc4ad9a 100644
> --- a/miscutils/strings.c
> +++ b/miscutils/strings.c
> @@ -68,7 +68,7 @@ int strings_main(int argc UNUSED_PARAM, char **argv)
>  							printf(fmt, *argv);
>  						}
>  						if (option_mask32 & PRINT_OFFSET) {
> -							printf("%7"OFF_FMT"o ", offset - n);
> +							printf("%7"OFF_FMT"d ", offset - n);
>  						}
>  						fputs(string, stdout);
>  					}
> 


Hi,
man STRINGS(1) GNU Development Tools binutils-2.25 says:   

"-o  Like -t o.  Some other versions of strings have -o act like -t d instead.
Since we can not be compatible with both ways, we simply chose one."

As we mimick GNU strings for linux maybe correcting the help would be the better
option.

Ciao,
Tito



More information about the busybox mailing list