SYSTEM(3S) SysV SYSTEM(3S)
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.
system forks to create a child process that in turn exec's /bin/sh (or
/com/sh) in order to execute string. If the fork or exec fails, system
returns a negative value and sets errno.
NOTES
system was formerly declared in the header file stdio.h.
SEE ALSO
exec(2), fork(2).
sh(1) in the SysV Command Reference.
sh in the Aegis Command Reference.