[PATCH] flexi-sized user/group/size fields for ls

Denys Vlasenko vda.linux at googlemail.com
Sat Jan 16 01:37:53 UTC 2010


On Friday 15 January 2010 21:16, Ian Wienand wrote:
> Hi,
> 
> I sent something similar before, this is revised from those comments
> and to also space out user/group, which was the real issue in the end.
> 
> I found that with large files and long username/group names,
> everything runs together.  e.g.
> 
> wienandi at coopers:~/programs/busybox$ ./busybox_old ls -l ./big 
> -rw-r--r--    1 Debian-e Debian-e1099511627777 Jan 15 11:50 ./big
> 
> Major problem is that this kills scripts that parse the output.
> 
> This implements flexi-sized user, group and size fields based on the
> FEATURE_AUTOWIDTH; I figure if you have this on then you want the
> columns spaced.
> 
> With this patch, the above becomes
> 
> wienandi at coopers:~/programs/busybox$ ./busybox ls -l big
> -rw-r--r--    1 Debian-exim  Debian-exim 1099511627777 Jan 15 11:50 big
> 
> function                                             old     new   delta
> showfiles                                            374     563    +189
> list_single                                          981    1036     +55
> ls_main                                              874     895     +21
> ------------------------------------------------------------------------------
> (add/remove: 0/0 grow/shrink: 3/0 up/down: 265/0)             Total: 265 bytes
>    text	   data	    bss	    dec	    hex	filename
>  819405	   4101	   9448	 832954	  cb5ba	busybox_old
>  819675	   4101	   9448	 833224	  cb6c8	busybox_unstripped

The code growth is somewhat bigt, the code is not Unicode friendly,
and patch introduces broken indentation.

For one, try using ints instead of smallints - maybe code will be smaller.

--
vda


More information about the busybox mailing list