mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
Unix functionality expected by python but missing from CodeWarrior
runtime system.
This commit is contained in:
parent
97ce361c2c
commit
34e7cae663
2 changed files with 61 additions and 0 deletions
18
Mac/errno_unix.h
Normal file
18
Mac/errno_unix.h
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
#define ENOTDIR (-120)
|
||||||
|
#define EACCES (-54)
|
||||||
|
#define EEXIST (-48)
|
||||||
|
#define EBUSY (-47)
|
||||||
|
#define EROFS (-44)
|
||||||
|
#define ENOENT (-43)
|
||||||
|
#define ENFILE (-42)
|
||||||
|
#define EIO (-36)
|
||||||
|
#define ENOSPC (-34)
|
||||||
|
|
||||||
|
#define ESRCH 3
|
||||||
|
#define EINTR 4
|
||||||
|
#define EBADF 9
|
||||||
|
#define ENODEV 19
|
||||||
|
#define EINVAL 22
|
||||||
|
#define EMFILE 24
|
||||||
|
|
43
Mac/mwerksglue.c
Normal file
43
Mac/mwerksglue.c
Normal file
|
@ -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__ */
|
Loading…
Add table
Add a link
Reference in a new issue