OSDN Git Service

Remove unnecessary comments
[lha/lha.git] / src / lha.h
index a7aa70e..2aaeb74 100644 (file)
--- a/src/lha.h
+++ b/src/lha.h
@@ -1,14 +1,14 @@
 /* ------------------------------------------------------------------------ */
-/* LHa for UNIX    Archiver Driver                                                                                     */
-/*                                                                                                                                                     */
-/*             Modified                        Nobutaka Watazaki                                                       */
-/*                                                                                                                                                     */
-/*     Ver. 1.14       Soruce All chagned                              1995.01.14      N.Watazaki              */
-/*     Ver. 1.14i      Modified and bug fixed                  2000.10.06      t.okamoto       */
+/* LHa for UNIX    Archiver Driver                                          */
+/*                                                                          */
+/*      Modified                Nobutaka Watazaki                           */
+/*                                                                          */
+/*  Ver. 1.14   Soruce All chagned              1995.01.14  N.Watazaki      */
+/*  Ver. 1.14i  Modified and bug fixed          2000.10.06  t.okamoto       */
 /* ------------------------------------------------------------------------ */
 /*
-       Included...
-               lharc.h         interface.h             slidehuf.h
+    Included...
+        lharc.h     interface.h     slidehuf.h
 */
 
 #ifdef HAVE_CONFIG_H
 #include <sys/stat.h>
 #include <signal.h>
 
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
 #if STDC_HEADERS
 # include <string.h>
 #else
@@ -38,10 +46,6 @@ char *strchr (), *strrchr ();
 # endif
 #endif
 
-#if HAVE_STRCASECMP
-#define strucmp(p,q)   strcasecmp((p),(q))
-#endif
-
 #if STDC_HEADERS
 # include <stdlib.h>
 # include <stddef.h>
@@ -81,6 +85,21 @@ typedef int uid_t;
 typedef int gid_t;
 #endif
 
+#if !HAVE_UINT64_T
+# define HAVE_UINT64_T 1
+# if SIZEOF_LONG == 8
+    typedef unsigned long uint64_t;
+# elif HAVE_LONG_LONG
+    typedef unsigned long long uint64_t;
+# else
+#  undef HAVE_UINT64_T
+# endif
+#endif
+
+#if !HAVE_SSIZE_T
+typedef long ssize_t;
+#endif
+
 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # include <time.h>
@@ -117,16 +136,33 @@ int utime(const char *, struct utimbuf *);
 # if HAVE_NDIR_H
 #  include <ndir.h>
 # endif
-# ifdef NONSYSTEM_DIR_LIBRARY                  /* no use ?? */
+# ifdef NONSYSTEM_DIR_LIBRARY           /* no use ?? */
 #  include "lhdir.h"
 # endif
 #endif
 
+#if HAVE_FNMATCH_H
+# include <fnmatch.h>
+#else
+int fnmatch(const char *pattern, const char *string, int flags);
+# define FNM_PATHNAME 1
+# define FNM_NOESCAPE 2
+# define FNM_PERIOD   4
+#endif
+
+#if HAVE_LIBAPPLEFILE
+#include <applefile.h>
+#endif
+
+#ifdef __DJGPP__
+#include <io.h>
+#endif /* __DJGPP__ */
+
 #ifndef SEEK_SET
-#define SEEK_SET               0
-#define SEEK_CUR               1
-#define SEEK_END               2
-#endif /* SEEK_SET */
+#define SEEK_SET        0
+#define SEEK_CUR        1
+#define SEEK_END        2
+#endif  /* SEEK_SET */
 
 #if HAVE_LIMITS_H
 #include <limits.h>
@@ -166,92 +202,109 @@ int utime(const char *, struct utimbuf *);
 
 #endif /* HAVE_LIMITS_H */
 
+#if !HAVE_FSEEKO
+# define fseeko  fseek
+#endif
+#if !HAVE_FTELLO
+# define ftello  ftell
+#endif
+
 #include "lha_macro.h"
 
