OSDN Git Service

usleep()の有無をautoconfで調べるようにした。
authorhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 10 Mar 2002 20:33:57 +0000 (20:33 +0000)
committerhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 10 Mar 2002 20:33:57 +0000 (20:33 +0000)
memset()はANSI Cで定義されている標準関数なのでHAS_MEMSETは消去。

configure.in
src/externs.h
src/h-config.h
src/util.c

index d615c71..73fa0ad 100644 (file)
@@ -106,6 +106,6 @@ AC_FUNC_MEMCMP
 AC_TYPE_SIGNAL
 AC_FUNC_STRFTIME
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(gethostname mkdir select socket strstr strtol vasprintf vsnprintf mkstemp)
+AC_CHECK_FUNCS(gethostname mkdir select socket strstr strtol vasprintf vsnprintf mkstemp usleep)
 
 AC_OUTPUT(Makefile src/Makefile lib/Makefile lib/apex/Makefile lib/bone/Makefile lib/data/Makefile lib/edit/Makefile lib/file/Makefile lib/help/Makefile lib/info/Makefile lib/pref/Makefile lib/save/Makefile lib/script/Makefile lib/user/Makefile lib/xtra/Makefile lib/xtra/font/Makefile lib/xtra/graf/Makefile lib/xtra/music/Makefile lib/xtra/sound/Makefile)
index 1f5738d..4419dca 100644 (file)
@@ -1347,11 +1347,6 @@ extern void mutation_power_aux(u32b power);
 extern void user_name(char *buf, int id);
 #endif
 
-#ifndef HAS_MEMSET
-/* util.c */
-extern char *memset(char*, int, huge);
-#endif
-
 #if 0
 #ifndef HAS_STRICMP
 /* util.c */
@@ -1359,7 +1354,7 @@ extern int stricmp(cptr a, cptr b);
 #endif
 #endif
 
-#ifndef HAS_USLEEP
+#ifndef HAVE_USLEEP
 /* util.c */
 extern int usleep(huge usecs);
 #endif
index fa373cc..ac4c4b3 100644 (file)
 
 
 /*
- * OPTION: Define "HAS_MEMSET" only if "memset()" exists.
- * Note that the "memset()" routines are used in "z-virt.h"
- */
-#define HAS_MEMSET
-
-
-/*
- * OPTION: Define "HAS_USLEEP" only if "usleep()" exists.
+ * OPTION: Define "HAVE_USLEEP" only if "usleep()" exists.
  *
  * Note that this is only relevant for "SET_UID" machines.
  * Note that new "SOLARIS" and "SGI" machines have "usleep()".
  */
-#ifdef SET_UID
+#if defined(SET_UID) && !defined(HAVE_CONFIG_H)
 # if !defined(HPUX) && !defined(ULTRIX) && !defined(ISC)
-#  define HAS_USLEEP
+#  define HAVE_USLEEP
 # endif
 #endif
 
 #ifdef USE_IBM
-    #ifndef HAS_USLEEP
-    #define HAS_USLEEP /* Set for gcc (djgpp-v2), TY */
-    #endif
+# ifndef HAVE_USLEEP
+#  define HAVE_USLEEP /* Set for gcc (djgpp-v2), TY */
+endif
 #endif
 
 #ifdef JP
index 4a3f6f0..c313dc4 100644 (file)
 
 static int num_more = 0;
 
-#ifndef HAS_MEMSET
-
-/*
- * For those systems that don't have "memset()"
- *
- * Set the value of each of 'n' bytes starting at 's' to 'c', return 's'
- * If 'n' is negative, you will erase a whole lot of memory.
- */
-char *memset(char *s, int c, huge n)
-{
-       char *t;
-       for (t = s; len--; ) *t++ = c;
-       return (s);
-}
-
-#endif
-
-
 #if 0
 #ifndef HAS_STRICMP
 
@@ -57,7 +39,7 @@ int stricmp(cptr a, cptr b)
 
 #ifdef SET_UID
 
-# ifndef HAS_USLEEP
+# ifndef HAVE_USLEEP
 
 /*
  * For those systems that don't have "usleep()" but need it.
@@ -120,7 +102,6 @@ extern struct passwd *getpwnam();
  */
 void user_name(char *buf, int id)
 {
-#ifdef SET_UID
        struct passwd *pw;
 
        /* Look up the user name */
@@ -140,7 +121,6 @@ void user_name(char *buf, int id)
 
                return;
        }
-#endif /* SET_UID */
 
        /* Oops.  Hack -- default to "PLAYER" */
        strcpy(buf, "PLAYER");