Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Coherent 3.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


system()                 General Function                system()




Pass a command to the shell for execution

int system(commandline) char *commandline;

system passes  commandline to the  shell sh, which  loads it into
memory and  executes it.  system executes  commands exactly as if
they had been typed at the COHERENT command level.  system may be
used  by commands  such as  ed,  which can  pass commands  to the
COHERENT shell  in addition to processing  normal interactive re-
quests.

***** Example *****

This example uses system to list  the names of all C source files
in the parent directory.


#include <stdio.h>
main()
{
        system("cd .. ; ls *.c > mytemp; cat mytemp");
}


***** See Also *****

exec, fork(), general functions, popen(), wait

***** Diagnostics *****

system returns the exit status  of the child process, in the for-
mat described  in wait: exit status in the  high byte, signal in-
formation in the  low byte.  Zero normally means success, whereas
nonzero normally  means failure.   This, however, depends  on the
command.   If  the  shell is  not  executable,  system returns  a
special code of octal 0177.




















COHERENT Lexicon                                           Page 1


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026