diff options
author | Mattias Andrée <m@maandree.se> | 2024-10-05 23:23:17 +0200 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2024-10-05 23:23:17 +0200 |
commit | 98a8ac8498974e499fc129878ab05b9a7bf8ba30 (patch) | |
tree | 2914967687516632a93da9af59818f22d3120861 /src/mds-respawn.c | |
parent | Update e-mail (diff) | |
download | mds-master.tar.gz mds-master.tar.bz2 mds-master.tar.xz |
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r-- | src/mds-respawn.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/mds-respawn.c b/src/mds-respawn.c index aa02ccf..3439329 100644 --- a/src/mds-respawn.c +++ b/src/mds-respawn.c @@ -1,6 +1,6 @@ /** * mds — A micro-display server - * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se) + * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -104,17 +104,17 @@ int parse_cmdline(void) for (i = 1; i < argc; i++) { arg = argv[i]; - if (startswith(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */ - alarm((unsigned)min(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */ - } else if (startswith(arg, "--interval=")) { - interval = min(atoi(arg + strlen("--interval=")), 60); /* At most 1 minute. */ - } else if (strequals(arg, "--re-exec")) { /* Re-exec state-marshal. */ + if (strstarts(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */ + alarm((unsigned)MIN(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */ + } else if (strstarts(arg, "--interval=")) { + interval = MIN(atoi(arg + strlen("--interval=")), 60); /* At most 1 minute. */ + } else if (streq(arg, "--re-exec")) { /* Re-exec state-marshal. */ is_reexec = 1; - } else if (strequals(arg, "{")) { + } else if (streq(arg, "{")) { servers += stack++ == 0 ? 1 : 0; - } else if (strequals(arg, "}")) { + } else if (streq(arg, "}")) { exit_if (!stack--, eprint("Terminating non-started command, aborting.");); - exit_if (!stack && strequals(argv[i - 1], "{"), + exit_if (!stack && streq(argv[i - 1], "{"), eprint("Zero argument command specified, aborting.");); } else if (!stack) { eprintf("Unrecognised option: %s, did you forget `='?", arg); @@ -139,11 +139,11 @@ int parse_cmdline(void) /* Fill command arrays. */ for (i = 1, args = j = 0; i < argc; i++) { arg = argv[i]; - if (strequals(arg, "}")) + if (streq(arg, "}")) commands_args[args++] = --stack == 0 ? NULL : arg; else if (stack > 0) commands_args[args++] = arg; - else if (strequals(arg, "{") && !stack++) + else if (streq(arg, "{") && !stack++) commands[j++] = commands_args + args; } @@ -277,7 +277,7 @@ postinitialise_server(void) for (i = j = 0; j < servers; i++) { if (!commands_args[i]) j++; - else if (strequals(commands_args[i], "--initial-spawn")) + else if (streq(commands_args[i], "--initial-spawn")) fail_if (xstrdup(commands_args[i], "--respawn")); } |