diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-01-13 16:50:17 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-01-13 16:50:17 +0000 |
commit | 61ae2fbf8676dafa05a9a9a710fde421f30a2071 (patch) | |
tree | 4f497a4eee07a49f48be8badf49ad54f068f11f8 /mint | |
parent | b8f0c030659550e4d527ee8f11cd2f012f1bd1b0 (diff) | |
download | perl-61ae2fbf8676dafa05a9a9a710fde421f30a2071.tar.gz |
Atari MiNT port by Guido Flohr <gufl0000@stud.uni-sb.de>
(the diffs were based on 5.004_02). Tested by Guido
and Frank Naumann <fnaumann@prinz-atm.CS.Uni-Magdeburg.De>.
p4raw-id: //depot/cfgperl@2594
Diffstat (limited to 'mint')
-rw-r--r-- | mint/Makefile | 15 | ||||
-rw-r--r-- | mint/README | 14 | ||||
-rw-r--r-- | mint/errno.h | 32 | ||||
-rw-r--r-- | mint/pwd.c | 43 | ||||
-rw-r--r-- | mint/stdio.h | 21 | ||||
-rw-r--r-- | mint/sys/time.h | 2 | ||||
-rw-r--r-- | mint/time.h | 22 |
7 files changed, 149 insertions, 0 deletions
diff --git a/mint/Makefile b/mint/Makefile new file mode 100644 index 0000000000..1608b15359 --- /dev/null +++ b/mint/Makefile @@ -0,0 +1,15 @@ +# IMPORTANT: This Makefile is not intended to build Perl itself but +# only to replace a broken pwd command! + +all: pwd + +pwd: pwd.c + $(CC) -O3 -o pwd pwd.c + +install: pwd + (new_pwd=`which pwd` && cp -f $$new_pwd $$new_pwd.broken \ + && cp -f pwd $$new_pwd) + +clean: + rm -f pwd.o pwd + diff --git a/mint/README b/mint/README new file mode 100644 index 0000000000..85e8a75291 --- /dev/null +++ b/mint/README @@ -0,0 +1,14 @@ +This subdirectory contains some additional files which are necessary +(or at least useful) when compiling Perl on MiNT. + +"Makefile" and "pwd.c" will build and install a fixed version of the +pwd command if your system pwd is broken. + +The header files are wrappers around broken system header files. Make +sure that this directory stands at first place in your include path +when compiling Perl. + +The file system.c is an enhanced version of the system() function +in the MiNTLib. It is strongly recommended that you insert this +version into your libc before you compile Perl (see README.MiNT +in the toplevel directory for details). diff --git a/mint/errno.h b/mint/errno.h new file mode 100644 index 0000000000..5c19d0efa7 --- /dev/null +++ b/mint/errno.h @@ -0,0 +1,32 @@ +/* Wrapper around broken system errno.h. */ + +#ifndef _PERL_WRAPPER_AROUND_ERRNO_H +# define _PERL_WRAPPER_AROUND_ERRNO_H 1 + +/* First include the system file. */ +#include_next <errno.h> + +/* Now add the missing stuff. +#ifndef EAGAIN +# define EAGAIN EWOULDBLOCK +#endif + +/* This one is problematic. If you open() a directory with the + MiNTLib you can't detect from errno if it is really a directory + or if the file simply doesn't exist. You'll get ENOENT + ("file not found") in either case. + + Defining EISDIR as ENOENT is actually a bad idea but works fine + in general. In praxi, if code checks for errno == EISDIR it + will attempt an opendir() call on the file in question and this + call will also file if the file really can't be found. But + you may get compile-time errors if the errno checking is embedded + in a switch statement ("duplicate case value in switch"). + + Anyway, here the define works alright. */ +#ifndef EISDIR +# define EISDIR ENOENT +#endif + +#endif + diff --git a/mint/pwd.c b/mint/pwd.c new file mode 100644 index 0000000000..c2711996de --- /dev/null +++ b/mint/pwd.c @@ -0,0 +1,43 @@ +/* pwd.c - replacement for broken pwd command. + * Copyright 1997 Guido Flohr, <gufl0000@stud.uni-sb.de>. + * Do with it as you please. + */ +#include <stdio.h> +#include <limits.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#if defined(__STDC__) || defined(__cplusplus) +int main (int argc, char* argv[]) +#else +int main (argc, argv) + int argc; + char* argv[]; +#endif +{ + char path_buf[PATH_MAX + 1]; + + if (argc > 1) { + int i; + + fflush (stdout); + fputs (argv[0], stderr); + fputs (": ignoring garbage arguments\n", stderr); + } + + if (!getcwd (path_buf, PATH_MAX + 1)) { + fflush (stdout); + /* Save space, memory and the whales, avoid fprintf. */ + fputs (argv[0], stderr); + fputs (": can\'t get current working directory: ", stderr); + fputs (strerror (errno), stderr); + fputc ('\n', stderr); + return 1; + } + if (puts (path_buf) < 0) { + return 1; + } + return 0; +} +/* End of pwd.c. */ diff --git a/mint/stdio.h b/mint/stdio.h new file mode 100644 index 0000000000..7b2d65d8a8 --- /dev/null +++ b/mint/stdio.h @@ -0,0 +1,21 @@ +/* Wrapper around broken system stdio.h. */ + +#ifndef _PERL_WRAPPER_AROUND_STDIO_H +# define _PERL_WRAPPER_AROUND_STDIO_H 1 + +/* The MiNTLib has a macro called EOS in stdio.h. This conflicts + with regnode.h. Who had this glorious idea. */ +#ifdef EOS +# define PERL_EOS EOS +#endif + +/* First include the system file. */ +#include_next <stdio.h> + +#ifdef EOS +# undef EOS +# define EOS PERL_EOS +#endif + +#endif + diff --git a/mint/sys/time.h b/mint/sys/time.h new file mode 100644 index 0000000000..38806cc9c1 --- /dev/null +++ b/mint/sys/time.h @@ -0,0 +1,2 @@ +#include <time.h> + diff --git a/mint/time.h b/mint/time.h new file mode 100644 index 0000000000..d6b031db31 --- /dev/null +++ b/mint/time.h @@ -0,0 +1,22 @@ +/* Wrapper around broken system time.h. */ + +#ifndef _PERL_WRAPPER_AROUND_TIME_H +# define _PERL_WRAPPER_AROUND_TIME_H 1 + +/* Recent versions of the MiNTLib have a macro HAS_TZNAME in + time.h resp. sys/time.h. Wow, I wonder why they didn't + define HAVE_CONFIG_H ... */ +#ifdef HAS_TZNAME +# define PERL_HAS_TZNAME HAS_TZNAME +#endif + +/* First include the system file. */ +#include_next <time.h> + +#ifdef HAS_TZNAME +# undef HAS_TZNAME +# define HAS_TZNAME PERL_HAS_TZNAME +#endif + +#endif + |