• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/libc/
1<html lang="en">
2<head>
3<title>system - Untitled</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Untitled">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Stdlib.html#Stdlib" title="Stdlib">
9<link rel="prev" href="wcstoull.html#wcstoull" title="wcstoull">
10<link rel="next" href="wcstombs.html#wcstombs" title="wcstombs">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<meta http-equiv="Content-Style-Type" content="text/css">
13<style type="text/css"><!--
14  pre.display { font-family:inherit }
15  pre.format  { font-family:inherit }
16  pre.smalldisplay { font-family:inherit; font-size:smaller }
17  pre.smallformat  { font-family:inherit; font-size:smaller }
18  pre.smallexample { font-size:smaller }
19  pre.smalllisp    { font-size:smaller }
20  span.sc    { font-variant:small-caps }
21  span.roman { font-family:serif; font-weight:normal; } 
22  span.sansserif { font-family:sans-serif; font-weight:normal; } 
23--></style>
24<link rel="stylesheet" type="text/css" href="../cs.css">
25</head>
26<body>
27<div class="node">
28<a name="system"></a>
29<p>
30Next:&nbsp;<a rel="next" accesskey="n" href="wcstombs.html#wcstombs">wcstombs</a>,
31Previous:&nbsp;<a rel="previous" accesskey="p" href="wcstoull.html#wcstoull">wcstoull</a>,
32Up:&nbsp;<a rel="up" accesskey="u" href="Stdlib.html#Stdlib">Stdlib</a>
33<hr>
34</div>
35
36<h3 class="section">2.45 <code>system</code>&mdash;execute command string</h3>
37
38<p><a name="index-system-106"></a><a name="index-g_t_005fsystem_005fr-107"></a><strong>Synopsis</strong>
39<pre class="example">     #include &lt;stdlib.h&gt;
40     int system(char *<var>s</var>);
41     
42     int _system_r(void *<var>reent</var>, char *<var>s</var>);
43     
44</pre>
45   <p><strong>Description</strong><br>
46
47   <p>Use <code>system</code> to pass a command string <code>*</code><var>s</var> to <code>/bin/sh</code> on
48your system, and wait for it to finish executing.
49
50   <p>Use &ldquo;<code>system(NULL)</code>&rdquo; to test whether your system has <code>/bin/sh</code>
51available.
52
53   <p>The alternate function <code>_system_r</code> is a reentrant version.  The
54extra argument <var>reent</var> is a pointer to a reentrancy structure.
55
56   <p><br>
57<strong>Returns</strong><br>
58<code>system(NULL)</code> returns a non-zero value if <code>/bin/sh</code> is available, and
59<code>0</code> if it is not.
60
61   <p>With a command argument, the result of <code>system</code> is the exit status
62returned by <code>/bin/sh</code>.
63
64   <p><br>
65<strong>Portability</strong><br>
66ANSI C requires <code>system</code>, but leaves the nature and effects of a
67command processor undefined.  ANSI C does, however, specify that
68<code>system(NULL)</code> return zero or nonzero to report on the existence of
69a command processor.
70
71   <p>POSIX.2 requires <code>system</code>, and requires that it invoke a <code>sh</code>. 
72Where <code>sh</code> is found is left unspecified.
73
74   <p>Supporting OS subroutines required: <code>_exit</code>, <code>_execve</code>, <code>_fork_r</code>,
75<code>_wait_r</code>.
76
77   <p><br>
78
79   </body></html>
80
81