riscos.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 2000-Apr-09 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, all these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
  7. */
  8. /* riscos.h */
  9. #ifndef __riscos_h
  10. #define __riscos_h
  11. #include <time.h>
  12. #include <stdio.h>
  13. typedef struct {
  14. int errnum;
  15. char errmess[252];
  16. } os_error;
  17. #ifndef __swiven_h
  18. # include "swiven.h"
  19. #endif
  20. #define MAXPATHLEN 256
  21. #define MAXFILENAMELEN 64 /* should be 11 for ADFS, 13 for DOS, 64 seems a sensible value... */
  22. #define DIR_BUFSIZE 1024 /* this should be enough to read a whole E-Format directory */
  23. struct stat {
  24. unsigned int st_dev;
  25. int st_ino;
  26. unsigned int st_mode;
  27. int st_nlink;
  28. unsigned short st_uid;
  29. unsigned short st_gid;
  30. unsigned int st_rdev;
  31. unsigned int st_size;
  32. unsigned int st_blksize;
  33. time_t st_atime;
  34. time_t st_mtime;
  35. time_t st_ctime;
  36. };
  37. typedef struct {
  38. char *dirname;
  39. void *buf;
  40. int size;
  41. char *act;
  42. int offset;
  43. int read;
  44. } DIR;
  45. #define dstrm DIR
  46. struct dirent {
  47. unsigned int d_off; /* offset of next disk directory entry */
  48. int d_fileno; /* file number of entry */
  49. size_t d_reclen; /* length of this record */
  50. size_t d_namlen; /* length of d_name */
  51. char d_name[MAXFILENAMELEN]; /* name */
  52. };
  53. typedef struct {
  54. unsigned int load_addr;
  55. unsigned int exec_addr;
  56. int lenght;
  57. int attrib;
  58. int objtype;
  59. char name[13];
  60. } riscos_direntry;
  61. #define SPARKID 0x4341 /* = "AC" */
  62. #define SPARKID_2 0x30435241 /* = "ARC0" */
  63. typedef struct {
  64. short ID;
  65. short size;
  66. int ID_2;
  67. unsigned int loadaddr;
  68. unsigned int execaddr;
  69. int attr;
  70. int zero;
  71. } extra_block;
  72. #define S_IFMT 0770000
  73. #define S_IFDIR 0040000
  74. #define S_IFREG 0100000 /* 0200000 in UnixLib !?!?!?!? */
  75. #ifndef S_IEXEC
  76. # define S_IEXEC 0000100
  77. # define S_IWRITE 0000200
  78. # define S_IREAD 0000400
  79. #endif
  80. extern char *exts2swap; /* Extensions to swap */
  81. int stat(char *filename,struct stat *res);
  82. DIR *opendir(char *dirname);
  83. struct dirent *readdir(DIR *d);
  84. char *readd(DIR *d);
  85. void closedir(DIR *d);
  86. int unlink(char *f);
  87. int chmod(char *file, int mode);
  88. void setfiletype(char *fname,int ftype);
  89. void getRISCOSexts(char *envstr);
  90. int checkext(char *suff);
  91. int swapext(char *name, char *exptr);
  92. void remove_prefix(void);
  93. void set_prefix(void);
  94. struct tm *riscos_localtime(const time_t *timer);
  95. struct tm *riscos_gmtime(const time_t *timer);
  96. int riscos_fseek(FILE *fd, long offset, int whence);
  97. /* work around broken assumption that fseek() is OK with -ve file offsets */
  98. #endif /* !__riscos_h */