aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Gomizelj <simongmzlj@gmail.com>2012-08-13 11:07:24 -0400
committerSimon Gomizelj <simongmzlj@gmail.com>2012-08-13 15:20:15 -0400
commit77e694d96c59ec8228b69a6d3cbc7161c9993df4 (patch)
tree78e4c234ba8ce4ca8225b5fc36e0063b00d64a2e
parent3b30c9e8f7f1a3cdbdd2939dfd52ae0ef71d51a4 (diff)
downloadmirror-ponymix-77e694d96c59ec8228b69a6d3cbc7161c9993df4.tar.gz
mirror-ponymix-77e694d96c59ec8228b69a6d3cbc7161c9993df4.tar.bz2
mirror-ponymix-77e694d96c59ec8228b69a6d3cbc7161c9993df4.zip
make kill take an explicit ID
-rw-r--r--pulsemix.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/pulsemix.c b/pulsemix.c
index 557e4cc..c37383a 100644
--- a/pulsemix.c
+++ b/pulsemix.c
@@ -638,8 +638,8 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs(" set-default NAME set default device\n", out);
fputs("\nApplication Commands:\n", out);
- fputs(" move NAME move application stream to device\n", out);
- fputs(" kill kill an application's stream\n", out);
+ fputs(" move ID move application stream to device\n", out);
+ fputs(" kill ID kill an application's stream\n", out);
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
@@ -778,10 +778,11 @@ int main(int argc, char *argv[])
errx(EXIT_FAILURE, "unknown action: %s", argv[optind]);
optind++;
- if (verb == ACTION_SETVOL ||
- verb == ACTION_SETBAL ||
- verb == ACTION_INCREASE ||
- verb == ACTION_DECREASE)
+ switch (verb) {
+ case ACTION_SETVOL:
+ case ACTION_SETBAL:
+ case ACTION_INCREASE:
+ case ACTION_DECREASE:
if (optind == argc)
errx(EXIT_FAILURE, "missing value for action '%s'", argv[optind - 1]);
else {
@@ -789,16 +790,20 @@ int main(int argc, char *argv[])
if (xstrtol(argv[optind], &value) < 0)
errx(EXIT_FAILURE, "invalid number: %s", argv[optind]);
}
- else if (verb == ACTION_SETDEFAULT) {
+ break;
+ case ACTION_SETDEFAULT:
+ case ACTION_KILL:
if (optind == argc)
errx(EXIT_FAILURE, "missing value for action '%s'", argv[optind - 1]);
else
id = argv[optind];
- } else if (verb == ACTION_MOVE) {
+ break;
+ case ACTION_MOVE:
if (optind == argc)
errx(EXIT_FAILURE, "missing value for action '%s'", argv[optind - 1]);
else
arg = argv[optind];
+ default:
}
/* initialize connection */