Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* GNUmakefile (globfiles): Add AmigaDOS support files.
(distfiles): Add $(amigafiles).
(amigafiles): New variable.
Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de>
* Added Amiga support in commands.c, dir.c, function.c,
job.c, main.c, make.h, read.c, remake.c
* commands.c: Amiga has neither SIGHUP nor SIGQUIT
* dir.c: Amiga has filenames with Upper- and Lowercase,
but "FileName" is the same as "filename". Added strieq()
which is use to compare filenames. This is like streq()
on all other systems. Also there is no such thing as
"." under AmigaDOS.
* function.c: On Amiga, the environment is not passed as envp,
there are no pipes and Amiga can't fork. Use my own function
to create a new child.
* job.c: default_shell is "" (The system automatically chooses
a shell for me). Have to use the same workaround as MSDOS for
running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't
known on Amiga. Cloned code to run children from MSDOS. Own
version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga.
* main.c: Force stack to 20000 bytes. Read environment from ENV:
device. On Amiga, exec_command() does return, so I exit()
afterwards.
* make.h: Added strieq() to compare filenames.
* read.c: Amiga needs special extension to have passwd. Only
one include-dir. "Makefile" and "makefile" are the same.
Added "SMakefile". Added special code to handle device names (xxx:)
and "./" in rules.
* remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib"
instead of "lib%s.a".
* main.c, rule.c, variable.c: Avoid floats at all costs.
* vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
|
|
|
/* Running commands on Amiga
|
1996-05-13 18:38:15 +00:00
|
|
|
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* GNUmakefile (globfiles): Add AmigaDOS support files.
(distfiles): Add $(amigafiles).
(amigafiles): New variable.
Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de>
* Added Amiga support in commands.c, dir.c, function.c,
job.c, main.c, make.h, read.c, remake.c
* commands.c: Amiga has neither SIGHUP nor SIGQUIT
* dir.c: Amiga has filenames with Upper- and Lowercase,
but "FileName" is the same as "filename". Added strieq()
which is use to compare filenames. This is like streq()
on all other systems. Also there is no such thing as
"." under AmigaDOS.
* function.c: On Amiga, the environment is not passed as envp,
there are no pipes and Amiga can't fork. Use my own function
to create a new child.
* job.c: default_shell is "" (The system automatically chooses
a shell for me). Have to use the same workaround as MSDOS for
running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't
known on Amiga. Cloned code to run children from MSDOS. Own
version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga.
* main.c: Force stack to 20000 bytes. Read environment from ENV:
device. On Amiga, exec_command() does return, so I exit()
afterwards.
* make.h: Added strieq() to compare filenames.
* read.c: Amiga needs special extension to have passwd. Only
one include-dir. "Makefile" and "makefile" are the same.
Added "SMakefile". Added special code to handle device names (xxx:)
and "./" in rules.
* remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib"
instead of "lib%s.a".
* main.c, rule.c, variable.c: Avoid floats at all costs.
* vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
|
|
|
This file is part of GNU Make.
|
|
|
|
|
|
|
|
GNU Make is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
GNU Make is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU Make; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
|
|
|
|
#include "make.h"
|
1996-05-13 18:38:15 +00:00
|
|
|
#include "variable.h"
|
|
|
|
#include "amiga.h"
|
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* GNUmakefile (globfiles): Add AmigaDOS support files.
(distfiles): Add $(amigafiles).
(amigafiles): New variable.
Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de>
* Added Amiga support in commands.c, dir.c, function.c,
job.c, main.c, make.h, read.c, remake.c
* commands.c: Amiga has neither SIGHUP nor SIGQUIT
* dir.c: Amiga has filenames with Upper- and Lowercase,
but "FileName" is the same as "filename". Added strieq()
which is use to compare filenames. This is like streq()
on all other systems. Also there is no such thing as
"." under AmigaDOS.
* function.c: On Amiga, the environment is not passed as envp,
there are no pipes and Amiga can't fork. Use my own function
to create a new child.
* job.c: default_shell is "" (The system automatically chooses
a shell for me). Have to use the same workaround as MSDOS for
running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't
known on Amiga. Cloned code to run children from MSDOS. Own
version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga.
* main.c: Force stack to 20000 bytes. Read environment from ENV:
device. On Amiga, exec_command() does return, so I exit()
afterwards.
* make.h: Added strieq() to compare filenames.
* read.c: Amiga needs special extension to have passwd. Only
one include-dir. "Makefile" and "makefile" are the same.
Added "SMakefile". Added special code to handle device names (xxx:)
and "./" in rules.
* remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib"
instead of "lib%s.a".
* main.c, rule.c, variable.c: Avoid floats at all costs.
* vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
|
|
|
#include <assert.h>
|
|
|
|
#include <exec/memory.h>
|
|
|
|
#include <dos/dostags.h>
|
|
|
|
#include <proto/exec.h>
|
|
|
|
#include <proto/dos.h>
|
|
|
|
|
1996-05-13 18:38:15 +00:00
|
|
|
static const char Amiga_version[] = "$VER: Make 3.74.3 (12.05.96) \n"
|
|
|
|
"Amiga Port by A. Digulla (digulla@home.lake.de)";
|
|
|
|
|
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* GNUmakefile (globfiles): Add AmigaDOS support files.
(distfiles): Add $(amigafiles).
(amigafiles): New variable.
Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de>
* Added Amiga support in commands.c, dir.c, function.c,
job.c, main.c, make.h, read.c, remake.c
* commands.c: Amiga has neither SIGHUP nor SIGQUIT
* dir.c: Amiga has filenames with Upper- and Lowercase,
but "FileName" is the same as "filename". Added strieq()
which is use to compare filenames. This is like streq()
on all other systems. Also there is no such thing as
"." under AmigaDOS.
* function.c: On Amiga, the environment is not passed as envp,
there are no pipes and Amiga can't fork. Use my own function
to create a new child.
* job.c: default_shell is "" (The system automatically chooses
a shell for me). Have to use the same workaround as MSDOS for
running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't
known on Amiga. Cloned code to run children from MSDOS. Own
version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga.
* main.c: Force stack to 20000 bytes. Read environment from ENV:
device. On Amiga, exec_command() does return, so I exit()
afterwards.
* make.h: Added strieq() to compare filenames.
* read.c: Amiga needs special extension to have passwd. Only
one include-dir. "Makefile" and "makefile" are the same.
Added "SMakefile". Added special code to handle device names (xxx:)
and "./" in rules.
* remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib"
instead of "lib%s.a".
* main.c, rule.c, variable.c: Avoid floats at all costs.
* vpath.c: Get rid of as many alloca()s as possible.
1996-05-09 18:02:06 +00:00
|
|
|
int
|
|
|
|
MyExecute (argv)
|
|
|
|
char ** argv;
|
|
|
|
{
|
|
|
|
char * buffer, * ptr;
|
|
|
|
char ** aptr;
|
|
|
|
int len = 0;
|
|
|
|
int status;
|
|
|
|
|
|
|
|
for (aptr=argv; *aptr; aptr++)
|
|
|
|
{
|
|
|
|
len += strlen (*aptr) + 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = AllocMem (len, MEMF_ANY);
|
|
|
|
|
|
|
|
if (!buffer)
|
|
|
|
fatal ("MyExecute: Cannot allocate space for calling a command");
|
|
|
|
|
|
|
|
ptr = buffer;
|
|
|
|
|
|
|
|
for (aptr=argv; *aptr; aptr++)
|
|
|
|
{
|
|
|
|
if (((*aptr)[0] == ';' && !(*aptr)[1]))
|
|
|
|
{
|
|
|
|
*ptr ++ = '"';
|
|
|
|
strcpy (ptr, *aptr);
|
|
|
|
ptr += strlen (ptr);
|
|
|
|
*ptr ++ = '"';
|
|
|
|
}
|
|
|
|
else if ((*aptr)[0] == '@' && (*aptr)[1] == '@' && !(*aptr)[2])
|
|
|
|
{
|
|
|
|
*ptr ++ = '\n';
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy (ptr, *aptr);
|
|
|
|
ptr += strlen (ptr);
|
|
|
|
}
|
|
|
|
*ptr ++ = ' ';
|
|
|
|
*ptr = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr[-1] = '\n';
|
|
|
|
|
|
|
|
status = SystemTags (buffer,
|
|
|
|
SYS_UserShell, TRUE,
|
|
|
|
TAG_END);
|
|
|
|
|
|
|
|
FreeMem (buffer, len);
|
|
|
|
|
|
|
|
if (SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
|
|
|
|
status = 20;
|
|
|
|
|
|
|
|
/* Warnings don't count */
|
|
|
|
if (status == 5)
|
|
|
|
status = 0;
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
1996-05-13 18:38:15 +00:00
|
|
|
|
|
|
|
char *
|
|
|
|
wildcard_expansion (wc, o)
|
|
|
|
char * wc, * o;
|
|
|
|
{
|
|
|
|
# define PATH_SIZE 1024
|
|
|
|
struct AnchorPath * apath;
|
|
|
|
|
|
|
|
if ( (apath = AllocMem (sizeof (struct AnchorPath) + PATH_SIZE,
|
|
|
|
MEMF_CLEAR))
|
|
|
|
)
|
|
|
|
{
|
|
|
|
apath->ap_Strlen = PATH_SIZE;
|
|
|
|
|
|
|
|
if (MatchFirst (wc, apath) == 0)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
o = variable_buffer_output (o, apath->ap_Buf,
|
|
|
|
strlen (apath->ap_Buf));
|
|
|
|
o = variable_buffer_output (o, " ",1);
|
|
|
|
} while (MatchNext (apath) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
MatchEnd (apath);
|
|
|
|
FreeMem (apath, sizeof (struct AnchorPath) + PATH_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|