From 6d920eca0c6cae9faf401333316cd3698883fbc2 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 24 Oct 1993 19:04:12 +0000 Subject: [PATCH] merge with 1.8g --- old/textutils/ChangeLog | 17 ++++++++++++++++- old/textutils/NEWS | 16 ++++++++++++++++ src/csplit.c | 10 +++++----- src/join.c | 15 ++++----------- src/od.c | 19 ++++++++++--------- src/tail.c | 1 - 6 files changed, 51 insertions(+), 27 deletions(-) diff --git a/old/textutils/ChangeLog b/old/textutils/ChangeLog index 78a01fc..a2fe812 100644 --- a/old/textutils/ChangeLog +++ b/old/textutils/ChangeLog @@ -1,3 +1,18 @@ +Sun Oct 24 00:31:02 1993 Jim Meyering (meyering@comco.com) + + * join.c (main): Accept `-v 1' again. First adding --version + long option had broken it, though -v1 still worked. Call + parse_long_options instead of adding "help" and "version" + to join's longopt strct. + * Makefile.in [SOURCES, OBJECTS, DISTFILES]: Add long-options.c + and long-options.h. + * (join): Depend on and link with long-options.o. + * (join.o): Depend on long-options.h. + + * od.c: Change --compatible (-C) to --backward-compatible (-B). + + * csplit.c: Change --abandon-null-files to --elide-empty-files. + Sat Oct 23 01:00:12 1993 Jim Meyering (meyering@comco.com) * tr.c (get_next, string2_extend): Add default: label to switch stmt. @@ -19,7 +34,7 @@ Fri Oct 22 23:26:17 1993 Jim Meyering (meyering@comco.com) join.c, nl.c, od.c, paste.c, pr.c, sort.c, split.c, sum.c, tac.c, tail.c, tr.c, unexpand.c, uniq.c, version.c, wc.c: Ditto. - * configure.in: Use AC_CONIG_HEADER. + * configure.in: Use AC_CONFIG_HEADER. * Makefile.in [DIST]: Add config.h.in. * Makefile.in: Convert so make may be run from subdirectories. diff --git a/old/textutils/NEWS b/old/textutils/NEWS index 8141076..6530b19 100644 --- a/old/textutils/NEWS +++ b/old/textutils/NEWS @@ -1,5 +1,21 @@ Major changes in release 1.9: * cat -v /dev/null works on more systems +* od's --compatible (-C) flag renamed to --backward-compatible (-B) +* --help and --version exit successfully +* --help gives a one-line description of each option and shows the + correspondence between short and long-named options. +* fix bug in cut. Now `echo 'a:b:c:' | cut -d: -f3-' works. + Before it printed `c' instead of `c:' +* csplit allows repeat counts to be specified via `{*}'. +* csplit accepts a new option, --suffix=format that supercedes the + --digits option. The --digits option will continue to work. +* csplit accepts a new option, --elide-empty-files. +* configure uses config.h, so DEFS won't exceed preprocessor limits of + some compilers on the number of symbols defined via -D. +* work around problem where $(srcdir)/config.h was used instead of + ../config.h -- this happened only when building in a subdirectory + and when config.h remained in $(srcdir) from a previous ./configure. + Major changes in release 1.8: * added non-ANSIfied version of memchr.c from GNU libc. diff --git a/src/csplit.c b/src/csplit.c index 592e2b8..d275326 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -206,7 +206,7 @@ static boolean suppress_count; static boolean remove_files; /* If TRUE, remove all output files which have a zero length. */ -static boolean abandon_null_files; +static boolean elide_empty_files; /* The compiled pattern arguments, which determine how to split the input file. */ @@ -227,7 +227,7 @@ static struct option const longopts[] = {"quiet", no_argument, NULL, 'q'}, {"silent", no_argument, NULL, 's'}, {"keep-files", no_argument, NULL, 'k'}, - {"abandon-null-files", no_argument, NULL, 'z'}, + {"elide-empty-files", no_argument, NULL, 'z'}, {"prefix", required_argument, NULL, 'f'}, {"suffix", required_argument, NULL, 'b'}, {"help", no_argument, &show_help, 1}, @@ -1047,7 +1047,7 @@ close_output_file () error (0, errno, "write error for `%s'", output_filename); cleanup (); } - if (bytes_written == 0 && abandon_null_files) + if (bytes_written == 0 && elide_empty_files) { if (unlink (output_filename)) error (0, errno, "%s", output_filename); @@ -1513,7 +1513,7 @@ main (argc, argv) break; case 'z': - abandon_null_files = TRUE; + elide_empty_files = TRUE; break; default: @@ -1572,7 +1572,7 @@ Usage: %s [OPTION]... FILE PATTERN...\n\ -k, --keep-files do not remove output files on errors\n\ -n, --digits=DIGITS use specified number of digits instead of 2\n\ -s, --quiet, --silent do not print counts of output file sizes\n\ - -z, --abandon-null-files remove empty output files\n\ + -z, --elide-empty-files remove empty output files\n\ --help display this help and exit\n\ --version output version information and exit\n\ \n\ diff --git a/src/join.c b/src/join.c index c8c6493..0b323ec 100644 --- a/src/join.c +++ b/src/join.c @@ -36,6 +36,7 @@ #include #include "system.h" #include "version.h" +#include "long-options.h" char *xmalloc (); char *xrealloc (); @@ -117,8 +118,6 @@ static struct option const longopts[] = {"j", required_argument, NULL, 'j'}, {"j1", required_argument, NULL, '1'}, {"j2", required_argument, NULL, '2'}, - {"help", no_argument, &show_help, 1}, - {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -586,6 +585,9 @@ main (argc, argv) int optc, prev_optc = 0, nfiles, val; program_name = argv[0]; + + parse_long_options (argc, argv, usage); + nfiles = 0; print_pairables = 1; @@ -671,15 +673,6 @@ main (argc, argv) prev_optc = optc; } - if (show_version) - { - printf ("%s\n", version_string); - exit (0); - } - - if (show_help) - usage (0); - if (nfiles != 2) usage (1); diff --git a/src/od.c b/src/od.c index e47df00..e92db6e 100644 --- a/src/od.c +++ b/src/od.c @@ -215,7 +215,7 @@ static unsigned long int flag_dump_strings; /* Non-zero if we should recognize the pre-POSIX non-option arguments that specified at most one file and optional arguments specifying offset and pseudo-start address. */ -static int flag_compatibility; +static int backward_compatibility; /* Non-zero if an old-style `pseudo-address' was specified. */ static long int flag_pseudo_start; @@ -298,7 +298,7 @@ static struct option const long_options[] = {"output-duplicates", no_argument, NULL, 'v'}, /* non-POSIX options. */ - {"compatible", no_argument, NULL, 'C'}, + {"backward-compatible", no_argument, NULL, 'B'}, {"strings", optional_argument, NULL, 's'}, {"width", optional_argument, NULL, 'w'}, {"help", no_argument, &show_help, 1}, @@ -323,7 +323,7 @@ Usage: %s [OPTION]... [FILE]...\n\ printf ("\ \n\ -A, --address-radix RADIX decide how file offsets are printed\n\ - -C, --compatible trigger older syntax\n\ + -C, --backward-compatible trigger older syntax\n\ -N, --read-bytes BYTES limit dump to BYTES input bytes per file\n\ -j, --skip-bytes BYTES skip BYTES input bytes first on each file\n\ -s, --strings [BYTES] output strings of at least BYTES graphic chars\n\ @@ -1732,7 +1732,7 @@ main (argc, argv) address_pad_len = 7; flag_dump_strings = 0; - while ((c = getopt_long (argc, argv, "abcCdfhilos::xw::A:j:N:t:v", + while ((c = getopt_long (argc, argv, "abBcdfhilos::xw::A:j:N:t:v", long_options, (int *) 0)) != EOF) { @@ -1809,8 +1809,8 @@ main (argc, argv) abbreviate_duplicate_blocks = 0; break; - case 'C': - flag_compatibility = 1; + case 'B': + backward_compatibility = 1; break; /* The next several cases map the old, pre-POSIX format @@ -1874,12 +1874,13 @@ main (argc, argv) n_files = argc - optind; - /* If the --compatible option is used, there may be from 0 to 3 - remaining command line arguments; handle each case separately. + /* If the --backward-compatible option is used, there may be from + 0 to 3 remaining command line arguments; handle each case + separately. od [file] [[+]offset[.][b] [[+]label[.][b]]] The offset and pseudo_start have the same syntax. */ - if (flag_compatibility) + if (backward_compatibility) { long int offset; diff --git a/src/tail.c b/src/tail.c index 91c470b..51a71c3 100644 --- a/src/tail.c +++ b/src/tail.c @@ -59,7 +59,6 @@ #include #include #include -#include #include "system.h" #include "version.h" -- 2.7.4