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>
102 int utime(const char *, struct utimbuf *);
107 # define NAMLEN(dirent) strlen((dirent)->d_name)
109 # define dirent direct
110 # define NAMLEN(dirent) (dirent)->d_namlen
112 # include <sys/ndir.h>
115 # include <sys/dir.h>
120 # ifdef NONSYSTEM_DIR_LIBRARY /* no use ?? */
129 #endif /* SEEK_SET */
140 #define UCHAR_MAX ((1<<(sizeof(unsigned char)*8))-1)
144 #define USHRT_MAX ((1<<(sizeof(unsigned short)*8))-1)
148 #define SHRT_MAX ((1<<(sizeof(short)*8-1))-1)
152 #define SHRT_MIN (SHRT_MAX-USHRT_MAX)
156 #define ULONG_MAX ((1<<(sizeof(unsigned long)*8))-1)
160 #define LONG_MAX ((1<<(sizeof(long)*8-1))-1)
164 #define LONG_MIN (LONG_MAX-ULONG_MAX)
167 #endif /* HAVE_LIMITS_H */
169 #include "lha_macro.h"
171 struct encode_option {
172 #if defined(__STDC__) || defined(AIX)
174 void (*encode_start) ();
175 void (*encode_end) ();
178 int (*encode_start) ();
179 int (*encode_end) ();
183 struct decode_option {
184 unsigned short (*decode_c) ();
185 unsigned short (*decode_p) ();
186 #if defined(__STDC__) || defined(AIX)
187 void (*decode_start) ();
189 int (*decode_start) ();
193 /* ------------------------------------------------------------------------ */
194 /* LHa File Type Definition */
195 /* ------------------------------------------------------------------------ */
196 typedef int boolean; /* TRUE or FALSE */
205 typedef struct LzHeader {
207 int size_field_length;
208 char method[METHOD_TYPE_STORAGE];
211 unsigned char attribute;
212 unsigned char header_level;
213 char name[FILENAME_LENGTH];
214 unsigned int crc; /* file CRC */
215 boolean has_crc; /* file CRC */
216 unsigned int header_crc; /* header CRC */
217 unsigned char extend_type;
218 unsigned char minor_version;
220 /* extend_type == EXTEND_UNIX and convert from other type. */
221 time_t unix_last_modified_stamp;
222 unsigned short unix_mode;
223 unsigned short unix_uid;
224 unsigned short unix_gid;
232 unsigned long original;
233 unsigned long packed;
239 /* ------------------------------------------------------------------------ */
240 /* Option switch variable */
241 /* ------------------------------------------------------------------------ */
242 /* command line options (common options) */
243 EXTERN boolean quiet;
244 EXTERN boolean text_mode;
245 EXTERN boolean verbose;
246 EXTERN boolean noexec; /* debugging option */
247 EXTERN boolean force;
249 EXTERN boolean delete_after_append;
250 EXTERN int compress_method;
251 EXTERN int header_level;
252 /* EXTERN int quiet_mode; */ /* 1996.8.13 t.okamoto */
254 EXTERN boolean euc_mode;
257 /* list command flags */
258 EXTERN boolean verbose_listing;
260 /* extract/print command flags */
261 EXTERN boolean output_to_stdout;
263 /* add/update/delete command flags */
264 EXTERN boolean new_archive;
265 EXTERN boolean update_if_newer;
266 EXTERN boolean generic_format;
268 EXTERN boolean remove_temporary_at_error;
269 EXTERN boolean recover_archive_when_interrupt;
270 EXTERN boolean remove_extracting_file_when_interrupt;
271 EXTERN boolean get_filename_from_stdin;
272 EXTERN boolean ignore_directory;
273 EXTERN boolean verify_mode;
276 EXTERN int quiet_mode;
278 EXTERN boolean backup_old_archive;
279 /* ------------------------------------------------------------------------ */
280 /* Globale Variable */
281 /* ------------------------------------------------------------------------ */
282 EXTERN char **cmd_filev;
283 EXTERN int cmd_filec;
285 EXTERN char *archive_name;
286 EXTERN char temporary_name[FILENAME_LENGTH];
287 EXTERN char backup_archive_name[FILENAME_LENGTH];
289 EXTERN char *extract_directory;
290 EXTERN char *reading_filename, *writing_filename;
292 EXTERN int archive_file_mode;
293 EXTERN int archive_file_gid;
295 EXTERN struct interfacing interface;
297 EXTERN int noconvertcase; /* 2000.10.6 */
300 EXTERN int unpackable;
301 EXTERN unsigned long origsize, compsize;
302 EXTERN unsigned short dicbit;
303 EXTERN unsigned short maxmatch;
304 EXTERN unsigned long count;
305 EXTERN unsigned long loc; /* short -> long .. Changed N.Watazaki */
306 EXTERN unsigned char *text;
307 EXTERN int prev_char;
310 #ifndef LHA_MAIN_SRC /* t.okamoto 96/2/20 */
311 EXTERN unsigned short left[], right[];
312 EXTERN unsigned char c_len[], pt_len[];
313 EXTERN unsigned short c_freq[], c_table[], c_code[];
314 EXTERN unsigned short p_freq[], pt_table[], pt_code[], t_freq[];
318 #ifdef NEED_INCREMENTAL_INDICATOR
319 EXTERN long indicator_count;
320 EXTERN long indicator_threshold;
324 EXTERN FILE *infile, *outfile;
325 EXTERN unsigned short bitbuf;
326 EXTERN unsigned int crctable[UCHAR_MAX + 1];
330 EXTERN unsigned int n_max;
333 EXTERN int temporary_fd;
335 /* ------------------------------------------------------------------------ */
337 /* ------------------------------------------------------------------------ */
338 #include "prototypes.h"
340 /* Local Variables: */
344 /* vi: set tabstop=4: */