#include "dirname.h"
#include "error.h"
#include "full-write.h"
+#include "posixver.h"
#include "safe-read.h"
#include "xstrtol.h"
output file is opened. */
static int verbose;
-static char const shortopts[] = "a:b:l:C:"
-#if POSIX2_VERSION < 200112
-"0123456789"
-#endif
-;
-
static struct option const longopts[] =
{
{"bytes", required_argument, NULL, 'b'},
-C, --line-bytes=SIZE put at most SIZE bytes of lines per output file\n\
-l, --lines=NUMBER put NUMBER lines per output file\n\
"), DEFAULT_SUFFIX_LENGTH);
- if (POSIX2_VERSION < 200112)
- fputs (_("\
- -NUMBER (obsolete) same as -l NUMBER\n\
-"), stdout);
fputs (_("\
--verbose print a diagnostic to standard error just\n\
before each output file is opened\n\
int this_optind = optind ? optind : 1;
long int tmp_long;
- c = getopt_long (argc, argv, shortopts, longopts, NULL);
+ c = getopt_long (argc, argv, "0123456789C:a:b:l:", longopts, NULL);
if (c == -1)
break;
accum = (int) tmp_long;
break;
-#if POSIX2_VERSION < 200112
case '0':
case '1':
case '2':
split_type = type_digits;
accum = accum * 10 + c - '0';
break;
-#endif
case 2:
verbose = 1;
}
}
- if (OBSOLETE_OPTION_WARNINGS
- && digits_optind && ! getenv ("POSIXLY_CORRECT"))
- error (0, 0, _("warning: `split -%d' is obsolete; use `split -l %d'"),
- accum, accum);
+ if (digits_optind && 200112 <= posix2_version ())
+ {
+ error (0, 0, _("`-%d' option is obsolete; use `-l %d'"), accum, accum);
+ usage (EXIT_FAILURE);
+ }
/* Handle default case. */
if (split_type == type_undef)