Exec now uses ConstString

This commit is contained in:
Sasha Koshka 2023-12-12 00:37:02 -05:00
parent 5ab77870d1
commit dc231c6638
2 changed files with 11 additions and 4 deletions

View File

@ -5,9 +5,11 @@
#include <stdio.h>
#include <sys/types.h>
#include <Xmd/String.h>
/* 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

View File

@ -8,7 +8,7 @@
#include <stdlib.h>
#include <unistd.h>
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);