| 1 | |
| 2 | <refentry id="system"> |
| 3 | <indexterm id="Indexsystem_i"><primary>system_i</primary></indexterm> |
| 4 | |
| 5 | <indexterm id="Indexsystem"><primary>system</primary></indexterm> |
| 6 | <refentryinfo><title>Miscellaneous</title></refentryinfo> |
| 7 | <refmeta> |
| 8 | <refentrytitle>system</refentrytitle> |
| 9 | </refmeta> |
| 10 | |
| 11 | |
| 12 | |
| 13 | <refnamediv> |
| 14 | <refname>system</refname> |
| 15 | <refpurpose> |
| 16 | Call an external program via the system call |
| 17 | </refpurpose> |
| 18 | </refnamediv> |
| 19 | |
| 20 | <refsect1> |
| 21 | <title>Description</title> |
| 22 | <para>Plugin opcode in system_call.</para> |
| 23 | <para> |
| 24 | <command>system</command> and <command>system_i</command> call |
| 25 | any external command understood by the operating system, similarly |
| 26 | to the C function system(). <command>system_i</command> runs |
| 27 | at i-time only, while |
| 28 | <command>system</command> runs both at initialization and |
| 29 | performance time. |
| 30 | </para> |
| 31 | </refsect1> |
| 32 | |
| 33 | <refsect1> |
| 34 | <title>Syntax</title> |
| 35 | <synopsis>ires <command>system_i</command> itrig, Scmd, [inowait]</synopsis> |
| 36 | <synopsis>kres <command>system</command> ktrig, Scmd, [knowait]</synopsis> |
| 37 | </refsect1> |
| 38 | |
| 39 | <refsect1> |
| 40 | <title>Initialization</title> |
| 41 | <para> |
| 42 | <emphasis>Scmd</emphasis> -- command string |
| 43 | </para> |
| 44 | <para> |
| 45 | <emphasis>itrig</emphasis> -- if greater than zero the opcode |
| 46 | executes the command; otherwise it is an null operation. |
| 47 | </para> |
| 48 | |
| 49 | </refsect1> |
| 50 | |
| 51 | <refsect1> |
| 52 | <title>Performance</title> |
| 53 | <para> |
| 54 | <emphasis>ktrig</emphasis> -- if greater than zero and different |
| 55 | from the value on the previous control cycle the opcode |
| 56 | executes the command. Initially this previous value is |
| 57 | taken as zero. |
| 58 | </para> |
| 59 | <para> |
| 60 | <emphasis>inowait,knowait</emphasis> -- if given an non zero the |
| 61 | command is run in the background and the command does not wait |
| 62 | for the result. (default = 0) |
| 63 | </para> |
| 64 | <para> |
| 65 | <emphasis>ires, kres</emphasis> -- the return code of the |
| 66 | command in wait mode and if the command is run.In other cases |
| 67 | returns zero. |
| 68 | </para> |
| 69 | <para> |
| 70 | More than one system command (a script) can be executed with a single <command>system</command> opcode by using double braces strings {{ }}. |
| 71 | </para> |
| 72 | <note> |
| 73 | This opcode is very system dependant, so should be used with extreme care (or not used) if platform neutrality is desired. |
| 74 | </note> |
| 75 | </refsect1> |
| 76 | |
| 77 | <refsect1> |
| 78 | <title>Example</title> |
| 79 | <para> |
| 80 | Here is an example of the system_i opcode. It uses the file <ulink url="examples/system.csd"><citetitle>system.csd</citetitle></ulink>. |
| 81 | |
| 82 | <example> |
| 83 | <title>Example of the system opcode.</title> |
| 84 | |
| 85 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 86 | <xi:include href="examples-xml/system.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 87 | </example> |
| 88 | </para> |
| 89 | </refsect1> |
| 90 | |
| 91 | <refsect1> |
| 92 | <title>See also</title> |
| 93 | <para><link linkend="MiscopcodesTop"><citetitle>Miscellaneous opcodes</citetitle></link></para> |
| 94 | </refsect1> |
| 95 | |
| 96 | <refsect1> |
| 97 | <title>Credits</title> |
| 98 | <para> |
| 99 | <simplelist> |
| 100 | <member>Author: &namejohn;</member> |
| 101 | <member>2007</member> |
| 102 | </simplelist> |
| 103 | <para>New in version 5.06</para> |
| 104 | </para> |
| 105 | </refsect1> |
| 106 | </refentry> |