1 /* ------------------------------------------------------------------------ */
2 /* LHa for UNIX Archiver Driver */
4 /* Modified Nobutaka Watazaki */
6 /* Ver. 1.14 Soruce All chagned 1995.01.14 N.Watazaki */
7 /* Ver. 1.14i Modified and bug fixed 2000.10.06 t.okamoto */
8 /* ------------------------------------------------------------------------ */
11 lharc.h interface.h slidehuf.h
21 #include <sys/types.h>
31 # define strrchr rindex
33 char *strchr (), *strrchr ();
35 # define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
36 # define memcpy(d, s, n) bcopy ((s), (d), (n))
37 # define memmove(d, s, n) bcopy ((s), (d), (n))
42 #define strucmp(p,q) strcasecmp((p),(q))
55 #define NULL ((char *)0)
64 # define va_init(a,b) va_start(a,b)
67 # define va_init(a,b) va_start(a)
84 #if TIME_WITH_SYS_TIME
85 # include <sys/time.h>
89 # include <sys/time.h>
101 # define NAMLEN(dirent) strlen((dirent)->d_name)
103 # define dirent direct
104 # define NAMLEN(dirent) (dirent)->d_namlen
106 # include <sys/ndir.h>
109 # include <sys/dir.h>
114 # ifdef NONSYSTEM_DIR_LIBRARY /* no use ?? */
123 #endif /* SEEK_SET */
134 #define UCHAR_MAX ((1<<(sizeof(unsigned char)*8))-1)
138 #define USHRT_MAX ((1<<(sizeof(unsigned short)*8))-1)
142 #define SHRT_MAX ((1<<(sizeof(short)*8-1))-1)
146 #define SHRT_MIN (SHRT_MAX-USHRT_MAX)
150 #define ULONG_MAX ((1<<(sizeof(unsigned long)*8))-1)
154 #define LONG_MAX ((1<<(sizeof(long)*8-1))-1)
158 #define LONG_MIN (LONG_MAX-ULONG_MAX)
161 #endif /* HAVE_LIMITS_H */
163 #include "lha_macro.h"
165 struct encode_option {
166 #if defined(__STDC__) || defined(AIX)
168 void (*encode_start) ();
169 void (*encode_end) ();
172 int (*encode_start) ();
173 int (*encode_end) ();
177 struct decode_option {
178 unsigned short (*decode_c) ();
179 unsigned short (*decode_p) ();
180 #if defined(__STDC__) || defined(AIX)
181 void (*decode_start) ();
183 int (*decode_start) ();
187 /* ------------------------------------------------------------------------ */
188 /* LHa File Type Definition */
189 /* ------------------------------------------------------------------------ */
190 typedef int boolean; /* TRUE or FALSE */
199 typedef struct LzHeader {
200 unsigned char header_size;
201 char method[METHOD_TYPE_STRAGE];
204 long last_modified_stamp;
205 unsigned char attribute;
206 unsigned char header_level;
210 unsigned char extend_type;
211 unsigned char minor_version;
213 /* extend_type == EXTEND_UNIX and convert from other type. */
214 time_t unix_last_modified_stamp;
215 unsigned short unix_mode;
216 unsigned short unix_uid;
217 unsigned short unix_gid;
225 unsigned long original;
226 unsigned long packed;
232 /* ------------------------------------------------------------------------ */
233 /* Option switch variable */
234 /* ------------------------------------------------------------------------ */
235 /* command line options (common options) */
236 EXTERN boolean quiet;
237 EXTERN boolean text_mode;
238 EXTERN boolean verbose;
239 EXTERN boolean noexec; /* debugging option */
240 EXTERN boolean force;
242 EXTERN boolean delete_after_append;
243 EXTERN int compress_method;
244 EXTERN int header_level;
245 /* EXTERN int quiet_mode; */ /* 1996.8.13 t.okamoto */
247 EXTERN boolean euc_mode;
250 /* list command flags */
251 EXTERN boolean verbose_listing;
253 /* extract/print command flags */
254 EXTERN boolean output_to_stdout;
256 /* add/update/delete command flags */
257 EXTERN boolean new_archive;
258 EXTERN boolean update_if_newer;
259 EXTERN boolean generic_format;
261 EXTERN boolean remove_temporary_at_error;
262 EXTERN boolean recover_archive_when_interrupt;
263 EXTERN boolean remove_extracting_file_when_interrupt;
264 EXTERN boolean get_filename_from_stdin;
265 EXTERN boolean ignore_directory;
266 EXTERN boolean verify_mode;
269 EXTERN int quiet_mode;
271 /* ------------------------------------------------------------------------ */
272 /* Globale Variable */
273 /* ------------------------------------------------------------------------ */
274 EXTERN char **cmd_filev;
275 EXTERN int cmd_filec;
277 EXTERN char *archive_name;
278 EXTERN char temporary_name[FILENAME_LENGTH];
279 EXTERN char backup_archive_name[FILENAME_LENGTH];
281 EXTERN char *extract_directory;
282 EXTERN char *reading_filename, *writing_filename;
284 EXTERN int archive_file_mode;
285 EXTERN int archive_file_gid;
287 EXTERN struct interfacing interface;
288 /* EXTERN unsigned short crc; */ /* 1996.8.13 t.okamoto */
290 EXTERN int noconvertcase; /* 2000.10.6 */
293 EXTERN int unpackable;
294 EXTERN unsigned long origsize, compsize;
295 EXTERN unsigned short dicbit;
296 EXTERN unsigned short maxmatch;
297 EXTERN unsigned long count;
298 EXTERN unsigned long loc; /* short -> long .. Changed N.Watazaki */
299 EXTERN unsigned char *text;
300 EXTERN int prev_char;
303 #ifndef LHA_MAIN_SRC /* t.okamoto 96/2/20 */
304 EXTERN unsigned short left[], right[];
305 EXTERN unsigned char c_len[], pt_len[];
306 EXTERN unsigned short c_freq[], c_table[], c_code[];
307 EXTERN unsigned short p_freq[], pt_table[], pt_code[], t_freq[];
311 #ifdef NEED_INCREMENTAL_INDICATOR
312 EXTERN long indicator_count;
313 EXTERN long indicator_threshold;
317 EXTERN FILE *infile, *outfile;
318 EXTERN unsigned short crc, bitbuf;
320 EXTERN long reading_size;
323 EXTERN unsigned int n_max;
326 EXTERN int temporary_fd;
328 /* ------------------------------------------------------------------------ */
330 /* ------------------------------------------------------------------------ */
331 #include "prototypes.h"
333 /* Local Variables: */
337 /* vi: set tabstop=4: */