SYSTEM(3S)
NAME
system − issue a shell command
SYNOPSIS
#include <sys/wait.h>
#include <stdlib.h>
int system (string)
const char ∗string;
DESCRIPTION
System causes the string to be given to sh(1) as input, as if the string had been typed as a command at a terminal. The current process waits until the shell has completed, then returns the exit status of the shell.
If the string is a null pointer, system returns 1. Otherwise, system returns the termination status of sh(1) in the format specified by waitpid(2).
FILES
/bin/sh
SEE ALSO
DIAGNOSTICS
System forks to create a child process that in turn exec’s /bin/sh in order to execute string. If the fork fails, system returns -1 and sets errno. If the exec fails, system returns the status value returned by waitpid(2) for a process that terminates with a call of exit(127).
STANDARDS CONFORMANCE
system: SVID2, XPG2, XPG3, ANSI C
Hewlett-Packard Company — HP-UX Release 7.0: Sept 1989