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 /*****************************************************************************/
35 #include <clib/dos_protos.h>
39 /*****************************************************************************/
41 /*****************************************************************************/
45 int spawnvp (int Mode attribute ((unused)),
46 const char* File attribute ((unused)),
48 /* Execute the given program searching and wait til it terminates. The Mode
49 * argument is ignored (compatibility only). The result of the function is
50 * the return code of the program. The function will terminate the program
55 StrBuf Command = AUTO_STRBUF_INITIALIZER;
57 /* Build the command line */
59 SB_AppendStr (&Command, *argv++);
60 SB_AppendChar (&Command, ' ');
63 /* Terminate the command line */
64 SB_Terminate (&Command);
66 /* Invoke the shell to execute the command */
67 Status = System (SB_GetConstBuf (&Command), TAG_END)
69 /* Free the string buf data */
70 DoneStrBuf (&Command);
72 /* Return the result */