Commit | Line | Data |
---|---|---|
ae59e04c | 1 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
a83c1154 KB |
2 | .\" All rights reserved. |
3 | .\" | |
4 | .\" %sccs.include.redist.man% | |
5 | .\" | |
ae59e04c | 6 | .\" @(#)system.3 6.4 (Berkeley) %G% |
6363d9ff | 7 | .\" |
ae59e04c CL |
8 | .Dd |
9 | .Dt SYSTEM 3 | |
10 | .Os | |
11 | .Sh NAME | |
12 | .Nm system | |
13 | .Nd pass a command to the shell | |
14 | .Sh SYNOPSIS | |
15 | .Fd #include <stdlib.h> | |
16 | .Ft int | |
17 | .Fn system "const char *string" | |
18 | .Sh DESCRIPTION | |
19 | The | |
20 | .Fn system | |
21 | function | |
22 | hands the argument | |
23 | .Fa string | |
a83c1154 | 24 | to the command interpreter |
ae59e04c CL |
25 | .Xr sh 1 . |
26 | The calling process waits for the shell | |
27 | to finish executing the command, | |
28 | ignoring | |
29 | .Dv SIGINT | |
30 | and | |
31 | .Dv SIGQUIT , | |
32 | and blocking | |
33 | .Dv SIGCHLD . | |
34 | .Pp | |
a83c1154 | 35 | If |
ae59e04c CL |
36 | .Fa string |
37 | is a | |
38 | .Dv NULL | |
39 | pointer, | |
40 | .Fn system | |
a83c1154 | 41 | will return non-zero if the command interpreter |
ae59e04c | 42 | .Xr sh 1 |
a83c1154 | 43 | is available, and zero if it is not. |
ae59e04c CL |
44 | .Pp |
45 | The | |
46 | .Fn system | |
47 | function | |
a83c1154 | 48 | returns the exit status of the shell, or \-1 if the |
ae59e04c | 49 | .Xr wait 3 |
a83c1154 | 50 | for the shell failed. |
ae59e04c | 51 | A return value of 127 means the execution of the shell |
a83c1154 | 52 | failed. |
ae59e04c CL |
53 | .Sh SEE ALSO |
54 | .Xr sh 1 , | |
55 | .Xr execve 2 , | |
56 | .Xr wait 2 , | |
57 | .Xr popen 3 | |
58 | .Sh STANDARDS | |
59 | The | |
60 | .Fn system | |
61 | function | |
62 | conforms to | |
63 | .St -ansiC . |