From dc231c66380ba50c619e6476bfc35af927fbb84d Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 12 Dec 2023 00:37:02 -0500 Subject: [PATCH] Exec now uses ConstString --- libXmd/include/Xmd/Exec.h | 8 ++++++-- libXmd/src/Exec.c | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libXmd/include/Xmd/Exec.h b/libXmd/include/Xmd/Exec.h index bd85833..fc97764 100644 --- a/libXmd/include/Xmd/Exec.h +++ b/libXmd/include/Xmd/Exec.h @@ -5,9 +5,11 @@ #include #include +#include + /* XmdVaPipedExecPath is like XmdPipedExecPath, but it takes in a vararg list to use as the "args" array. The vararg list must be terminated by NULL. */ -FILE *XmdVaPipedExecPath (const String file, pid_t *child, String mode, ...); +FILE *XmdVaPipedExecPath (ConstString file, pid_t *child, String mode, ...); /* XmdPipedExecPath is like popen(), but takes in an explicit command name and argument list instead of a shell command. The argument list must be @@ -17,6 +19,8 @@ FILE *XmdVaPipedExecPath (const String file, pid_t *child, String mode, ...); To correctly close the connection to the child process, first fclose() the returned file, and then call waitpid() on the child PID. */ -FILE *XmdPipedExecPath (const String file, pid_t *child, String mode, String const argv[]); +FILE *XmdPipedExecPath ( + ConstString file, pid_t *child, String mode, + const String argv[]); #endif diff --git a/libXmd/src/Exec.c b/libXmd/src/Exec.c index bfb1a73..2894a59 100644 --- a/libXmd/src/Exec.c +++ b/libXmd/src/Exec.c @@ -8,7 +8,7 @@ #include #include -FILE *XmdVaPipedExecPath (const String file, pid_t *child, String mode, ...) { +FILE *XmdVaPipedExecPath (ConstString file, pid_t *child, String mode, ...) { XmdBuffer *buffer = XmdBufferNew(String); va_list argList; va_start(argList, mode); @@ -26,7 +26,10 @@ FILE *XmdVaPipedExecPath (const String file, pid_t *child, String mode, ...) { return pipe; } -FILE *XmdPipedExecPath (const String file, pid_t *child, String mode, String const argv[]) { +FILE *XmdPipedExecPath ( + ConstString file, pid_t *child, String mode, + const String argv[] +) { int pipes[2]; pipe(pipes);