.\" 2007-09-14 Ollie Wild <aaw@google.com>, mtk
.\" Add text describing limits on command-line arguments + environment
.\"
-.TH EXECVE 2 2013-07-04 "Linux" "Linux Programmer's Manual"
+.TH EXECVE 2 2014-01-08 "Linux" "Linux Programmer's Manual"
.SH NAME
execve \- execute program
.SH SYNOPSIS
associated with the file being executed.
\fIenvp\fP is an array of strings, conventionally of the form
\fBkey=value\fP, which are passed as environment to the new program.
-Both \fIargv\fP and \fIenvp\fP must be terminated by a NULL pointer.
+Both \fIargv\fP and \fIenvp\fP must be terminated by a null pointer.
The argument vector and environment can be accessed by the
called program's main function, when it is defined as:
is the series of words pointed to by the
.I argv
argument of
-.BR execve ().
+.BR execve (),
+starting at
+.IR argv [1].
For portable use,
.I optional-arg
.TP
.B EFAULT
.I filename
+or one of the pointers in the vectors
+.I argv
+or
+.I envp
points outside your accessible address space.
.TP
.B EINVAL
.I envp
can be specified as NULL,
which has the same effect as specifying these arguments
-as a pointer to a list containing a single NULL pointer.
+as a pointer to a list containing a single null pointer.
.B "Do not take advantage of this misfeature!"
It is nonstandard and nonportable:
on most other UNIX systems doing this will result in an error
Since UNIX V7 both are NULL.
.SH EXAMPLE
The following program is designed to be execed by the second program below.
-It just echoes its command-line one per line.
+It just echoes its command-line arguments, one per line.
.in +4n
.nf
char *newenviron[] = { NULL };
if (argc != 2) {
- fprintf(stderr, "Usage: %s <file\-to\-exec>\\n", argv[0]);
- exit(EXIT_FAILURE);
+ fprintf(stderr, "Usage: %s <file\-to\-exec>\\n", argv[0]);
+ exit(EXIT_FAILURE);
}
newargv[0] = argv[1];
.BR environ (7),
.BR path_resolution (7),
.BR ld.so (8)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.