To understand how the exec functions operate, consider how
the OpenVMS system calls any Compaq C program, as shown in the
following syntax:
int main (int argc, char *argv[], char *envp[]);
The identifier argc is the argument count; argv is an array
of argument strings. The first member of the array (argv[0])
contains the name of the image. The arguments are placed in
subsequent elements of the array. The last element of the array
is always the NULL pointer.
An exec function calls a child process in the same way that
the run-time system calls any other Compaq C program. The exec
functions pass the name of the image to be activated in the
child; this value is placed in argv[0]. However, the functions
differ in the way they pass arguments and environment information
to the child:
o Arguments can be passed in separate character strings (execl,
execle, and execlp) or in an array of character strings
(execv, execve, and execvp).
o The environment can be explicitly passed in an array (execle
and execve) or taken from the parent's environment (execl,
execv, execlp, and execvp).
If vfork was called before invoking an exec function, then when
the exec function completes, control is returned to the parent
process at the point of the vfork call. If vfork was not called,
the exec function waits until the child has completed execution
and then exits the parent process. See vfork.