From: arai Date: Sun, 7 Jul 2002 11:00:16 +0000 (+0000) Subject: * src/lha.h, src/lha_macro.h: refined. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f6ea4decdde57510146a8439ca2863c592abe800;p=lha%2Flha.git * src/lha.h, src/lha_macro.h: refined. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lha/lha/trunk@325 6a8cc165-1e22-0410-a132-eb4e3f353aba --- diff --git a/src/lha.h b/src/lha.h index 860e9a3..fee2fc8 100644 --- a/src/lha.h +++ b/src/lha.h @@ -24,6 +24,25 @@ #include #if STDC_HEADERS +# include +#else +# if !HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr (), *strrchr (); +# if !HAVE_MEMCPY +# define memcmp(s1, s2, n) bcmp ((s1), (s2), (n)) +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# define memmove(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif + +#if HAVE_STRCASECMP +#define strucmp(p,q) strcasecmp((p),(q)) +#endif + +#if STDC_HEADERS # include # include #else @@ -32,6 +51,10 @@ # endif #endif +#ifndef NULL +#define NULL ((char *)0) +#endif + #if HAVE_UNISTD_H #include #endif @@ -106,6 +129,43 @@ typedef int gid_t; #define SEEK_END 2 #endif /* SEEK_SET */ +#if HAVE_LIMITS_H +#include +#else + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +#ifndef UCHAR_MAX +#define UCHAR_MAX ((1<<(sizeof(unsigned char)*8))-1) +#endif + +#ifndef USHRT_MAX +#define USHRT_MAX ((1<<(sizeof(unsigned short)*8))-1) +#endif + +#ifndef SHRT_MAX +#define SHRT_MAX ((1<<(sizeof(short)*8-1))-1) +#endif + +#ifndef SHRT_MIN +#define SHRT_MIN (SHRT_MAX-USHRT_MAX) +#endif + +#ifndef ULONG_MAX +#define ULONG_MAX ((1<<(sizeof(unsigned long)*8))-1) +#endif + +#ifndef LONG_MAX +#define LONG_MAX ((1<<(sizeof(long)*8-1))-1) +#endif + +#ifndef LONG_MIN +#define LONG_MIN (LONG_MAX-ULONG_MAX) +#endif + +#endif /* HAVE_LIMITS_H */ #include "lha_macro.h" diff --git a/src/lha_macro.h b/src/lha_macro.h index 80d7c8b..f1bbb55 100644 --- a/src/lha_macro.h +++ b/src/lha_macro.h @@ -195,46 +195,6 @@ /* ------------------------------------------------------------------------ */ /* Slide relation */ /* ------------------------------------------------------------------------ */ -#if HAVE_LIMITS_H - -#include - -#else - -#ifndef CHAR_BIT -#define CHAR_BIT 8 -#endif - -#ifndef UCHAR_MAX -#define UCHAR_MAX ((1<<(sizeof(unsigned char)*8))-1) -#endif - -#ifndef USHRT_MAX -#define USHRT_MAX ((1<<(sizeof(unsigned short)*8))-1) -#endif - -#ifndef SHRT_MAX -#define SHRT_MAX ((1<<(sizeof(short)*8-1))-1) -#endif - -#ifndef SHRT_MIN -#define SHRT_MIN (SHRT_MAX-USHRT_MAX) -#endif - -#ifndef ULONG_MAX -#define ULONG_MAX ((1<<(sizeof(unsigned long)*8))-1) -#endif - -#ifndef LONG_MAX -#define LONG_MAX ((1<<(sizeof(long)*8-1))-1) -#endif - -#ifndef LONG_MIN -#define LONG_MIN (LONG_MAX-ULONG_MAX) -#endif - -#endif - #define LH3_DICBIT 13 #define LH5_DICBIT 13 #define LH6_DICBIT 15 @@ -256,28 +216,6 @@ #endif /* ------------------------------------------------------------------------ */ -/* Memory and String function */ -/* ------------------------------------------------------------------------ */ -#if STDC_HEADERS -# include -#else -# if !HAVE_STRCHR -# define strchr index -# define strrchr rindex -# endif -char *strchr (), *strrchr (); -# if !HAVE_MEMCPY -# define memcmp(s1, s2, n) bcmp ((s1), (s2), (n)) -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memmove(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -#if HAVE_STRCASECMP -#define strucmp(p,q) strcasecmp((p),(q)) -#endif - -/* ------------------------------------------------------------------------ */ /* Individual macro define */ /* ------------------------------------------------------------------------ */ @@ -340,10 +278,6 @@ char *strchr (), *strrchr (); #define BUFFERSIZE 2048 #define MAXSFXCODE 1024*64 -#ifndef NULL -#define NULL (char *)0 -#endif - /* slide.c */ /* #define PERCOLATE 1