aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author"Vladimir N. Oleynik" <dzo@simtreas.ru>2006-01-30 11:15:11 +0000
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>2006-01-30 11:15:11 +0000
commite75b41d9905d91b388b18d4395dae72ab17d31b7 (patch)
tree142f634a50b1df75150d9794dd52f4cb0898769d
parentb1fd52e0b7e58a678766d2f67190d9b30399b628 (diff)
downloadbusybox-w32-e75b41d9905d91b388b18d4395dae72ab17d31b7.tar.gz
busybox-w32-e75b41d9905d91b388b18d4395dae72ab17d31b7.tar.bz2
busybox-w32-e75b41d9905d91b388b18d4395dae72ab17d31b7.zip
support GNU suffixes for fancy mode: b(512), k(1024) and m(1024*1024)
-rw-r--r--coreutils/head.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/coreutils/head.c b/coreutils/head.c
index 17d3ef890..184e8161c 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -25,6 +25,15 @@ static const char head_opts[] =
25#endif 25#endif
26 ; 26 ;
27 27
28#if ENABLE_FEATURE_FANCY_HEAD
29static const struct suffix_mult head_suffixes[] = {
30 { "b", 512 },
31 { "k", 1024 },
32 { "m", 1024*1024 },
33 { NULL, 0 }
34};
35#endif
36
28static const char header_fmt_str[] = "\n==> %s <==\n"; 37static const char header_fmt_str[] = "\n==> %s <==\n";
29 38
30int head_main(int argc, char **argv) 39int head_main(int argc, char **argv)
@@ -75,7 +84,14 @@ int head_main(int argc, char **argv)
75#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_HEAD 84#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
76 GET_COUNT: 85 GET_COUNT:
77#endif 86#endif
87
88#if !ENABLE_FEATURE_FANCY_HEAD
78 count = bb_xgetularg10(p); 89 count = bb_xgetularg10(p);
90#else
91 count = bb_xgetularg_bnd_sfx(p, 10,
92 0, ULONG_MAX,
93 head_suffixes);
94#endif
79 break; 95 break;
80 default: 96 default:
81 bb_show_usage(); 97 bb_show_usage();