.\" 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
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];