source: trunk/third/gmake/amiga.c @ 14111

Revision 14111, 2.6 KB checked in by danw, 25 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14110, which included commits to RCS files with non-trunk default branches.
Line 
1/* Running commands on Amiga
2Copyright (C) 1995, 1996 Free Software Foundation, Inc.
3This file is part of GNU Make.
4
5GNU Make is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 2, or (at your option)
8any later version.
9
10GNU Make is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with GNU Make; see the file COPYING.  If not, write to
17the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18MA 02111-1307, USA.  */
19
20#include "make.h"
21#include "variable.h"
22#include "amiga.h"
23#include <assert.h>
24#include <exec/memory.h>
25#include <dos/dostags.h>
26#include <proto/exec.h>
27#include <proto/dos.h>
28
29static const char Amiga_version[] = "$VER: Make 3.74.3 (12.05.96) \n"
30                    "Amiga Port by A. Digulla (digulla@home.lake.de)";
31
32int
33MyExecute (argv)
34char ** argv;
35{
36    char * buffer, * ptr;
37    char ** aptr;
38    int len = 0;
39    int status;
40
41    for (aptr=argv; *aptr; aptr++)
42    {
43        len += strlen (*aptr) + 4;
44    }
45
46    buffer = AllocMem (len, MEMF_ANY);
47
48    if (!buffer)
49      fatal (NILF, "MyExecute: Cannot allocate space for calling a command");
50
51    ptr = buffer;
52
53    for (aptr=argv; *aptr; aptr++)
54    {
55        if (((*aptr)[0] == ';' && !(*aptr)[1]))
56        {
57            *ptr ++ = '"';
58            strcpy (ptr, *aptr);
59            ptr += strlen (ptr);
60            *ptr ++ = '"';
61        }
62        else if ((*aptr)[0] == '@' && (*aptr)[1] == '@' && !(*aptr)[2])
63        {
64            *ptr ++ = '\n';
65            continue;
66        }
67        else
68        {
69            strcpy (ptr, *aptr);
70            ptr += strlen (ptr);
71        }
72        *ptr ++ = ' ';
73        *ptr = 0;
74    }
75
76    ptr[-1] = '\n';
77
78    status = SystemTags (buffer,
79        SYS_UserShell, TRUE,
80        TAG_END);
81
82    FreeMem (buffer, len);
83
84    if (SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
85        status = 20;
86
87    /* Warnings don't count */
88    if (status == 5)
89        status = 0;
90
91    return status;
92}
93
94char *
95wildcard_expansion (wc, o)
96char * wc, * o;
97{
98#   define PATH_SIZE    1024
99    struct AnchorPath * apath;
100
101    if ( (apath = AllocMem (sizeof (struct AnchorPath) + PATH_SIZE,
102            MEMF_CLEAR))
103        )
104    {
105        apath->ap_Strlen = PATH_SIZE;
106
107        if (MatchFirst (wc, apath) == 0)
108        {
109            do
110            {
111                o = variable_buffer_output (o, apath->ap_Buf,
112                        strlen (apath->ap_Buf));
113                o = variable_buffer_output (o, " ",1);
114            } while (MatchNext (apath) == 0);
115        }
116
117        MatchEnd (apath);
118        FreeMem (apath, sizeof (struct AnchorPath) + PATH_SIZE);
119    }
120
121    return o;
122}
123
Note: See TracBrowser for help on using the repository browser.