attatched is a patch that adds support for the -w option to seq.
# ./busybox seq -w 001 010
001
002
003
004
005
006
007
008
009
010
# make bloatcheck
function old new delta
seq_main 268 320 +52
.rodata 169558 169564 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 58/0) Total: 58
bytes
text data bss dec hex filename
942990 9145 5288 957423 e9bef busybox_old
943048 9145 5288 957481 e9c29 busybox_unstripped
-nc
Index: coreutils/seq.c
===================================================================
--- coreutils/seq.c (revision 23942)
+++ coreutils/seq.c (working copy)
@@ -16,6 +16,10 @@
int seq_main(int argc, char **argv)
{
double last, increment, i;
+ int width = getopt32(argv, "w");
+
+ argc -= optind;
+ argv += optind;
i = increment = 1;
switch (argc) {
@@ -29,10 +33,12 @@
default:
bb_show_usage();
}
+ if (width)
+ width = strlen(argv[argc-1]);
/* You should note that this is pos-5.0.91 semantics, -- FK. */
while ((increment > 0 && i <= last) || (increment < 0 && i >= last)) {
- printf("%g\n", i);
+ printf("%0*g\n", width, i);
i += increment;
}
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox