[PATCH 10/10] coresched: rename option '--dest-type' to just '--type'

Benno Schulenberg <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Long options are nice, but they should be as different from each other
as possible, so that one can abbreviate them to just a few letters.
(Not that abbreviating matters here, but that is the general idea.)

The side effect of this change is that the usage text becomes more
readable.

CC: Phil Auld <[email protected]>
CC: Thijs Raymakers <[email protected]>
Signed-off-by: Benno Schulenberg <[email protected]>
---
 bash-completion/coresched |  6 +++---
 schedutils/coresched.c    | 19 +++++++++----------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/bash-completion/coresched b/bash-completion/coresched
index 3a14c5080..a502207e4 100644
--- a/bash-completion/coresched
+++ b/bash-completion/coresched
@@ -18,7 +18,7 @@ _coresched_module()
       COMPREPLY=( $(compgen -W "$sorted_pids" -- "$2") )
       return 0
       ;;
-    "-t"|"--dest-type")
+    "-t"|"--type")
       COMPREPLY=( $(compgen -W "pid tgid pgid" -- "$2") )
       return 0
       ;;
@@ -35,11 +35,11 @@ _coresched_module()
       return 0
       ;;
     'new')
-      COMPREPLY=( $(compgen -W "--dest -- --dest-type --verbose" -- "$2") )
+      COMPREPLY=( $(compgen -W "--dest -- --type --verbose" -- "$2") )
       return 0
       ;;
     'copy')
-      COMPREPLY=( $(compgen -W "--source --dest -- --dest-type --verbose" -- "$2") )
+      COMPREPLY=( $(compgen -W "--source --dest -- --type --verbose" -- "$2") )
       return 0
       ;;
     '-h'|'--help'|'-V'|'--version')
diff --git a/schedutils/coresched.c b/schedutils/coresched.c
index 7634d988c..62eac4b98 100644
--- a/schedutils/coresched.c
+++ b/schedutils/coresched.c
@@ -91,16 +91,16 @@ static void __attribute__((__noreturn__)) usage(void)
 
 	fputs(USAGE_OPTIONS, stdout);
 	fprintf(stdout,
-		_(" -s, --source <PID>       which PID to get the cookie from; if this option\n"
-		  "                            is omitted, the PID of %s itself is used\n"),
+		_(" -s, --source <PID>   which PID to get the cookie from; if this option\n"
+		  "                        is omitted, the PID of %s itself is used\n"),
 		program_invocation_short_name);
-	fputsln(_(" -d, --dest <PID>         which PID to modify the cookie of"), stdout);
-	fputsln(_(" -t, --dest-type <TYPE>   type of the new or destination PID; can be one\n"
-		  "                            of: pid, tgid, pgid; default: tgid"), stdout);
+	fputsln(_(" -d, --dest <PID>     which PID to modify the cookie of"), stdout);
+	fputsln(_(" -t, --type <TYPE>    the type of the new or destination PID; can be\n"
+		  "                        one of: pid, tgid, pgid; default: tgid"), stdout);
 
 	fputs(USAGE_SEPARATOR, stdout);
-	fputsln(_(" -v, --verbose      verbose"), stdout);
-	fprintf(stdout, USAGE_HELP_OPTIONS(20));
+	fputsln(_(" -v, --verbose        say what is being done"), stdout);
+	fprintf(stdout, USAGE_HELP_OPTIONS(22));
 	fprintf(stdout, USAGE_MAN_TAIL("coresched(1)"));
 	exit(EXIT_SUCCESS);
 }
@@ -210,8 +210,7 @@ static sched_core_scope parse_core_sched_type(char *str)
 	else if (!strcmp(str, "pgid"))
 		return PR_SCHED_CORE_SCOPE_PROCESS_GROUP;
 
-	bad_usage(_("'%s' is an invalid option. Must be one of pid/tgid/pgid"),
-		  str);
+	bad_usage(_("'%s' is an invalid type; must be one of pid/tgid/pgid"), str);
 }
 
 static void parse_and_verify_arguments(int argc, char **argv, struct args *args)
@@ -221,7 +220,7 @@ static void parse_and_verify_arguments(int argc, char **argv, struct args *args)
 	static const struct option longopts[] = {
 		{ "source", required_argument, NULL, 's' },
 		{ "dest", required_argument, NULL, 'd' },
-		{ "dest-type", required_argument, NULL, 't' },
+		{ "type", required_argument, NULL, 't' },
 		{ "verbose", no_argument, NULL, 'v' },
 		{ "version", no_argument, NULL, 'V' },
 		{ "help", no_argument, NULL, 'h' },
-- 
2.48.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.