|
|
1.1 ! root 1: ! 2: ! 3: system() General Function system() ! 4: ! 5: ! 6: ! 7: ! 8: Pass a command to the shell for execution ! 9: ! 10: iinntt ssyysstteemm(_c_o_m_m_a_n_d_l_i_n_e) cchhaarr *_c_o_m_m_a_n_d_l_i_n_e; ! 11: ! 12: system passes _c_o_m_m_a_n_d_l_i_n_e to the shell sshh, which loads it into ! 13: memory and executes it. ssyysstteemm executes commands exactly as if ! 14: they had been typed at the COHERENT command level. system may be ! 15: used by commands such as ed, which can pass commands to the ! 16: COHERENT shell in addition to processing normal interactive re- ! 17: quests. ! 18: ! 19: ***** Example ***** ! 20: ! 21: This example uses ssyysstteemm to list the names of all C source files ! 22: in the parent directory. ! 23: ! 24: ! 25: #include <stdio.h> ! 26: main() ! 27: { ! 28: system("cd .. ; ls *.c > mytemp; cat mytemp"); ! 29: } ! 30: ! 31: ! 32: ***** See Also ***** ! 33: ! 34: exec, fork(), general functions, popen(), wait ! 35: ! 36: ***** Diagnostics ***** ! 37: ! 38: ssyysstteemm returns the exit status of the child process, in the for- ! 39: mat described in wait: exit status in the high byte, signal in- ! 40: formation in the low byte. Zero normally means success, whereas ! 41: nonzero normally means failure. This, however, depends on the ! 42: command. If the shell is not executable, system returns a ! 43: special code of octal 0177. ! 44: ! 45: ! 46: ! 47: ! 48: ! 49: ! 50: ! 51: ! 52: ! 53: ! 54: ! 55: ! 56: ! 57: ! 58: ! 59: ! 60: ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.