SYSTEM(3) BSD SYSTEM(3)
NAME
system - issue a shell command
SYNOPSIS
#include <stdlib.h>
int system(string)
const char *string;
DESCRIPTION
The system function causes the string pointed to by string to be given to
the command processor (sh(1)) as input, as if the string had been typed
as a command at a terminal. If string is a null pointer, system returns
1 to indicate that a command processor is available.
If system cannot exec /bin/sh, it tries to exec /com/sh. If either exec
is successful, the current process waits until the shell has completed,
then returns the exit status of the shell.
FILES
/bin/sh
/com/sh
DIAGNOSTICS
system returns 1 if given a null pointer. If string is not null, system
returns the exit status of the shell, or 127 if the shell could not be
executed.
If a signal other than SIGINT or SIGQUIT is received during the call,
system returns -1 and sets errno.
NOTES
system was formerly declared in the header file stdio.h.
SEE ALSO
exec(2), fork(2), wait(2).
sh(1) in the BSD Command Reference.
sh in the Aegis Command Reference.