+#define exit(n) lha_exit(n)
+
 struct encode_option {
 #if defined(__STDC__) || defined(AIX)
-       void            (*output) ();
-       void            (*encode_start) ();
-       void            (*encode_end) ();
+    void            (*output) ();
+    void            (*encode_start) ();
+    void            (*encode_end) ();
 #else
-       int             (*output) ();
-       int             (*encode_start) ();
-       int             (*encode_end) ();
+    int             (*output) ();
+    int             (*encode_start) ();
+    int             (*encode_end) ();
 #endif
 };
 
 struct decode_option {
-       unsigned short  (*decode_c) ();
-       unsigned short  (*decode_p) ();
+    unsigned short  (*decode_c) ();
+    unsigned short  (*decode_p) ();
 #if defined(__STDC__) || defined(AIX)
-       void            (*decode_start) ();
+    void            (*decode_start) ();
 #else
-       int             (*decode_start) ();
+    int             (*decode_start) ();
 #endif
 };
 
 /* ------------------------------------------------------------------------ */
-/*     LHa File Type Definition                                                                                                */
+/*  LHa File Type Definition                                                */
 /* ------------------------------------------------------------------------ */
 typedef int boolean;            /* TRUE or FALSE */
 
 struct string_pool {
-       int             used;
-       int             size;
-       int             n;
-       char           *buffer;
+    int             used;
+    int             size;
+    int             n;
+    char           *buffer;
 };
 
 typedef struct LzHeader {
-       long            header_size;
+    size_t          header_size;
     int             size_field_length;
-       char            method[METHOD_TYPE_STORAGE];
-       long            packed_size;
-       long            original_size;
-       unsigned char   attribute;
-       unsigned char   header_level;
-       char            name[FILENAME_LENGTH];
-       unsigned int    crc;      /* file CRC */
-       boolean         has_crc;  /* file CRC */
+    char            method[METHOD_TYPE_STORAGE];
+    off_t           packed_size;
+    off_t           original_size;
+    unsigned char   attribute;
+    unsigned char   header_level;
+    char            name[FILENAME_LENGTH];
+    char            realname[FILENAME_LENGTH];/* real name for symbolic link */
+    unsigned int    crc;      /* file CRC */
+    boolean         has_crc;  /* file CRC */
     unsigned int    header_crc; /* header CRC */
-       unsigned char   extend_type;
-       unsigned char   minor_version;
-
-       /* extend_type == EXTEND_UNIX  and convert from other type. */
-       time_t          unix_last_modified_stamp;
-       unsigned short  unix_mode;
-       unsigned short  unix_uid;
-       unsigned short  unix_gid;
+    unsigned char   extend_type;
+    unsigned char   minor_version;
+
+    /* extend_type == EXTEND_UNIX  and convert from other type. */
+    time_t          unix_last_modified_stamp;
+    unsigned short  unix_mode;
+    unsigned short  unix_uid;
+    unsigned short  unix_gid;
     char            user[256];
     char            group[256];
 }  LzHeader;
 
 struct interfacing {
-       FILE                    *infile;
-       FILE                    *outfile;
-       unsigned long   original;
-       unsigned long   packed;
-       int             dicbit;
-       int             method;
+    FILE            *infile;
+    FILE            *outfile;
+    off_t           original;
+    off_t           packed;
+    off_t           read_size;
+    int             dicbit;
+    int             method;
 };
 
 
 /* ------------------------------------------------------------------------ */
-/*     Option switch variable                                                                                                  */
+/*  Option switch variable                                                  */
 /* ------------------------------------------------------------------------ */
+#ifdef LHA_MAIN_SRC
+#define EXTERN
+#else
+#define EXTERN extern
+#endif
+
 /* command line options (common options) */
 EXTERN boolean  quiet;
 EXTERN boolean  text_mode;
 EXTERN boolean  verbose;
-EXTERN boolean  noexec;                /* debugging option */
+EXTERN boolean  noexec;     /* debugging option */
 EXTERN boolean  force;
-EXTERN boolean  prof;
+EXTERN boolean  timestamp_archive;
 EXTERN boolean  delete_after_append;
-EXTERN int             compress_method;
-EXTERN int             header_level;
-/* EXTERN int          quiet_mode; */   /* 1996.8.13 t.okamoto */
+EXTERN int      compress_method;
+EXTERN int      header_level;
+/* EXTERN int       quiet_mode; */   /* 1996.8.13 t.okamoto */
 #ifdef EUC
-EXTERN boolean euc_mode;
+EXTERN boolean  euc_mode;
 #endif
 
 /* list command flags */
