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