draggers: print usage on unknown arguments
also handle on/off as arguments.
This commit is contained in:
parent
ec02769a58
commit
be1b88453c
@ -9,6 +9,14 @@
|
|||||||
#include <Dragger.h>
|
#include <Dragger.h>
|
||||||
|
|
||||||
|
|
||||||
|
int usage(int ret)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "draggers [show|hide]\n");
|
||||||
|
fprintf(stderr, "Shows/sets draggers state\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -19,18 +27,20 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (!strncmp(argv[i], "-h", 2)) {
|
if (!strncmp(argv[i], "-h", 2)) {
|
||||||
printf("draggers [show|hide]\n");
|
return usage(0);
|
||||||
printf("Shows/sets draggers state\n");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
if (!strcmp(argv[i], "1")
|
if (!strcmp(argv[i], "1")
|
||||||
|| !strncmp(argv[i], "en", 2)
|
|| !strncmp(argv[i], "en", 2)
|
||||||
|| !strncmp(argv[i], "sh", 2))
|
|| !strncmp(argv[i], "sh", 2)
|
||||||
|
|| !strncmp(argv[i], "on", 2))
|
||||||
BDragger::ShowAllDraggers();
|
BDragger::ShowAllDraggers();
|
||||||
else if (!strcmp(argv[i], "0")
|
else if (!strcmp(argv[i], "0")
|
||||||
|| !strncmp(argv[i], "di", 2)
|
|| !strncmp(argv[i], "di", 2)
|
||||||
|| !strncmp(argv[i], "hi", 2))
|
|| !strncmp(argv[i], "hi", 2)
|
||||||
|
|| !strncmp(argv[i], "of", 2))
|
||||||
BDragger::HideAllDraggers();
|
BDragger::HideAllDraggers();
|
||||||
|
else
|
||||||
|
return usage(1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user