diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1994-12-14 14:04:55 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1994-12-14 14:04:55 (GMT) |
commit | 34e7cae6634d89fbf160e1e8249c56012914bfe6 (patch) | |
tree | 080380879ced3cc09845594009a8d6f92d84d82b /Mac/mwerksglue.c | |
parent | 97ce361c2cf6bf57dc74b36ffd0d04c846101cc0 (diff) | |
download | cpython-34e7cae6634d89fbf160e1e8249c56012914bfe6.zip cpython-34e7cae6634d89fbf160e1e8249c56012914bfe6.tar.gz cpython-34e7cae6634d89fbf160e1e8249c56012914bfe6.tar.bz2 |
Unix functionality expected by python but missing from CodeWarrior
runtime system.
Diffstat (limited to 'Mac/mwerksglue.c')
-rw-r--r-- | Mac/mwerksglue.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Mac/mwerksglue.c b/Mac/mwerksglue.c new file mode 100644 index 0000000..37e3a81 --- /dev/null +++ b/Mac/mwerksglue.c @@ -0,0 +1,43 @@ +/* +** Glue code for MetroWerks CodeWarrior, which misses +** unix-like routines for file-access. +*/ + +#ifdef __MWERKS__ +#include <Types.h> +#include <Files.h> +#include <Strings.h> + +#include <stdio.h> +#include <errno.h> + +int +fileno(fp) + FILE *fp; +{ + if (fp==stdin) return 0; + else if (fp==stdout) return 1; + else if (fp==stderr) return 2; + else return 3; +} + +int +isatty(fd) + int fd; +{ + return (fd >= 0 && fd <= 2); +} + +int +unlink(old) + char *old; +{ + OSErr err; + + if ((err=FSDelete(c2pstr(old), 0)) == noErr) + return 0; + errno= err; + return -1; +} + +#endif /* __MWERKS__ */
\ No newline at end of file |