diff options
author | Glenn L McGrath | 2005-12-11 03:09:05 +0000 |
---|---|---|
committer | Glenn L McGrath | 2005-12-11 03:09:05 +0000 |
commit | 0bd0257fe0fb3835af056ec933b010aad2722f93 (patch) | |
tree | c6410295b7270b93ffab84419419b9b05586e370 | |
parent | d77b781c1f0f0913b252c8f207f5518e77733dc3 (diff) | |
download | busybox-0bd0257fe0fb3835af056ec933b010aad2722f93.zip busybox-0bd0257fe0fb3835af056ec933b010aad2722f93.tar.gz |
Add build options to control SuS compatability, allows numeric
option handling to be disabled.
Defaults to enabled, so no changes in default behaviour
-rw-r--r-- | coreutils/fold.c | 3 | ||||
-rw-r--r-- | coreutils/head.c | 3 | ||||
-rw-r--r-- | coreutils/tail.c | 2 | ||||
-rw-r--r-- | include/usage.h | 2 | ||||
-rw-r--r-- | sysdeps/linux/Config.in | 15 |
5 files changed, 24 insertions, 1 deletions
diff --git a/coreutils/fold.c b/coreutils/fold.c index 8f74ed8..ee0fdc2 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c @@ -52,6 +52,8 @@ extern int fold_main(int argc, char **argv) int i; int errs = 0; + +#ifdef CONFIG_FEATURE_SUSv2_OBSOLETE /* Turn any numeric options into -w options. */ for (i = 1; i < argc; i++) { char const *a = argv[i]; @@ -69,6 +71,7 @@ extern int fold_main(int argc, char **argv) } } } +#endif flags = bb_getopt_ulflags(argc, argv, "bsw:", &w_opt); if (flags & FLAG_WIDTH) diff --git a/coreutils/head.c b/coreutils/head.c index dab4de1..a208733 100644 --- a/coreutils/head.c +++ b/coreutils/head.c @@ -56,6 +56,7 @@ int head_main(int argc, char **argv) int c; int retval = EXIT_SUCCESS; +#if defined CONFIG_FEATURE_SUSv2 || defined CONFIG_FEATURE_FANCY_HEAD /* Allow legacy syntax of an initial numeric option without -n. */ if ((argc > 1) && (argv[1][0] == '-') /* && (isdigit)(argv[1][1]) */ @@ -66,7 +67,9 @@ int head_main(int argc, char **argv) p = (*argv) + 1; goto GET_COUNT; } +#endif + /* No size benefit in converting this to bb_getopt_ulflags */ while ((opt = getopt(argc, argv, head_opts)) > 0) { switch(opt) { #ifdef CONFIG_FEATURE_FANCY_HEAD diff --git a/coreutils/tail.c b/coreutils/tail.c index 1db1e2b..cc1517a 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -121,6 +121,7 @@ int tail_main(int argc, char **argv) char *s, *buf; const char *fmt; +#ifdef CONFIG_FEATURE_SUSv2 /* Allow legacy syntax of an initial numeric option without -n. */ if (argc >=2 && ((argv[1][0] == '+') || ((argv[1][0] == '-') /* && (isdigit)(argv[1][1]) */ @@ -130,6 +131,7 @@ int tail_main(int argc, char **argv) optarg = argv[1]; goto GET_COUNT; } +#endif while ((opt = getopt(argc, argv, tail_opts)) > 0) { switch (opt) { diff --git a/include/usage.h b/include/usage.h index 53832b9..2cfd2b0 100644 --- a/include/usage.h +++ b/include/usage.h @@ -766,7 +766,7 @@ "/etc/passwd\n" #define fold_trivial_usage \ - "[-bsw] [FILE]" + "[-bs] [-w WIDTH] [FILE]" #define fold_full_usage \ "Wrap input lines in each FILE (standard input by default), writing to\n" \ "standard output.\n\n" \ diff --git a/sysdeps/linux/Config.in b/sysdeps/linux/Config.in index 95491c9..fb97c8f 100644 --- a/sysdeps/linux/Config.in +++ b/sysdeps/linux/Config.in @@ -203,6 +203,21 @@ config EXTRA_CFLAGS_OPTIONS if you want to add some simple compiler switches (like -march=i686), or check for warnings using -Werror, just those options here. +config CONFIG_FEATURE_SUSv2 + bool "Enable features that are in SuSv2 but not SuSv3?" + default y + help + This option will enable backwards compatability with SuSv2, + specifically, numeric options such as 'head -1 <file>' will be + supported. + +config CONFIG_FEATURE_SUSv2_OBSOLETE + bool "Enable features that are obsolete in SuSv2" + depends on CONFIG_FEATURE_SUSv2 + default y + help + Disables support for numeric arguments in fold. + endmenu menu 'Installation Options' |