aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Gomizelj <simongmzlj@gmail.com>2012-08-13 11:56:47 -0400
committerSimon Gomizelj <simongmzlj@gmail.com>2012-08-13 15:21:23 -0400
commit38b8be02986486b0ca696b07a2fc5a888af2af28 (patch)
treee7c371008bbb40775cac8fdcd91f92c00cdcf3fe
parent7dbdac3b192f20bb6885254ed097fb18bcbc0d5e (diff)
downloadmirror-ponymix-38b8be02986486b0ca696b07a2fc5a888af2af28.tar.gz
mirror-ponymix-38b8be02986486b0ca696b07a2fc5a888af2af28.tar.bz2
mirror-ponymix-38b8be02986486b0ca696b07a2fc5a888af2af28.zip
make move take all its arguments explictly
-rw-r--r--pulsemix.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/pulsemix.c b/pulsemix.c
index 0bea9d4..ae1e8d0 100644
--- a/pulsemix.c
+++ b/pulsemix.c
@@ -635,10 +635,10 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs("\nDevice Commands:\n", out);
fputs(" defaults list default devices\n", out);
- fputs(" set-default NAME set default device\n", out);
+ fputs(" set-default DEVICE set default device\n", out);
fputs("\nApplication Commands:\n", out);
- fputs(" move ID move application stream to device\n", out);
+ fputs(" move ID DEVICE move application stream to device\n", out);
fputs(" kill ID kill an application's stream\n", out);
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
@@ -794,15 +794,17 @@ int main(int argc, char *argv[])
case ACTION_SETDEFAULT:
case ACTION_KILL:
if (optind == argc)
- errx(EXIT_FAILURE, "missing value for action '%s'", argv[optind - 1]);
+ errx(EXIT_FAILURE, "missing arguments for action '%s'", argv[optind - 1]);
else
id = argv[optind];
break;
case ACTION_MOVE:
- if (optind == argc)
- errx(EXIT_FAILURE, "missing value for action '%s'", argv[optind - 1]);
- else
+ if (optind > argc - 2)
+ errx(EXIT_FAILURE, "missing arguments for action '%s'", argv[optind - 1]);
+ else {
+ id = argv[optind++];
arg = argv[optind];
+ }
break;
default:
break;