system

OS/161 Reference Manual

Name

system - run command as subprocess

Library

Standard C Library (libc, -lc)

Synopsis

#include <stdlib.h>

int
system(const char *command);

Description

The system routine executes command as if it were typed into the shell.

Return Values

On success, system returns the exit status returned from waitpid. On error, -1 is returned, and errno is set according to the error encountered.

Errors

Any of the errors from fork or waitpid. Errors generated during execv cannot readily be reported back in detail.

Restrictions

Because the OS/161 base system does not include a shell and makes no assumptions about the shell's operation, system() cannot actually reliably use the shell to parse and execute command. Consequently, system() does it itself, in a way which may not necessarily be compatible with the shell as it finally appears. You may want to change system() to invoke the shell once the shell is available.