forked from github/abduco
WIP: restructured lowpriority, help, list flags
This commit is contained in:
parent
b70e814c8f
commit
080e3e9e44
24
splex.c
24
splex.c
|
|
@ -225,7 +225,6 @@ static void die(const char *s) {
|
|||
|
||||
static void usage(void) {
|
||||
fprintf(stderr, "usage: abduco [-a|-A|-c|-n] [-p] [-r] [-q] [-l] [-f] [-e detachkey] name command\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static bool xsnprintf(char *buf, size_t size, const char *fmt, ...) {
|
||||
|
|
@ -603,7 +602,7 @@ int main(int argc, char *argv[]) {
|
|||
server.name = basename(argv[0]);
|
||||
gethostname(server.host+1, sizeof(server.host) - 1);
|
||||
|
||||
while ((opt = getopt(argc, argv, "aAclne:fqrv")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "aAchlne:fqrvz")) != -1) {
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
case 'A':
|
||||
|
|
@ -612,8 +611,10 @@ int main(int argc, char *argv[]) {
|
|||
action = opt;
|
||||
break;
|
||||
case 'e':
|
||||
if (!optarg)
|
||||
if (!optarg) {
|
||||
usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (optarg[0] == '^' && optarg[1])
|
||||
optarg[0] = CTRL(optarg[1]);
|
||||
KEY_DETACH = optarg[0];
|
||||
|
|
@ -621,20 +622,27 @@ int main(int argc, char *argv[]) {
|
|||
case 'f':
|
||||
force = true;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
exit(EXIT_SUCCESS);
|
||||
case 'l':
|
||||
list_session();
|
||||
exit(EXIT_SUCCESS);
|
||||
case 'q':
|
||||
quiet = true;
|
||||
break;
|
||||
case 'r':
|
||||
client.flags |= CLIENT_READONLY;
|
||||
break;
|
||||
case 'l':
|
||||
client.flags |= CLIENT_LOWPRIORITY;
|
||||
break;
|
||||
case 'v':
|
||||
puts("splex-0.1, based on abduco-"VERSION" by Marc André Tanner");
|
||||
exit(EXIT_SUCCESS);
|
||||
case 'z':
|
||||
client.flags |= CLIENT_LOWPRIORITY;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -653,8 +661,10 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
if (!action && !server.session_name)
|
||||
exit(list_session());
|
||||
if (!action || !server.session_name)
|
||||
if (!action || !server.session_name) {
|
||||
usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (tcgetattr(STDIN_FILENO, &orig_term) != -1) {
|
||||
server.term = orig_term;
|
||||
|
|
|
|||
Loading…
Reference in New Issue