]> git.sur5r.net Git - cc65/blob - src/cl65/spawn-amiga.inc
The check for illegal storage classes on globals was wrong
[cc65] / src / cl65 / spawn-amiga.inc
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                spawn-amiga.inc                            */
4 /*                                                                           */
5 /*                Execute other external programs (Amiga version)            */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2002     Wolfgang Hosemann                                            */
10 /* EMail:       whose@t-online.de                                            */
11 /*                                                                           */
12 /*                                                                           */
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.                                    */
16 /*                                                                           */
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:                            */
20 /*                                                                           */
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              */
28 /*    distribution.                                                          */
29 /*                                                                           */
30 /*****************************************************************************/
31
32
33
34 #include <stdio.h>
35 #include <clib/dos_protos.h>
36
37
38
39 /*****************************************************************************/
40 /*                                   Code                                    */
41 /*****************************************************************************/
42
43
44
45 int spawnvp (int Mode attribute ((unused)),
46              const char* File attribute ((unused)),
47              char* const argv [])
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
51  * on errors.
52  */
53 {
54     int Status;
55     StrBuf Command = AUTO_STRBUF_INITIALIZER;
56
57     /* Build the command line */
58     while (*argv) {
59         SB_AppendStr (&Command, *argv++);
60         SB_AppendChar (&Command, ' ');
61     }
62
63     /* Terminate the command line */
64     SB_Terminate (&Command);
65
66     /* Invoke the shell to execute the command */
67     Status = System (SB_GetConstBuf (&Command), TAG_END)
68
69     /* Free the string buf data */
70     DoneStrBuf (&Command);
71
72     /* Return the result */
73     return Status;
74 }
75
76
77