@@ -265,46 +318,54 @@ EXTERN boolean  new_archive;
 EXTERN boolean  update_if_newer;
 EXTERN boolean  generic_format;
 
-EXTERN boolean remove_temporary_at_error;
-EXTERN boolean recover_archive_when_interrupt;
-EXTERN boolean remove_extracting_file_when_interrupt;
-EXTERN boolean get_filename_from_stdin;
-EXTERN boolean ignore_directory;
-EXTERN boolean verify_mode;
+EXTERN boolean  remove_temporary_at_error;
+EXTERN boolean  recover_archive_when_interrupt;
+EXTERN boolean  remove_extracting_file_when_interrupt;
+EXTERN boolean  get_filename_from_stdin;
+EXTERN boolean  ignore_directory;
+EXTERN char   **exclude_files;
+EXTERN boolean  verify_mode;
 
 /* Indicator flag */
-EXTERN int             quiet_mode;
+EXTERN int      quiet_mode;
 
 EXTERN boolean backup_old_archive;
+EXTERN boolean extract_broken_archive;
+EXTERN boolean decode_macbinary_contents;
+
+/* for debugging */
+EXTERN boolean sort_contents;
+EXTERN boolean recursive_archiving;
+EXTERN boolean dump_lzss;
+
+
 /* ------------------------------------------------------------------------ */
-/*     Globale Variable                                                                                                                */
+/*  Globale Variable                                                        */
 /* ------------------------------------------------------------------------ */
-EXTERN char            **cmd_filev;
+EXTERN char     **cmd_filev;
 EXTERN int      cmd_filec;
 
-EXTERN char            *archive_name;
+EXTERN char     *archive_name;
 EXTERN char     temporary_name[FILENAME_LENGTH];
 EXTERN char     backup_archive_name[FILENAME_LENGTH];
 
-EXTERN char            *extract_directory;
-EXTERN char            *reading_filename, *writing_filename;
+EXTERN char     *extract_directory;
+EXTERN char     *reading_filename, *writing_filename;
 
 EXTERN int      archive_file_mode;
 EXTERN int      archive_file_gid;
 
-EXTERN struct  interfacing interface;
-
-EXTERN int      noconvertcase; /* 2000.10.6 */
+EXTERN int      convertcase;    /* 2000.10.6 */
 
 /* slide.c */
 EXTERN int      unpackable;
-EXTERN unsigned long origsize, compsize;
+EXTERN off_t origsize, compsize;
 EXTERN unsigned short dicbit;
 EXTERN unsigned short maxmatch;
-EXTERN unsigned long count;
-EXTERN unsigned long loc;                      /* short -> long .. Changed N.Watazaki */
-EXTERN unsigned char *text;
-EXTERN int             prev_char;
+EXTERN off_t decode_count;
+EXTERN unsigned long loc;           /* short -> long .. Changed N.Watazaki */
+EXTERN unsigned char *text;         /* encoding buffer */
+EXTERN unsigned char *dtext;        /* decoding buffer */
 
 /* huf.c */
 #ifndef LHA_MAIN_SRC  /* t.okamoto 96/2/20 */
@@ -314,15 +375,11 @@ EXTERN unsigned short c_freq[], c_table[], c_code[];
 EXTERN unsigned short p_freq[], pt_table[], pt_code[], t_freq[];
 #endif
 
-/* append.c */
-#ifdef NEED_INCREMENTAL_INDICATOR
-EXTERN long            indicator_count;
-EXTERN long            indicator_threshold;
-#endif
+/* bitio.c */
+EXTERN FILE     *infile, *outfile;
+EXTERN unsigned short bitbuf;
 
 /* crcio.c */
-EXTERN FILE            *infile, *outfile;
-EXTERN unsigned short bitbuf;
 EXTERN unsigned int crctable[UCHAR_MAX + 1];
 EXTERN int      dispflg;
 
@@ -333,12 +390,6 @@ EXTERN unsigned int n_max;
 EXTERN int temporary_fd;
 
 /* ------------------------------------------------------------------------ */
-/*     Functions                                                                                                                               */
+/*  Functions                                                               */
 /* ------------------------------------------------------------------------ */
 #include "prototypes.h"
-
-/* Local Variables: */
-/* mode:c */
-/* tab-width:4 */
-/* End: */
-/* vi: set tabstop=4: */