Fix three PyChecker-detected gotchas.
[python/dscho.git] / RISCOS / unixstuff.c
blob10648d264fd234c33b4eda5baf6a17bffbdd3570
1 /* Fudge unix isatty and fileno for RISCOS */
3 #include "h.unixstuff"
4 #include <math.h>
5 #include "h.osfile"
7 int fileno(FILE *f)
8 { return (int)f;
11 int isatty(int fn)
12 { return (fn==fileno(stdin));
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;
23 int unlink(char *fname)
24 { remove(fname);
25 return 0;
29 /*#define RET(k) {printf(" %d\n",k);return k;}*/
30 #define RET(k) return k
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);
40 RET(0);
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);
50 RET(0);
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);
61 RET(0);