summaryrefslogtreecommitdiffstats
path: root/man2/execve.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/execve.2')
-rw-r--r--man2/execve.216
1 files changed, 8 insertions, 8 deletions
diff --git a/man2/execve.2 b/man2/execve.2
index 20804ead7..538ebb90c 100644
--- a/man2/execve.2
+++ b/man2/execve.2
@@ -777,16 +777,16 @@ It just echoes its command-line arguments, one per line.
.\" SRC BEGIN (myecho.c)
.EX
/* myecho.c */
-
+\&
#include <stdio.h>
#include <stdlib.h>
-
+\&
int
main(int argc, char *argv[])
{
for (size_t j = 0; j < argc; j++)
printf("argv[%zu]: %s\en", j, argv[j]);
-
+\&
exit(EXIT_SUCCESS);
}
.EE
@@ -800,24 +800,24 @@ argument:
.\" SRC BEGIN (execve.c)
.EX
/* execve.c */
-
+\&
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-
+\&
int
main(int argc, char *argv[])
{
static char *newargv[] = { NULL, "hello", "world", NULL };
static char *newenviron[] = { NULL };
-
+\&
if (argc != 2) {
fprintf(stderr, "Usage: %s <file\-to\-exec>\en", argv[0]);
exit(EXIT_FAILURE);
}
-
+\&
newargv[0] = argv[1];
-
+\&
execve(argv[1], newargv, newenviron);
perror("execve"); /* execve() returns only on error */
exit(EXIT_FAILURE);