summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas <fischer@unix-ag.uni-kl.de>2012-11-09 14:33:08 +0000
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-07-13 00:02:17 -0700
commitf53d8511d26a26e9bd6b1bc665f6283f1efd98d9 (patch)
tree9ba18d489c51a39ff52a18dac065127dca425e59
parentbd1502f50f0c230798bdce99dec6efc76791c024 (diff)
Bug 56923 - Make command line options consistent (single vs double dash)
Most of xrandr's command line options follow the system of single dashes for single character options (e.g. "-v") and double dashes for long options ("--version"). The only exceptions are "-display" and "-help", most likely for historical reasons. To make the behavior consistent across all options, the following patch adds "--display" and "--help" as alternatives to the current inconsistency. The man page got updated as well, recommending double-dash variants for both options. The old behavior is still supported, so the patch should not break any existing usage/script. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xrandr.man6
-rw-r--r--xrandr.c5
2 files changed, 6 insertions, 5 deletions
diff --git a/man/xrandr.man b/man/xrandr.man
index 900095c..93c37aa 100644
--- a/man/xrandr.man
+++ b/man/xrandr.man
@@ -24,7 +24,7 @@
xrandr \- primitive command line interface to RandR extension
.SH SYNOPSIS
.B "xrandr"
-[\-help] [\-display \fIdisplay\fP]
+[\-\-help] [\-\-display \fIdisplay\fP]
[\-q] [\-v]
[\-\-verbose]
[\-\-dryrun]
@@ -84,7 +84,7 @@ There are a few global options. Other options modify the last output that is
specified in earlier parameters in the command line. Multiple outputs may
be modified at the same time by passing multiple \-\-output options followed
immediately by their corresponding modifying options.
-.IP \-help
+.IP \-\-help
Print out a summary of the usage and exit.
.IP "\-v, \-\-version"
Print out the RandR version reported by the X server and exit.
@@ -104,7 +104,7 @@ Performs all the actions specified except that no changes are made.
Apply the modifications without grabbing the screen. It avoids to block other
applications during the update but it might also cause some applications that
detect screen resize to receive old values.
-.IP "\-d, \-display \fIname\fP"
+.IP "\-d, \-\-display \fIname\fP"
This option selects the X display to use. Note this refers to the X
screen abstraction, not the monitor (or output).
.IP "\-\-screen \fIsnum\fP"
diff --git a/xrandr.c b/xrandr.c
index da786cb..0e28a0b 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -99,7 +99,7 @@ usage(void)
{
printf("usage: %s [options]\n", program_name);
printf(" where options are:\n");
- printf(" -display <display> or -d <display>\n");
+ printf(" --display <display> or -d <display>\n");
printf(" --help\n");
printf(" -o <normal,inverted,left,right,0,1,2,3>\n");
printf(" or --orientation <normal,inverted,left,right,0,1,2,3>\n");
@@ -2510,7 +2510,8 @@ main (int argc, char **argv)
program_name = argv[0];
for (i = 1; i < argc; i++) {
- if (!strcmp ("-display", argv[i]) || !strcmp ("-d", argv[i])) {
+ if (!strcmp ("-display", argv[i]) || !strcmp ("--display", argv[i]) ||
+ !strcmp ("-d", argv[i])) {
if (++i >= argc) argerr ("%s requires an argument\n", argv[i-1]);
display_name = argv[i];
continue;