1 /*****************************************************************************/
5 /* Execute other external programs (Amiga version) */
9 /* (C) 2002 Wolfgang Hosemann */
10 /* EMail: whose@t-online.de */
13 /* This software is provided 'as-is', without any expressed or implied */
14 /* warranty. In no event will the authors be held liable for any damages */
15 /* arising from the use of this software. */
17 /* Permission is granted to anyone to use this software for any purpose, */
18 /* including commercial applications, and to alter it and redistribute it */
19 /* freely, subject to the following restrictions: */
21 /* 1. The origin of this software must not be misrepresented; you must not */
22 /* claim that you wrote the original software. If you use this software */
23 /* in a product, an acknowledgment in the product documentation would be */
24 /* appreciated but is not required. */
25 /* 2. Altered source versions must be plainly marked as such, and must not */
26 /* be misrepresented as being the original software. */
27 /* 3. This notice may not be removed or altered from any source */
30 /*****************************************************************************/
34 /*****************************************************************************/
36 /*****************************************************************************/
40 /* Mode argument for spawn. This value is ignored by the function and only
41 * provided for DOS/Windows compatibility.
49 /*****************************************************************************/
51 /*****************************************************************************/
55 int spawnvp (int Mode attribute ((unused)),
56 const char* File attribute ((unused)),
58 /* Execute the given program searching and wait til it terminates. The Mode
59 * argument is ignored (compatibility only). The result of the function is
60 * the return code of the program. The function will terminate the program
65 StrBuf Command = AUTO_STRBUF_INITIALIZER;
67 /* Build the command line */
69 SB_AppendStr (&Command, *argv++);
70 SB_AppendChar (&Command, ' ');
73 /* Terminate the command line */
74 SB_Terminate (&Command);
76 /* Invoke the shell to execute the command */
77 Status = system (SB_GetConstBuf (&Command));
79 /* Free the string buf data */
80 DoneStrBuf (&Command);
82 /* Return the result */