From b5599364c3f410dafef4ecc415f8081593dae012 Mon Sep 17 00:00:00 2001
From: Laurent Bercot
- void execvep_loose (char const *file, char const *const *argv, char const *const *envp, char const *path)
-Executes into the executable file at file, with the command line
-set to argv and the environment set to envp.
-If file is not an absolute path, it is searched in the
-path string, which must contain a colon-separated list of
-search directories such as the contents of the PATH environment variable.
-The function returns if it fails, and sets errno to the most relevant
-error that happened.
-
- void execvep (char const *file, char const *const *argv, char const *const *envp, char const *path)
-Like execvep_loose(), but if file contains a slash,
-it is treated as an absolute path.
-
- void pathexec_run (char const *file, char const *const *argv, char const *const *envp)
-Performs execvep(file, argv, envp, path), path being the
-contents of the PATH environment variable. If PATH is not set, path
-is set to the value given to the --with-default-path option of the
-skalibs' ./configure script, or to /usr/bin:/bin by default.
-The function returns if it fails, and sets errno appropriately.
-
- pathexec_run() is the standard skalibs API to perform an -exec call with a path search. It is recommended that you use -it instead of the Single Unix -execvp() or -execlp() -functions, because execvp and execlp default to execution of -the /bin/sh interpreter with file as an argument if they -cannot find a suitable executable file, and this is: -
- -- execvep() and pathexec_run() just fail with ENOENT -when they cannot find a file to exec into, which is the -sensible behaviour. -
- -
- void pathexec0_run (char const *const *argv, char const *const *envp)
-Performs pathexec_run(argv[0], argv, envp). If argv is empty, i.e.
-argv[0] is null, the process exits 0 instead. Rationale: executing
-the empty command line should amount to executing true, i.e.
-simply exiting 0.
-
- void pathexec_r_name (char const *file, char const *const *argv, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen)
-Alters envp (which does not have to be NULL-terminated, but the
-number envlen of elements must be provided) with the modifier
-string modifs of length modiflen, then performs
-pathexec_run(file, argv, altered-envp).
-
- void pathexec_r (char const *const *argv, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen)
-Same as pathexec_r_name, except that the file argument is read from argv[0].
-
- int pathexec_env (char const *var, char const *value)
-Adds the "add variable var with value value" instruction
-(if value is not null) or the "unset var" instruction
-(if value is null) to a static hidden modifier string, used by the
-following three functions.
-Returns 1 if it succeeds and 0 (and sets errno) if it fails.
-
- void pathexec_fromenv (char const *const *argv, char const *const *envp, size_t envlen)
-Performs pathexec_r() with the given arguments and the hidden modifier
-string.
-
- void pathexec (char const *const *argv)
-Executes into the argv command line, with the current environment
-modified by the hidden modifier string.
-
- void pathexec0 (char const *const *argv)
-Executes into the argv command line, with the current environment
-modified by the hidden modifier string. If this command line is empty,
-exit 0 instead.
-
-void xexecvep (char const *, char const *const *, char const *const *, char const *)
-void xpathexec_r (char const *const *, char const *const *, size_t, char const *, size_t)
-void xpathexec_r_name (char const *, char const *const *, char const *const *, size_t, char const *, size_t)
-void xpathexec_fromenv (char const *const *, char const *const *, size_t)
-void xpathexec_run (char const *, char const *const *, char const *const *)
-void xpathexec0_run (char const *const *, char const *const *)
-void xpathexec (char const *const *)
-void xpathexec0 (char const *const *)
-
- Those functions provide the same functionality as the non-x-prefixed versions, -but if the execution fails (i.e. the process cannot exec into a new program), then -the process dies with a 111 exit code and an error message on stderr. -
- -- The env library interface provides additional functions -to manipulate modifier strings and environments. -
--- cgit v1.2.3