aboutsummaryrefslogtreecommitdiffstats
path: root/man2/execve.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/execve.2')
-rw-r--r--man2/execve.222
1 files changed, 11 insertions, 11 deletions
diff --git a/man2/execve.2 b/man2/execve.2
index a2d4fa5ff7..eef3c18081 100644
--- a/man2/execve.2
+++ b/man2/execve.2
@@ -721,7 +721,7 @@ The following program is designed to be execed by the second program below.
It just echoes its command-line arguments, one per line.
.PP
.in +4n
-.nf
+.EX
/* myecho.c */
#include <stdio.h>
@@ -737,14 +737,14 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
-.fi
+.EE
.in
.PP
This program can be used to exec the program named in its command-line
argument:
+.PP
.in +4n
-.nf
-
+.EX
/* execve.c */
#include <stdio.h>
@@ -768,20 +768,20 @@ main(int argc, char *argv[])
perror("execve"); /* execve() returns only on error */
exit(EXIT_FAILURE);
}
-.fi
+.EE
.in
.PP
We can use the second program to exec the first as follows:
.PP
.in +4n
-.nf
+.EX
.RB "$" " cc myecho.c \-o myecho"
.RB "$" " cc execve.c \-o execve"
.RB "$" " ./execve ./myecho"
argv[0]: ./myecho
argv[1]: hello
argv[2]: world
-.fi
+.EE
.in
.PP
We can also use these programs to demonstrate the use of a script
@@ -791,25 +791,25 @@ To do this we create a script whose "interpreter" is our
program:
.PP
.in +4n
-.nf
+.EX
.RB "$" " cat > script"
.B #!./myecho script-arg
.B ^D
.RB "$" " chmod +x script"
-.fi
+.EE
.in
.PP
We can then use our program to exec the script:
.PP
.in +4n
-.nf
+.EX
.RB "$" " ./execve ./script"
argv[0]: ./myecho
argv[1]: script-arg
argv[2]: ./script
argv[3]: hello
argv[4]: world
-.fi
+.EE
.in
.SH SEE ALSO
.BR chmod (2),