OSDN Git Service

* src/lharc.c: use xstrdup() instead of strdup().
[lha/lha.git] / src / lha_macro.h
index cec73de..27518de 100644 (file)
@@ -4,8 +4,12 @@
 /*             Modified                        Nobutaka Watazaki                                                       */
 /*                                                                                                                                                     */
 /*     Ver. 1.14       Soruce All chagned                              1995.01.14      N.Watazaki              */
+/*     Ver. 1.14g      modified                                                2000.05.06      T.OKAMOTO               */
 /* ------------------------------------------------------------------------ */
 
+/* macro VERSION is defined in config.h by configure script */
+#define LHA_VERSION "lha for unix version " VERSION
+
 /* Most of System V, define TM_IN_SYS_TIME */
 #if    TM_IN_SYS_TIME
 #include <sys/time.h>
 extern struct tm *localtime();
 extern char    *getenv();
 
-#ifndef _MINIX
-#ifndef __STDC__
-extern char    *malloc();
-extern char    *realloc();
-#endif
-#endif
+extern char    *xmalloc();
+extern char    *xrealloc();
+extern char    *xstrdup();
 
 /* external variables */
 extern int      errno;
@@ -79,6 +80,13 @@ typedef int                          boolean;
 
 #define FILENAME_LENGTH        1024
 
+#if defined __MINGW32__
+# define getuid()       0
+# define chown(file, uid, gid)  0
+# define kill(pid, sig)         0
+# define link(from, to)         0
+#endif
+
 /* ------------------------------------------------------------------------ */
 /* YOUR CUSTOMIZIES                                                                                                                    */
 /* ------------------------------------------------------------------------ */
@@ -102,6 +110,7 @@ typedef int                         boolean;
   (((unsigned char)(c) >= 0x40) &&     \
    ((unsigned char)(c) < 0xfd) &&      \
    ((unsigned char)(c) != 0x7f))
+
 #define X0201_KANA_P(c)\
        (0xa0 < (unsigned char)(c) && (unsigned char)(c) < 0xe0)
 
@@ -138,6 +147,7 @@ typedef int                         boolean;
 #define LZHUFF4_METHOD                 "-lh4-"
 #define LZHUFF5_METHOD                 "-lh5-"
 #define LZHUFF6_METHOD                 "-lh6-"
+#define LZHUFF7_METHOD                 "-lh7-"
 #define LARC_METHOD                            "-lzs-"
 #define LARC5_METHOD                   "-lz5-"
 #define LARC4_METHOD                   "-lz4-"
@@ -153,10 +163,11 @@ typedef int                               boolean;
 #define LZHUFF4_METHOD_NUM             4
 #define LZHUFF5_METHOD_NUM             5
 #define LZHUFF6_METHOD_NUM             6
-#define LARC_METHOD_NUM                        7
-#define LARC5_METHOD_NUM               8
-#define LARC4_METHOD_NUM               9
-#define LZHDIRS_METHOD_NUM             10
+#define LZHUFF7_METHOD_NUM             7
+#define LARC_METHOD_NUM                        8
+#define LARC5_METHOD_NUM               9
+#define LARC4_METHOD_NUM               10
+#define LZHDIRS_METHOD_NUM             11
 /* Added N.Watazaki ..^ */
 
 #define I_HEADER_SIZE                  0
@@ -251,7 +262,7 @@ typedef short                               node;
 /* ------------------------------------------------------------------------ */
 /*     Slide relation                                                                                                                  */
 /* ------------------------------------------------------------------------ */
-#if defined(__STDC__) || defined(AIX)
+#if HAVE_LIMITS_H
 
 #include <limits.h>
 
@@ -289,7 +300,7 @@ typedef short                               node;
 #define LONG_MIN       (LONG_MAX-ULONG_MAX)
 #endif
 
-#endif /* not __STDC__ */
+#endif
 
 /* ------------------------------------------------------------------------ */
 /*     FILE Attribute                                                                                                                  */
@@ -311,6 +322,9 @@ typedef short                               node;
 /* ------------------------------------------------------------------------ */
 #if STDC_HEADERS
 # include <string.h>
+# define bcmp(a,b,n)    memcmp((a),(b),(n))
+# define bzero(d,n)     memset((d),0,(n))
+# define bcopy(s,d,n)   memmove((d),(s),(n))
 #else
 # ifndef HAVE_STRCHR
 #  define strchr index
@@ -318,9 +332,9 @@ typedef short                               node;
 # endif
 char *strchr (), *strrchr ();
 # ifdef HAVE_MEMCPY
-#  define bcmp(a,b,n)  memcmp((a),(b),(n))
-#  define bzero(d,n)   memset((d),0,(n))
-#  define bcopy(s,d,n) memmove((d),(s),(n))
+#  define bcmp(a,b,n)   memcmp((a),(b),(n))
+#  define bzero(d,n)    memset((d),0,(n))
+#  define bcopy(s,d,n)  memmove((d),(s),(n))
 # endif
 #endif
 
@@ -403,7 +417,14 @@ char *strchr (), *strrchr ();
 */
 
 /* slide.c */
+#ifdef SUPPORT_LH7
+#define MAX_DICBIT                     16      /* lh7 use 16bits */
+#endif
+
+#ifndef SUPPORT_LH7
 #define MAX_DICBIT                     15      /* lh6 use 15bits */
+#endif
+
 #define MAX_DICSIZ                     (1 << MAX_DICBIT)
 #define MATCHBIT                       8       /* bits for MAXMATCH - THRESHOLD */
 #define MAXMATCH                       256     /* formerly F (not more than UCHAR_MAX + 1) */
@@ -414,6 +435,8 @@ char *strchr (), *strrchr ();
 /* alphabet = {0, 1, 2, ..., NC - 1} */
 #define CBIT                           9       /* $\lfloor \log_2 NC \rfloor + 1$ */
 #define USHRT_BIT                      16      /* (CHAR_BIT * sizeof(ushort)) */
+
 /* Local Variables: */
-/* tab-width : 4 */
+/* mode:c */
+/* tab-width:4 */
 /* End: */