summaryrefslogtreecommitdiff
path: root/src/head.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-02-16 07:39:17 +0000
committerJim Meyering <jim@meyering.net>2002-02-16 07:39:17 +0000
commit8232744d27936bf57bbbcd790e0b8013ce08eae7 (patch)
treebbd65fd2fd3116ccce2ab9a1dac05cc3558717c3 /src/head.c
parenta5e2a85f07a7a780f8de118f9eab6872c08a060e (diff)
downloadcoreutils-8232744d27936bf57bbbcd790e0b8013ce08eae7.tar.xz
Include posixver.h.
(usage): Document only the intersection of the old and new behaviors, to encourage portability. (main): Revert to previous behavior, except report an error and exit if the obsolete syntax is used and if conforming to the new standard.
Diffstat (limited to 'src/head.c')
-rw-r--r--src/head.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/head.c b/src/head.c
index dd39cbd84..23c29f58c 100644
--- a/src/head.c
+++ b/src/head.c
@@ -32,6 +32,7 @@
#include "system.h"
#include "closeout.h"
#include "error.h"
+#include "posixver.h"
#include "xstrtol.h"
#include "safe-read.h"
@@ -111,12 +112,6 @@ Mandatory arguments to long options are mandatory for short options too.\n\
\n\
SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.\n\
"), stdout);
- if (POSIX2_VERSION < 200112)
- fputs (_("\
-\n\
-(obsolete) If -VALUE is used as first OPTION, same as -c VALUE when one of\n\
-multipliers bkm follows concatenated, else same as -n VALUE.\n\
-"), stdout);
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
}
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
@@ -297,8 +292,7 @@ main (int argc, char **argv)
print_headers = 0;
- if (POSIX2_VERSION < 200112
- && 1 < argc && argv[1][0] == '-' && ISDIGIT (argv[1][1]))
+ if (1 < argc && argv[1][0] == '-' && ISDIGIT (argv[1][1]))
{
char *a = argv[1];
char *n_string = ++a;
@@ -348,13 +342,15 @@ main (int argc, char **argv)
}
}
- if (OBSOLETE_OPTION_WARNINGS && ! getenv ("POSIXLY_CORRECT"))
- error (0, 0,
- _("warning: `head -%s' is obsolete; use `head -%c %.*s%.*s%s'"),
- n_string, count_lines ? 'n' : 'c',
- (int) (end_n_string - n_string), n_string,
- multiplier_char != 0, &multiplier_char,
- header_mode_option[header_mode]);
+ if (200112 <= posix2_version ())
+ {
+ error (0, 0, _("`-%s' option is obsolete; use `-%c %.*s%.*s%s'"),
+ n_string, count_lines ? 'n' : 'c',
+ (int) (end_n_string - n_string), n_string,
+ multiplier_char != 0, &multiplier_char,
+ header_mode_option[header_mode]);
+ usage (EXIT_FAILURE);
+ }
/* Append the multiplier character (if any) onto the end of
the digit string. Then add NUL byte if necessary. */