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. Execution of the current
process is suspended until the shell exits.
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 upon successful completion.
Otherwise, it returns a negative number and sets errno to indicate the
error.
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.
ERRORS
If the system function fails, errno is set to one of the following
values:
[EAGAIN] The system-imposed limit on the total number of processes under
execution, system-wide or by a single user ID, would be
exceeded.
[EINTR] The system function was interrupted by a signal which was
caught.
[ENOMEM] There is not enough space left for this process.
NOTES
system was formerly declared in the header file stdio.h.
SEE ALSO
exec(2), fork(2). exit(2), wait(2)
sh(1) in the SysV Command Reference.
sh in the Aegis Command Reference.