1/*
2  Copyright (c) 1990-2001 Info-ZIP.  All rights reserved.
3
4  See the accompanying file LICENSE, version 2000-Apr-09 or later
5  (the contents of which are also included in unzip.h) for terms of use.
6  If, for some reason, all these files are missing, the Info-ZIP license
7  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
8*/
9/* riscos.h */
10
11#ifndef __riscos_h
12#define __riscos_h
13
14#include <time.h>
15
16typedef struct {
17  int errnum;
18  char errmess[252];
19} os_error;
20
21#ifndef __swiven_h
22#  include "swiven.h"
23#endif
24
25#define MAXPATHLEN 256
26#define MAXFILENAMELEN 64  /* should be 11 for ADFS, 13 for DOS, 64 seems a sensible value... */
27#define DIR_BUFSIZE 1024   /* this should be enough to read a whole E-Format directory */
28
29struct stat {
30  unsigned int st_dev;
31  int st_ino;
32  unsigned int st_mode;
33  int st_nlink;
34  unsigned short st_uid;
35  unsigned short st_gid;
36  unsigned int st_rdev;
37  unsigned int st_size;
38  unsigned int st_blksize;
39  time_t st_atime;
40  time_t st_mtime;
41  time_t st_ctime;
42};
43
44typedef struct {
45  char *dirname;
46  void *buf;
47  int size;
48  char *act;
49  int offset;
50  int read;
51} DIR;
52
53
54struct dirent {
55  unsigned int d_off;          /* offset of next disk directory entry */
56  int d_fileno;                /* file number of entry */
57  size_t d_reclen;             /* length of this record */
58  size_t d_namlen;             /* length of d_name */
59  char d_name[MAXFILENAMELEN]; /* name */
60};
61
62typedef struct {
63  unsigned int load_addr;
64  unsigned int exec_addr;
65  int lenght;
66  int attrib;
67  int objtype;
68  char name[13];
69} riscos_direntry;
70
71typedef struct {
72  short         ID;
73  short         size;
74  int           ID_2;
75  unsigned int  loadaddr;
76  unsigned int  execaddr;
77  int           attr;
78  int           zero;
79} extra_block;
80
81
82#define S_IFMT  0770000
83
84#define S_IFDIR 0040000
85#define S_IFREG 0100000  /* 0200000 in UnixLib !?!?!?!? */
86
87#ifndef S_IEXEC
88#  define S_IEXEC  0000100
89#  define S_IWRITE 0000200
90#  define S_IREAD  0000400
91#endif
92
93#ifndef NO_UNZIPH_STUFF
94#  include <time.h>
95#  if (!defined(HAVE_STRNICMP) & !defined(NO_STRNICMP))
96#    define NO_STRNICMP
97#  endif
98#  ifndef DATE_FORMAT
99#    define DATE_FORMAT DF_DMY
100#  endif
101#  define lenEOL 1
102#  define PutNativeEOL  *q++ = native(LF);
103#  define USE_STRM_INPUT
104#  define USE_FWRITE
105#  define PIPE_ERROR (errno == 9999)    /* always false */
106#  define isatty(x) (TRUE)   /* used in funzip.c to find if stdin redirected:
107     should find a better way, now just work as if stdin never redirected */
108#  define USE_EF_UT_TIME
109#  if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
110#    define TIMESTAMP
111#  endif
112#  define localtime riscos_localtime
113#  define gmtime riscos_gmtime
114#endif /* !NO_UNZIPH_STUFF */
115
116#define _raw_getc() SWI_OS_ReadC()
117
118extern char *exts2swap; /* Extensions to swap */
119
120int stat(char *filename,struct stat *res);
121DIR *opendir(char *dirname);
122struct dirent *readdir(DIR *d);
123void closedir(DIR *d);
124int unlink(char *f);
125int rmdir(char *d);
126int chmod(char *file, int mode);
127void setfiletype(char *fname,int ftype);
128void getRISCOSexts(char *envstr);
129int checkext(char *suff);
130void swapext(char *name, char *exptr);
131void remove_prefix(void);
132void set_prefix(void);
133struct tm *riscos_localtime(const time_t *timer);
134struct tm *riscos_gmtime(const time_t *timer);
135
136#endif /* !__riscos_h */
137