diff options
author | Guido van Rossum <guido@python.org> | 2001-03-02 05:58:11 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-03-02 05:58:11 (GMT) |
commit | 228d80736c39e41a6b46dad211df0ba871b0c8f8 (patch) | |
tree | c15c8ecf8664d6c225b6d2f2821068c31e2302d8 /RISCOS/unixstuff.c | |
parent | c92cdf7aa770ee84a2c8e8f219fde4889e5adc92 (diff) | |
download | cpython-228d80736c39e41a6b46dad211df0ba871b0c8f8.zip cpython-228d80736c39e41a6b46dad211df0ba871b0c8f8.tar.gz cpython-228d80736c39e41a6b46dad211df0ba871b0c8f8.tar.bz2 |
RISCOS files by dschwertberger
Diffstat (limited to 'RISCOS/unixstuff.c')
-rw-r--r-- | RISCOS/unixstuff.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/RISCOS/unixstuff.c b/RISCOS/unixstuff.c new file mode 100644 index 0000000..10648d2 --- /dev/null +++ b/RISCOS/unixstuff.c @@ -0,0 +1,62 @@ +/* Fudge unix isatty and fileno for RISCOS */ + +#include "h.unixstuff" +#include <math.h> +#include "h.osfile" + +int fileno(FILE *f) +{ return (int)f; +} + +int isatty(int fn) +{ return (fn==fileno(stdin)); +} + +bits unixtime(bits ld,bits ex) +{ ld&=0xFF; + ld-=51; + if(ex<1855548004U) ld--; + ex-=1855548004U; + return ex/100+42949672*ld+(95*ld)/100; +} + +int unlink(char *fname) +{ remove(fname); + return 0; +} + + +/*#define RET(k) {printf(" %d\n",k);return k;}*/ +#define RET(k) return k + +int isdir(char *fn) +{ int ob; +/* printf("isdir %s",fn);*/ + if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0); + switch (ob) + { case osfile_IS_DIR:RET(1); + case osfile_IS_IMAGE:RET(1); + } + RET(0); +} + +int isfile(char *fn) +{ int ob; /*printf("isfile %s",fn);*/ + if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0); + switch (ob) + { case osfile_IS_FILE:RET(1); + case osfile_IS_IMAGE:RET(1); + } + RET(0); +} + +int exists(char *fn) +{ int ob; /*printf("exists %s",fn);*/ + if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0); + switch (ob) + { case osfile_IS_FILE:RET(1); + case osfile_IS_DIR:RET(1); + case osfile_IS_IMAGE:RET(1); + } + RET(0); +} |