xref: /original-bsd/lib/libc/stdlib/system.3 (revision bdc0a208)
1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)system.3	6.4 (Berkeley) 04/19/91
7.\"
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
19The
20.Fn system
21function
22hands the argument
23.Fa string
24to the command interpreter
25.Xr sh 1 .
26The calling process waits for the shell
27to finish executing the command,
28ignoring
29.Dv SIGINT
30and
31.Dv SIGQUIT ,
32and blocking
33.Dv SIGCHLD .
34.Pp
35If
36.Fa string
37is a
38.Dv NULL
39pointer,
40.Fn system
41will return non-zero if the command interpreter
42.Xr sh 1
43is available, and zero if it is not.
44.Pp
45The
46.Fn system
47function
48returns the exit status of the shell, or \-1 if the
49.Xr wait 3
50for the shell failed.
51A return value of 127 means the execution of the shell
52failed.
53.Sh SEE ALSO
54.Xr sh 1 ,
55.Xr execve 2 ,
56.Xr wait 2 ,
57.Xr popen 3
58.Sh STANDARDS
59The
60.Fn system
61function
62conforms to
63.St -ansiC .
64