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