]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: refactor and update expand and unexpand --help
authorPádraig Brady <P@draigBrady.com>
Sun, 2 Apr 2017 23:52:34 +0000 (16:52 -0700)
committerPádraig Brady <P@draigBrady.com>
Sun, 2 Apr 2017 23:52:34 +0000 (16:52 -0700)
* src/expand-common.c (emit_tab_list_info): A new function to
output the extended info on --tab=LIST, including the new
'+' and '/' prefixes.
* src/expand-common.h: Declare the above.
* src/expand.c (usage:): Call emit_tab_list_info and
match alignment with that used in unexpand --help.
* src/unexpand.c (usage): Likewise.

src/expand-common.c
src/expand-common.h
src/expand.c
src/unexpand.c

index 05e5bec2d8940aa8c49709522f2c6f384f769018..8c83fb36527ed5fa14289863da9f6a08e3a1b89d 100644 (file)
@@ -382,3 +382,20 @@ cleanup_file_list_stdin (void)
     if (have_read_stdin && fclose (stdin) != 0)
       die (EXIT_FAILURE, errno, "-");
 }
+
+
+extern void
+emit_tab_list_info (void)
+{
+  /* suppress syntax check for emit_mandatory_arg_note() */
+  fputs (_("\
+  -t, --tabs=LIST  use comma separated list of tab positions\n\
+"), stdout);
+  fputs (_("\
+                     The last specified position can be prefixed with '/'\n\
+                     to specify a tab size to use after the last\n\
+                     explicitly specified tab stop.  Also a prefix of '+'\n\
+                     can be used to align remaining tab stops relative to\n\
+                     the last specified tab stop instead of the first column\n\
+"), stdout);
+}
index 5eec99d6bad028ae312a368ec6014433f931b005..8cc6ebe1989cbce38b9df709db8a31b66e6c0448 100644 (file)
@@ -70,3 +70,7 @@ next_file (FILE *fp);
 /* */
 extern void
 cleanup_file_list_stdin (void);
+
+
+extern void
+emit_tab_list_info (void);
index 2b7781ca51e257f335c0885a96fa0e1cbccbe35e..1e783169a28770ceac80ed071dcd8b7d1893431f 100644 (file)
@@ -78,12 +78,10 @@ Convert tabs in each FILE to spaces, writing to standard output.\n\
       emit_mandatory_arg_note ();
 
       fputs (_("\
-  -i, --initial       do not convert tabs after non blanks\n\
-  -t, --tabs=NUMBER   have tabs NUMBER characters apart, not 8\n\
-"), stdout);
-      fputs (_("\
-  -t, --tabs=LIST     use comma separated list of explicit tab positions\n\
+  -i, --initial    do not convert tabs after non blanks\n\
+  -t, --tabs=N     have tabs N characters apart, not 8\n\
 "), stdout);
+      emit_tab_list_info ();
       fputs (HELP_OPTION_DESCRIPTION, stdout);
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
       emit_ancillary_info (PROGRAM_NAME);
index fd334ddc809a17e9297932513739c75497f121d7..60c9422ef449495cb3f82e2629e4da7ff6f897da 100644 (file)
@@ -90,8 +90,8 @@ Convert blanks in each FILE to tabs, writing to standard output.\n\
   -a, --all        convert all blanks, instead of just initial blanks\n\
       --first-only  convert only leading sequences of blanks (overrides -a)\n\
   -t, --tabs=N     have tabs N characters apart instead of 8 (enables -a)\n\
-  -t, --tabs=LIST  use comma separated LIST of tab positions (enables -a)\n\
 "), stdout);
+      emit_tab_list_info ();
       fputs (HELP_OPTION_DESCRIPTION, stdout);
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
       emit_ancillary_info (PROGRAM_NAME);