system.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <html>
  2. <head>
  3. <title>system</title>
  4. <body bgcolor=#ffffff>
  5. <h2 align=center>system</h2>
  6. <h4 align=center>OS/161 Reference Manual</h4>
  7. <h3>Name</h3>
  8. system - run command as subprocess
  9. <h3>Library</h3>
  10. Standard C Library (libc, -lc)
  11. <h3>Synopsis</h3>
  12. #include &lt;stdlib.h&gt;<br>
  13. <br>
  14. int<br>
  15. system(const char *<em>command</em>);
  16. <h3>Description</h3>
  17. The system routine executes <em>command</em> as if it were typed into
  18. the shell.
  19. <h3>Return Values</h3>
  20. On success, system returns the exit status returned from
  21. <A HREF=../syscall/waitpid.html>waitpid</A>.
  22. On error, -1 is returned, and <A HREF=../syscall/errno.html>errno</A>
  23. is set according to the error encountered.
  24. <h3>Errors</h3>
  25. Any of the errors from <A HREF=../syscall/fork.html>fork</A> or
  26. <A HREF=../syscall/waitpid.html>waitpid</A>. Errors generated during
  27. <A HREF=../syscall/execv.html>execv</A> cannot readily be reported
  28. back in detail.
  29. <h3>Restrictions</h3>
  30. In OS/161 there may be no shell and when there is the shell's behavior
  31. and syntax is not specified. For this reason we make no assumptions
  32. about the shell's operation, and assume system() cannot reliably use
  33. the shell to parse and execute <em>command</em>. system() does this
  34. itself, in a way which may not necessarily be compatible with the
  35. shell as it finally appears. You may want to change system() to invoke
  36. the shell in a suitable fashion when/if a shell is available.
  37. </body>
  38. </html>