HPUX system[3s]

system in anderen Kapiteln des hpux Handbuch:
system.3f
system(3S) system(3S)
NAME
system() - issue a shell command
SYNOPSIS
#include <stdlib.h>
int system(const char *command);
DESCRIPTION
system() executes the command specified by the string pointed to by
command. The environment of the executed command is as if a child
process were created using fork() (see fork(2)), and the child process
invoked the sh-posix(1) utility via a call to execl() (see execl(2))
as follows:
execl("/bin/posix/sh", "sh", "-c", command, 0);
system() ignores the SIGINT and SIGQUIT signals, and blocks the
SIGCHLD signal, while waiting for the command to terminate. If this
might cause the application to miss a signal that would have killed
it, the application should examine the return value from system() and
take whatever action is appropriate to the application if the command
terminated due to receipt of a signal.
system() does not affect the termination status of any child of the
calling processes other than the process or processes it itself
creates.
system() does not return until the child process has terminated.
Application Usage
If the return value of system() is not -1, its value can be decoded
through the use of the macros described in <sys/wait.h>. For
convenience, these macros are also provided in <stdlib.h>.
Note that, while system() must ignore SIGINT and SIGQUIT and block
SIGCHLD while waiting for the child to terminate, the handling of
signals in the executed command is as specified by fork(2) and
exec(2). For example, if SIGINT is being caught or is set to SIG_DFL
when system() is called, the child is started with SIGINT handling set
to SIG_DFL.
Ignoring SIGINT and SIGQUIT in the parent process prevents
coordination problems (such as two processes reading from the same
terminal) when the executed command ignores or catches one of the
signals.
RETURN VALUE
If command is null, system() returns non-zero.
Hewlett-Packard Company - 1 - HP-UX Release 9.0: August 1992
system(3S) system(3S)
If command is not null, system() returns the termination status of the
command language interpreter in the format specified by waitpid(2).
The termination status of the command language interpreter is as
specified for sh-posix(1), except that if some error prevents the
command language interpreter from executing after the child process is
created, the return value from system() is as if the command language
interpreter had terminated using _exit(127). If a child process
cannot be created, or if the termination status for the command
language interpreter cannot be obtained, system() returns -1 and sets
errno to indicate the error.
DIAGNOSTICS
system() forks to create a child process which, in turn, exec()s
/bin/posix/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() (see waitpid(2)) for a process that
terminates with a call of exit(127).
ERRORS
If errors are encountered, system() sets errno values as described by
fork(2).
FILES
/bin/posix/sh
SEE ALSO
sh(1), fork(2), exec(2), waitpid(2).
STANDARDS CONFORMANCE
system(): AES, SVID2, XPG2, XPG3, XPG4, POSIX.2, ANSI C
Hewlett-Packard Company - 2 - HP-UX Release 9.0: August 1992