aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-12-28 20:14:17 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-12-28 20:14:17 +0100
commit8ff6f4dc79170d4029c7068235ddee5059432d48 (patch)
tree1a77009d2c03fe2671eacc6037a15d8a760635e9
parentb8954c679ba5134af359ecaa3ec9a28ef36111fd (diff)
Make cmdexec() a macro
-rw-r--r--cbs.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/cbs.h b/cbs.h
index 3a24b30..b2a78fe 100644
--- a/cbs.h
+++ b/cbs.h
@@ -109,7 +109,7 @@ static void cmdaddv(struct cmd *, char **p, size_t n);
*(c)->argv = NULL; \
} while (0)
-/* The cmdexec() function executes the given command and waits for it to
+/* The cmdexec() macro executes the given command and waits for it to
terminate, returning its exit code. The cmdexeca() function executes the
given command and returns immediately, returning its process ID.
@@ -118,9 +118,9 @@ static void cmdaddv(struct cmd *, char **p, size_t n);
size of the output in *n.
cmdexec() and cmdexecb() have the same return values as cmdwait(). */
-static int cmdexec(struct cmd);
static pid_t cmdexeca(struct cmd);
static int cmdexecb(struct cmd, char **p, size_t *n);
+#define cmdexec(c) cmdwait(cmdexeca(c));
/* Wait for the process with the given PID to terminate, and return its exit
status. If the process was terminated by a signal 256 is returned. */
@@ -256,12 +256,6 @@ cmdaddv(struct cmd *cmd, char **xs, size_t n)
cmd->argv[cmd->len] = NULL;
}
-int
-cmdexec(struct cmd c)
-{
- return cmdwait(cmdexeca(c));
-}
-
pid_t
cmdexeca(struct cmd c)
{