]> git.sur5r.net Git - cc65/blob - src/cl65/spawn-amiga.inc
Changed multi-line C comments in files that I missed in commit 0390c34e88e9512b81ce35...
[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 /*****************************************************************************/
35 /*                                   Data                                    */
36 /*****************************************************************************/
37
38
39
40 /* Mode argument for spawn. This value is ignored by the function and only
41 ** provided for DOS/Windows compatibility.
42 */
43 #ifndef P_WAIT
44 #define P_WAIT  0
45 #endif
46
47
48
49 /*****************************************************************************/
50 /*                                   Code                                    */
51 /*****************************************************************************/
52
53
54
55 int spawnvp (int Mode attribute ((unused)),
56              const char* File attribute ((unused)),
57              char* const argv [])
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
61 ** on errors.
62 */
63 {
64     int Status;
65     StrBuf Command = AUTO_STRBUF_INITIALIZER;
66
67     /* Build the command line */
68     while (*argv) {
69         SB_AppendStr (&Command, *argv++);
70         SB_AppendChar (&Command, ' ');
71     }
72
73     /* Terminate the command line */
74     SB_Terminate (&Command);
75
76     /* Invoke the shell to execute the command */
77     Status = system (SB_GetConstBuf (&Command));
78
79     /* Free the string buf data */
80     SB_Done (&Command);
81
82     /* Return the result */
83     return Status;
84 }