carta
pclose_execs(3)

pclose_execs3

Pipe stream to or from a process without using a shell

Part of popen_nosh(3).

Usage

FILE *popen_nosh(const char *command, const char *type);

int pclose_nosh(FILE *stream);

FILE *popen_execsp(const char *command, const char *type);

int pclose_execsp(FILE *stream);

FILE *popen_execs(const char *path,const char *command, const char *type);

int pclose_execs(FILE *stream);

Overview

popen_nosh, popen_execsp and pclose_nosh are almost drop in replacement for popen(3) and pclose(3) provided by the libc. popen_nosh and popen_execsp are synonyms: they parse the command string and run the command directly, without using a shell.
Command arguments in args are delimited by space characters (blank, tabs or new lines). Single or double quotes can be used to delimitate command arguments including spaces and a non quoted backslash (\) is the escape character to protect the next char. The executable file is sought using the PATH environment variable as explained for execlp(3).
pclose_nosh closes a stream opened by popen_nosh.
popen_execs requires the path of the executable to be specified as its first parameter so it does not use the PATH environment variable. pclose_execs closes a stream opened by popen_execs.

Return value

These functions have the same return values of popen(3) and pclose(3).

From libexecs-dev 1.4-2+b2 in Debian 13 (Trixie). Parsed by carta from the page's man source.