

system()                 General Function                system()




Pass a command to the shell for execution

iinntt ssyysstteemm(_c_o_m_m_a_n_d_l_i_n_e) cchhaarr *_c_o_m_m_a_n_d_l_i_n_e;

system passes  _c_o_m_m_a_n_d_l_i_n_e to the  shell sshh, which  loads it into
memory and  executes it.  ssyysstteemm 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 ssyysstteemm 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 *****

ssyysstteemm 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


