Jack Jansen | 34e7cae | 1994-12-14 14:04:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | ** Glue code for MetroWerks CodeWarrior, which misses |
| 3 | ** unix-like routines for file-access. |
| 4 | */ |
| 5 | |
| 6 | #ifdef __MWERKS__ |
| 7 | #include <Types.h> |
| 8 | #include <Files.h> |
| 9 | #include <Strings.h> |
| 10 | |
| 11 | #include <stdio.h> |
| 12 | #include <errno.h> |
| 13 | |
| 14 | int |
| 15 | fileno(fp) |
| 16 | FILE *fp; |
| 17 | { |
| 18 | if (fp==stdin) return 0; |
| 19 | else if (fp==stdout) return 1; |
| 20 | else if (fp==stderr) return 2; |
| 21 | else return 3; |
| 22 | } |
| 23 | |
| 24 | int |
| 25 | isatty(fd) |
| 26 | int fd; |
| 27 | { |
| 28 | return (fd >= 0 && fd <= 2); |
| 29 | } |
| 30 | |
| 31 | int |
| 32 | unlink(old) |
| 33 | char *old; |
| 34 | { |
| 35 | OSErr err; |
| 36 | |
| 37 | if ((err=FSDelete(c2pstr(old), 0)) == noErr) |
| 38 | return 0; |
| 39 | errno= err; |
| 40 | return -1; |
| 41 | } |
| 42 | |
| 43 | #endif /* __MWERKS__ */ |