Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / exec.h / exec_ae.3.md

% limb manual
% exec_ae(3)
% limb 0.2.0
% 2024-01-09

# NAME

exec_ae, exec_a, exec_e, exec - execute a file

# SYNOPSIS

    #include <limb/exec.h>

```pre hl
void exec_ae(const char *<em>file</em>, const char * const *<em>argv</em>, const char * const *<em>env</em>)
void exec_a(const char *<em>file</em>, const char * const *<em>argv</em>)
void exec_e(const char * const *<em>argv</em>, const char * const *<em>env</em>)
void exec(const char * const *<em>argv</em>)
```

# DESCRIPTION

These functions will replace the current process image with a new process image,
constructed from a regular executable file.

The `exec_ae`() function will execute into `file`. If it does not contain a
slash (`/`) then the file will be searched into the directories specified in the
environment variable `PATH` or, if there's none, in the constant
`SKALIBS_DEFAULTPATH` (defined when compiling skalibs).

The `argv` and `env` arguments shall point to the arrays of arguments and
environment for the new process, respectively. Execution is performed using a
call to [execve](3).

The `exec_a`() macro is similar to `exec_ae`() but using the global variable
`environ` as environment.

The `exec_e`() macro is similar to `exec_ae`() using `argv[0]` as file to
execute.

The `exec`() macro is similar to `exec_a`() using `argv[0]` as file to execute.

# RETURN VALUE

These functions should not return on success. Otherwise they set `errno` to
indicate the error.

# ERRORS

These functions might fail and set `errno` for any of the errors described for
[execve](3).