.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\" SUCH DAMAGE.
.\"
.\" @(#)exec.3 8.3 (Berkeley) 1/24/94
-.\" $FreeBSD: src/lib/libc/gen/exec.3,v 1.23 2003/09/10 19:24:32 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/exec.3,v 1.28 2008/06/23 05:22:06 ed Exp $
.\"
.Dd January 24, 1994
.Dt EXEC 3
.Os
.Sh NAME
.Nm execl ,
-.Nm execlp ,
.Nm execle ,
-.Nm exect ,
+.Nm execlp ,
.Nm execv ,
.Nm execvp ,
.Nm execvP
.In unistd.h
.Vt extern char **environ ;
.Ft int
-.Fn execl "const char *path" "const char *arg" ... /* "(char *)0" */
-.Ft int
-.Fn execlp "const char *file" "const char *arg" ... /* "(char *)0" */
+.Fo execl
+.Fa "const char *path"
+.Fa "const char *arg0"
+.Fa ... /* "(char *)0" */
+.Fc
.Ft int
.Fo execle
-.Fa "const char *path" "const char *arg" ...
+.Fa "const char *path"
+.Fa "const char *arg0"
+.Fa ...
.Fa /*
.Bk -words
.Fa "(char *)0" "char *const envp[]" */
.Ek
.Fc
.Ft int
-.Fn exect "const char *path" "char *const argv[]" "char *const envp[]"
+.Fo execlp
+.Fa "const char *file"
+.Fa "const char *arg0"
+.Fa ... /* "(char *)0" */
+.Fc
.Ft int
-.Fn execv "const char *path" "char *const argv[]"
+.Fo execv
+.Fa "const char *path"
+.Fa "char *const argv[]"
+.Fc
.Ft int
-.Fn execvp "const char *file" "char *const argv[]"
+.Fo execvp
+.Fa "const char *file"
+.Fa "char *const argv[]"
+.Fc
.Ft int
-.Fn execvP "const char *file" "const char *search_path" "char *const argv[]"
+.Fo execvP
+.Fa "const char *file"
+.Fa "const char *search_path"
+.Fa "char *const argv[]"
+.Fc
.Sh DESCRIPTION
The
.Nm exec
is to be executed.
.Pp
The
-.Fa "const char *arg"
+.Fa "const char *arg0"
and subsequent ellipses in the
.Fn execl ,
.Fn execlp ,
pointer.
.Pp
The
-.Fn exect ,
.Fn execv ,
.Fn execvp ,
and
.Pp
The
.Fn execle
-and
-.Fn exect
-functions also specify the environment of the executed process by following
-the
+function also specifies the environment of the executed process
+by following the
.Dv NULL
pointer that terminates the list of arguments in the argument list
or the pointer to the argv array with an additional argument.
search path is the path specified in the environment by
.Dq Ev PATH
variable.
-If this variable isn't specified,
+If this variable is not specified,
the default path is set according to the
.Dv _PATH_DEFPATH
definition in
according to whether at least one file with suitable execute permissions
was found.
.Pp
-If the header of a file isn't recognized (the attempted
+If the header of a file is not recognized (the attempted
.Fn execve
returned
.Er ENOEXEC ) ,
these functions will execute the shell with the path of
the file as its first argument.
(If this attempt fails, no further searching is done.)
-.Pp
-The function
-.Fn exect
-executes a file with the program tracing facilities enabled (see
-.Xr ptrace 2 ) .
.Sh RETURN VALUES
If any of the
.Fn exec
.It Pa /bin/sh
The shell.
.El
-.Sh ERRORS
-The
-.Fn execl ,
-.Fn execle ,
-.Fn execlp ,
-.Fn execvp
-and
-.Fn execvP
-functions
-may fail and set
-.Va errno
-for any of the errors specified for the library functions
-.Xr execve 2
-and
-.Xr malloc 3 .
-.Pp
-The
-.Fn exect
-and
-.Fn execv
-functions
-may fail and set
-.Va errno
-for any of the errors specified for the library function
-.Xr execve 2 .
-.Sh SEE ALSO
-.Xr sh 1 ,
-.Xr execve 2 ,
-.Xr fork 2 ,
-.Xr ktrace 2 ,
-.Xr ptrace 2 ,
-.Xr environ 7
.Sh COMPATIBILITY
Historically, the default path for the
.Fn execlp
.Er EIO .
The behaviour was changed to match the behaviour of
.Xr sh 1 .
+.Sh ERRORS
+The
+.Fn execl ,
+.Fn execle ,
+.Fn execlp ,
+.Fn execvp ,
+and
+.Fn execvP
+functions
+may fail and set
+.Va errno
+for any of the errors specified for the library functions
+.Xr execve 2
+and
+.Xr malloc 3 .
+.Pp
+The
+.Fn execv
+function may fail and set
+.Va errno
+for any of the errors specified for the library function
+.Xr execve 2 .
+.Sh SEE ALSO
+.Xr sh 1 ,
+.Xr execve 2 ,
+.Xr fork 2 ,
+.Xr ptrace 2 ,
+.Xr environ 7
.Sh STANDARDS
The
.Fn execl ,
.Fn execv ,
.Fn execle ,
-.Fn execlp
+.Fn execlp ,
and
.Fn execvp
functions