1/*
2  Copyright (c) 1990-2000 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/*---------------------------------------------------------------------------
10
11  os2data.h
12
13  OS/2-specific structures and data to be included in the global data struc-
14  ture.
15
16  ---------------------------------------------------------------------------*/
17
18
19#define MAXNAMLEN  256
20#define MAXPATHLEN 256
21#define MAXLEN     256    /* temporary buffer length */
22#define IBUF_LEN   4096   /* input buffer length */
23
24#define INCL_NOPM
25#define INCL_VIO
26#define INCL_DOSNLS
27#define INCL_DOSPROCESS
28#define INCL_DOSDEVICES
29#define INCL_DOSDEVIOCTL
30#define INCL_DOSERRORS
31#define INCL_DOSMISC
32
33#if (defined(OS2DLL) && !defined(DLL))
34#  undef OS2DLL
35#endif
36
37#ifdef OS2DLL
38#  define INCL_REXXSAA
39#  include <rexxsaa.h>
40#endif
41
42#include <os2.h>
43
44
45struct direct
46{
47  ino_t    d_ino;                   /* a bit of a farce */
48  int      d_reclen;                /* more farce */
49  int      d_namlen;                /* length of d_name */
50  char     d_name[MAXNAMLEN + 1];   /* null terminated */
51  /* nonstandard fields */
52  long     d_size;                  /* size in bytes */
53  unsigned d_mode;                  /* MS-DOS or OS/2 file attributes */
54  unsigned d_time;
55  unsigned d_date;
56};
57
58/* The fields d_size and d_mode are extensions by me (Kai Uwe Rommel).  The
59 * find_first and find_next calls deliver these data without any extra cost.
60 * If these data are needed, the fields save a lot of extra calls to stat()
61 * (each stat() again performs a find_first call !).
62 */
63
64struct _dircontents
65{
66  char *_d_entry;
67  long _d_size;
68  unsigned _d_mode, _d_time, _d_date;
69  struct _dircontents *_d_next;
70};
71
72typedef struct _dirdesc
73{
74  int  dd_id;                   /* uniquely identify each open directory */
75  long dd_loc;                  /* where we are in directory entry is this */
76  struct _dircontents *dd_contents;   /* pointer to contents of dir */
77  struct _dircontents *dd_cp;         /* pointer to current position */
78}
79DIR;
80
81
82struct os2Global {
83
84#ifndef SFX
85   HDIR hdir;
86#ifdef __32BIT__
87   ULONG count;
88   FILEFINDBUF3 find;
89#else
90   USHORT count;
91   FILEFINDBUF find;
92#endif
93#endif /* !SFX */
94
95   int created_dir;        /* used by mapname(), checkdir() */
96   int renamed_fullpath;   /* ditto */
97   int fnlen;              /* ditto */
98#ifdef __32BIT__
99   ULONG nLabelDrive;      /* ditto */
100#else
101   USHORT nLabelDrive;
102#endif
103   int longnameEA;         /* checkdir(), close_outfile() */
104   char *lastpathcomp;     /* ditto */
105
106   struct direct dp;
107   int lower;
108   USHORT nLastDrive, nResult;
109
110   DIR *wild_dir;
111   ZCONST char *wildname;
112   char *dirname, matchname[FILNAMSIZ];
113   int notfirstcall, have_dirname, dirnamelen;
114
115   int rootlen;          /* length of rootpath */
116   char *rootpath;       /* user's "extract-to" directory */
117   char *buildpathHPFS;  /* full path (so far) to extracted file, */
118   char *buildpathFAT;   /*  both HPFS/EA (main) and FAT versions */
119   char *endHPFS;        /* corresponding pointers to end of */
120   char *endFAT;         /*  buildpath ('\0') */
121
122#ifdef OS2DLL
123   char buffer[IBUF_LEN];
124   char output_var[MAXLEN];
125   char getvar_buf[MAXLEN];
126   int getvar_len;
127
128   int output_idx;
129   int stem_len;
130   int putchar_idx;
131   int rexx_error;
132   char *rexx_mes;
133
134   SHVBLOCK request;
135#endif
136};
137
138
139#define SYSTEM_SPECIFIC_GLOBALS struct os2Global os2;
140#define SYSTEM_SPECIFIC_CTOR    os2GlobalsCtor
141
142#ifdef OS2DLL
143#  ifdef API_DOC
144#    define SYSTEM_API_BRIEF    REXXBrief
145#    define SYSTEM_API_DETAILS  REXXDetails
146     extern char *REXXBrief;
147     extern APIDocStruct REXXDetails[];
148#  endif
149#endif
150