| 1 |
/* |
| 2 |
Copyright (c) 1990-2006 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 zip.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 |
#ifndef __tandem_h /* prevent multiple inclusions */ |
| 10 |
#define __tandem_h |
| 11 |
|
| 12 |
#ifndef TANDEM |
| 13 |
# define TANDEM /* better than __TANDEM */ |
| 14 |
#endif |
| 15 |
|
| 16 |
/* LICENSED define now supplied by compile time option (MAKE) */ |
| 17 |
|
| 18 |
#define NO_UNISTD_H |
| 19 |
#define NO_RMDIR |
| 20 |
#define NO_MKTEMP |
| 21 |
|
| 22 |
/* TANDEM supplies proper UTC vs. local time conversion, so enable Info-ZIP's |
| 23 |
UT e.f. support unless explicitly suppressed by a compilation option. */ |
| 24 |
#if (!defined(USE_EF_UT_TIME) && !defined(NO_EF_UT_TIME)) |
| 25 |
# define USE_EF_UT_TIME |
| 26 |
#endif |
| 27 |
#if (defined(NO_EF_UT_TIME) && defined(USE_EF_UT_TIME)) |
| 28 |
# undef USE_EF_UT_TIME |
| 29 |
#endif |
| 30 |
|
| 31 |
/* Include file for TANDEM */ |
| 32 |
|
| 33 |
#ifndef NULL |
| 34 |
# define NULL 0 |
| 35 |
#endif |
| 36 |
|
| 37 |
#include <time.h> /* the usual non-BSD time functions */ |
| 38 |
#include <stdio.h> |
| 39 |
#include <sysstat.h> |
| 40 |
#include <unistd.h> |
| 41 |
#include <errno.h> |
| 42 |
#include <ctype.h> |
| 43 |
|
| 44 |
#define PASSWD_FROM_STDIN |
| 45 |
/* Kludge until we know how to open a non-echo tty channel */ |
| 46 |
|
| 47 |
#define NSK_UNSTRUCTURED 0 |
| 48 |
#define NSK_RELATIVE 1 |
| 49 |
#define NSK_ENTRYSEQUENCED 2 |
| 50 |
#define NSK_KEYSEQUENCED 3 |
| 51 |
#define NSK_OBJECTFILECODE 100 |
| 52 |
#define NSK_EDITFILECODE 101 |
| 53 |
#define NSK_ZIPFILECODE 1001 |
| 54 |
#define TANDEM_BLOCKSIZE 4096 |
| 55 |
#define MAX_NORMAL_READ 4096 |
| 56 |
#define MAX_EDIT_READ 255 |
| 57 |
#define MAX_LARGE_READ 57344 |
| 58 |
#define MAX_LARGE_READ_EXPAND 30720 |
| 59 |
|
| 60 |
#define MAXFILEPARTLEN 8 |
| 61 |
#define MAXPATHLEN 128 |
| 62 |
#define EXTENSION_MAX 3 |
| 63 |
/* FILENAME_MAX is defined in stdio.h */ |
| 64 |
|
| 65 |
#define EXIT zexit /* To stop creation of Abend files */ |
| 66 |
#define RETURN zexit /* To stop creation of Abend files */ |
| 67 |
#define putc zputc /* To allow us to auto flush */ |
| 68 |
|
| 69 |
|
| 70 |
#define FOPR "rb" |
| 71 |
#define FOPM "r+" |
| 72 |
#define FOPW "wb" |
| 73 |
#define FOPWT "w" |
| 74 |
|
| 75 |
#define NAMELEN FILENAME_MAX+1+EXTENSION_MAX /* allow for space extension */ |
| 76 |
|
| 77 |
struct dirent { |
| 78 |
struct dirent *d_next; |
| 79 |
char d_name[NAMELEN+1]; |
| 80 |
}; |
| 81 |
|
| 82 |
typedef struct _DIR { |
| 83 |
struct dirent *D_list; |
| 84 |
struct dirent *D_curpos; |
| 85 |
char D_path[NAMELEN+1]; |
| 86 |
} DIR; |
| 87 |
|
| 88 |
DIR * opendir(const char *dirname); |
| 89 |
struct dirent *readdir(DIR *dirp); |
| 90 |
void rewinddir(DIR *dirp); |
| 91 |
int closedir(DIR *dirp); |
| 92 |
char * readd(DIR *dirp); |
| 93 |
|
| 94 |
#define DISK_DEVICE 3 |
| 95 |
|
| 96 |
/* SETMODE Literals */ |
| 97 |
#define SET_FILE_SECURITY 1 |
| 98 |
#define SET_FILE_OWNER 2 |
| 99 |
#define SET_FILE_BUFFERED 90 |
| 100 |
#define SET_FILE_MAXEXTENTS 92 |
| 101 |
#define SET_FILE_BUFFERSIZE 93 |
| 102 |
#define SET_LARGE_TRANSFERS 141 |
| 103 |
|
| 104 |
/* FILE_OPEN_ Literals */ |
| 105 |
#define NSK_RDWR 0 |
| 106 |
#define NSK_RDONLY 1 |
| 107 |
#define NSK_WRONLY 2 |
| 108 |
#define NSK_APPEND 3 |
| 109 |
#define NSK_SHARED 0 |
| 110 |
#define NSK_EXCLUSIVE 1 |
| 111 |
#define NSK_PROCESSEXCLUSIVE 2 |
| 112 |
#define NSK_PROTECTED 3 |
| 113 |
#define NSK_UNSTRUCTUREDACCESS 0x8000 |
| 114 |
#define NSK_NOUPDATEOPENTIME 0x2000 |
| 115 |
|
| 116 |
#define NSK_NO_DELIMITER 0x0001 |
| 117 |
#define NSK_USE_FF_DELIMITER 0x0002 |
| 118 |
#define NSK_SPACE_FILL 0x0004 |
| 119 |
#define NSK_TRIM_TRAILING_SPACE 0x0008 |
| 120 |
#define NSK_LARGE_READ_EXPAND 0x0100 /* use smaller value for Expand */ |
| 121 |
|
| 122 |
#define DOS_EXTENSION '.' |
| 123 |
#define TANDEM_EXTENSION ' ' |
| 124 |
#define TANDEM_DELIMITER '.' |
| 125 |
#define TANDEM_NODE '\\' |
| 126 |
#define INTERNAL_DELIMITER '/' |
| 127 |
#define INTERNAL_NODE '//' |
| 128 |
#define TANDEM_WILD_1 '*' |
| 129 |
#define TANDEM_WILD_2 '?' |
| 130 |
|
| 131 |
#define DOS_EXTENSION_STR "." |
| 132 |
#define TANDEM_EXTENSION_STR " " |
| 133 |
#define TANDEM_DELIMITER_STR "." |
| 134 |
#define TANDEM_NODE_STR "\\" |
| 135 |
#define INTERNAL_DELIMITER_STR "/" |
| 136 |
#define INTERNAL_NODE_STR "//" |
| 137 |
|
| 138 |
/* Use 'spare' area at end of stat structure to hold additional Tandem/NSK |
| 139 |
file details. Initially used to hold Creation time, now also holds most |
| 140 |
Enscribe details */ |
| 141 |
|
| 142 |
struct nsk_stat_reserved |
| 143 |
{ |
| 144 |
int64_t spare[3]; |
| 145 |
}; |
| 146 |
|
| 147 |
#pragma FIELDALIGN SHARED8 nsk_owner |
| 148 |
struct nsk_owner |
| 149 |
{ |
| 150 |
unsigned group : 8; |
| 151 |
unsigned user : 8; |
| 152 |
}; |
| 153 |
|
| 154 |
#pragma FIELDALIGN SHARED8 nsk_file_flags |
| 155 |
struct nsk_file_flags |
| 156 |
{ |
| 157 |
unsigned buffered : 1; |
| 158 |
unsigned audited : 1; |
| 159 |
unsigned acompress : 1; |
| 160 |
unsigned icompress : 1; |
| 161 |
unsigned dcompress : 1; |
| 162 |
unsigned oddunstr : 1; |
| 163 |
unsigned verified : 1; |
| 164 |
unsigned serial : 1; |
| 165 |
unsigned refresheof : 1; |
| 166 |
unsigned broken : 1; |
| 167 |
unsigned corrupt : 1; |
| 168 |
unsigned primpart : 1; |
| 169 |
unsigned secpart : 1; |
| 170 |
unsigned crashopen : 1; |
| 171 |
unsigned rollforward : 1; |
| 172 |
unsigned clearonpurge: 1; |
| 173 |
}; |
| 174 |
|
| 175 |
#pragma FIELDALIGN SHARED8 nsk_file_attrs_def |
| 176 |
struct nsk_file_attrs_def |
| 177 |
{ |
| 178 |
unsigned short filecode; /* 16 */ |
| 179 |
unsigned short block; /* 16 */ /* Allow of block > 4096 one day ! */ |
| 180 |
struct nsk_file_flags flags; /* 16 */ |
| 181 |
struct nsk_owner owner; /* 16 */ |
| 182 |
unsigned short priext; /* 16 */ |
| 183 |
unsigned short secext; /* 16 */ |
| 184 |
unsigned maxext : 10; |
| 185 |
unsigned read : 3; |
| 186 |
unsigned write : 3; |
| 187 |
unsigned execute : 3; |
| 188 |
unsigned delete : 3; |
| 189 |
unsigned licensed : 1; |
| 190 |
unsigned progid : 1; |
| 191 |
unsigned keylen : 8; |
| 192 |
unsigned : 5; |
| 193 |
unsigned keyoff : 11; |
| 194 |
unsigned : 1; |
| 195 |
unsigned filetype : 2; |
| 196 |
unsigned fileopen : 1; |
| 197 |
unsigned reclen : 12; |
| 198 |
}; |
| 199 |
typedef struct nsk_file_attrs_def nsk_file_attrs; |
| 200 |
|
| 201 |
#pragma FIELDALIGN SHARED8 nsk_stat_overlay |
| 202 |
struct nsk_stat_overlay |
| 203 |
{ |
| 204 |
time_t creation_time; /* 32 bits */ |
| 205 |
nsk_file_attrs nsk_ef_region; |
| 206 |
/* char nsk_ef_region[20]; *//* EF region */ |
| 207 |
}; |
| 208 |
|
| 209 |
typedef union |
| 210 |
{ |
| 211 |
struct nsk_stat_reserved reserved; |
| 212 |
struct nsk_stat_overlay ov; |
| 213 |
} nsk_stat_ov; |
| 214 |
|
| 215 |
/* Prototype function declarations */ |
| 216 |
|
| 217 |
void zexit (int); |
| 218 |
|
| 219 |
int zputc( |
| 220 |
int, |
| 221 |
FILE * |
| 222 |
); |
| 223 |
|
| 224 |
int zgetch (void); |
| 225 |
|
| 226 |
short parsename( |
| 227 |
const char *, |
| 228 |
char *, |
| 229 |
char * |
| 230 |
); |
| 231 |
|
| 232 |
int islicensed (void); |
| 233 |
|
| 234 |
/* End of prototype function declarations */ |
| 235 |
|
| 236 |
#endif /* !__tandem_h */ |