Allow for squashing of command line options together

This commit is contained in:
David Phillips 2015-06-09 16:00:27 +12:00
parent 33a637bd2a
commit eaf0680276
1 changed files with 29 additions and 25 deletions

View File

@ -562,12 +562,14 @@ int main(int argc, char *argv[]) {
} }
if (server.session_name) if (server.session_name)
usage(); usage();
switch (argv[arg][1]) { int c = 0;
while(argv[arg][++c]) {
switch (argv[arg][c]) {
case 'a': case 'a':
case 'A': case 'A':
case 'c': case 'c':
case 'n': case 'n':
action = argv[arg][1]; action = argv[arg][c];
break; break;
case 'e': case 'e':
if (arg + 1 >= argc) if (arg + 1 >= argc)
@ -590,6 +592,7 @@ int main(int argc, char *argv[]) {
usage(); usage();
} }
} }
}
if (!cmd) { if (!cmd) {
cmd = (char*[]){ getenv("ABDUCO_CMD"), NULL }; cmd = (char*[]){ getenv("ABDUCO_CMD"), NULL };
@ -617,6 +620,7 @@ int main(int argc, char *argv[]) {
case 'n': case 'n':
case 'c': case 'c':
if (force) { if (force) {
fprintf(stderr, "Force!");
if (session_alive(server.session_name)) { if (session_alive(server.session_name)) {
info("session exists and has not yet terminated"); info("session exists and has not yet terminated");
return 1; return 1;