>From 76e60af5ba90fd5c6150639bd19a7a02359df3cb Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Thu, 6 Jan 2022 12:51:03 -0700 Subject: [PATCH 7/9] cut: add -O short-option for --output-delimiter --- src/cut.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/cut.c b/src/cut.c index ed2e903ab..4e86953d3 100644 --- a/src/cut.c +++ b/src/cut.c @@ -132,8 +132,7 @@ static struct field_range_pair *last_frp; non-character as a pseudo short option, starting with CHAR_MAX + 1. */ enum { - OUTPUT_DELIMITER_OPTION = CHAR_MAX + 1, - COMPLEMENT_OPTION + COMPLEMENT_OPTION = CHAR_MAX + 1, }; static struct option const longopts[] = @@ -144,7 +143,7 @@ static struct option const longopts[] = {"delimiter", required_argument, NULL, 'd'}, {"allow-duplicates", required_argument, NULL, 'D'}, {"only-delimited", no_argument, NULL, 's'}, - {"output-delimiter", required_argument, NULL, OUTPUT_DELIMITER_OPTION}, + {"output-delimiter", required_argument, NULL, 'O'}, {"complement", no_argument, NULL, COMPLEMENT_OPTION}, {"zero-terminated", no_argument, NULL, 'z'}, {GETOPT_HELP_OPTION_DECL}, @@ -191,7 +190,7 @@ Print selected parts of lines from each FILE to standard output.\n\ "), stdout); fputs (_("\ -s, --only-delimited do not print lines not containing delimiters\n\ - --output-delimiter=STRING use STRING as the output delimiter\n\ + -O, --output-delimiter=STRING use STRING as the output delimiter\n\ the default is to use the input delimiter\n\ "), stdout); fputs (_("\ @@ -675,7 +674,7 @@ main (int argc, char **argv) delim = '\0'; have_read_stdin = false; - while ((optc = getopt_long (argc, argv, "b:c:d:Df:nsz", longopts, NULL)) != -1) + while ((optc = getopt_long (argc, argv, "b:c:d:Df:nO:sz", longopts, NULL)) != -1) { switch (optc) { @@ -710,7 +709,7 @@ main (int argc, char **argv) delim_specified = true; break; - case OUTPUT_DELIMITER_OPTION: + case 'O': output_delimiter_specified = true; /* Interpret --output-delimiter='' to mean 'use the NUL byte as the delimiter.' */ -- 2.20.1