Guido van Rossum | 228d807 | 2001-03-02 05:58:11 +0000 | [diff] [blame^] | 1 | /* Fudge unix isatty and fileno for RISCOS */ |
| 2 | |
| 3 | #include "h.unixstuff" |
| 4 | #include <math.h> |
| 5 | #include "h.osfile" |
| 6 | |
| 7 | int fileno(FILE *f) |
| 8 | { return (int)f; |
| 9 | } |
| 10 | |
| 11 | int isatty(int fn) |
| 12 | { return (fn==fileno(stdin)); |
| 13 | } |
| 14 | |
| 15 | bits unixtime(bits ld,bits ex) |
| 16 | { ld&=0xFF; |
| 17 | ld-=51; |
| 18 | if(ex<1855548004U) ld--; |
| 19 | ex-=1855548004U; |
| 20 | return ex/100+42949672*ld+(95*ld)/100; |
| 21 | } |
| 22 | |
| 23 | int unlink(char *fname) |
| 24 | { remove(fname); |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | |
| 29 | /*#define RET(k) {printf(" %d\n",k);return k;}*/ |
| 30 | #define RET(k) return k |
| 31 | |
| 32 | int isdir(char *fn) |
| 33 | { int ob; |
| 34 | /* printf("isdir %s",fn);*/ |
| 35 | if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0); |
| 36 | switch (ob) |
| 37 | { case osfile_IS_DIR:RET(1); |
| 38 | case osfile_IS_IMAGE:RET(1); |
| 39 | } |
| 40 | RET(0); |
| 41 | } |
| 42 | |
| 43 | int isfile(char *fn) |
| 44 | { int ob; /*printf("isfile %s",fn);*/ |
| 45 | if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0); |
| 46 | switch (ob) |
| 47 | { case osfile_IS_FILE:RET(1); |
| 48 | case osfile_IS_IMAGE:RET(1); |
| 49 | } |
| 50 | RET(0); |
| 51 | } |
| 52 | |
| 53 | int exists(char *fn) |
| 54 | { int ob; /*printf("exists %s",fn);*/ |
| 55 | if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0); |
| 56 | switch (ob) |
| 57 | { case osfile_IS_FILE:RET(1); |
| 58 | case osfile_IS_DIR:RET(1); |
| 59 | case osfile_IS_IMAGE:RET(1); |
| 60 | } |
| 61 | RET(0); |
| 62 | } |