commit ed1b10cb2eb03d31078fcd5353d60a36c7d77d87
parent fa32f61ef9dcbe04deddad48176d2919ed5b2326
Author: Christoph Lohmann <20h@r-36.net>
Date: Wed, 7 Sep 2011 21:46:01 +0200
Changing the parameter layout.
Diffstat:
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/thingmenu.1 b/thingmenu.1
@@ -17,7 +17,7 @@
.Op Fl wx Ar x position
.Op Fl wy Ar y position
.Op Fl -
-.Ar [label:]cmd ...
+.Ar label0 cmd0 [label1 cmd1 ...]
.Ek
.
.Sh DESCRIPTION
@@ -94,7 +94,7 @@ When being clicked this entry will run
After that the menu will not exit (-s).
.Ed
.Bd -literal
- % thingmenu -s -ww 300 -- "Reboot now:reboot"
+ % thingmenu -s -ww 300 -- "Reboot now" reboot
.Ed
.Bd -filled
@@ -102,7 +102,7 @@ This will create a centered menu, which is aligned based on the length of the
label texts. After the first clicked entry it will exit.
.Ed
.Bd -literal
- % thingmenu "Force reboot:reboot -f" "Shutdown:shutdown"
+ % thingmenu "Force reboot" "reboot -f" Shutdown shutdown
.Ed
.
diff --git a/thingmenu.c b/thingmenu.c
@@ -518,7 +518,7 @@ usage(char *argv0)
{
fprintf(stderr, "usage: %s [-hxso] [-wh height] [-ww width] "
"[-wx x position] [-wy y position] [--] "
- "label:cmd ...\n", argv0);
+ "label0 cmd0 [label1 cmd1 ...]\n", argv0);
exit(1);
}
@@ -585,12 +585,10 @@ main(int argc, char *argv[])
for (; argv[i]; i++) {
label = argv[i];
- cmd = strchr(label, ':');
- if (cmd == NULL) {
- cmd = label;
- } else {
- *cmd++ = '\0';
- }
+ if (!argv[i+1])
+ break;
+ i++;
+ cmd = argv[i];
entries = realloc(entries, sizeof(entries[0])*(++nentries));
entries[nentries-1] = malloc(sizeof(*entries[0]));