some code cleanup following recent code relocations
This commit is contained in:
@@ -56,6 +56,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#endif /* !__cplusplus */
|
#endif /* !__cplusplus */
|
||||||
#endif /* CSTD_H */
|
#endif /* CSTD_H */
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h" /* for config.h+extern.h */
|
#include "hack.h" /* for config.h+extern.h */
|
||||||
|
|
||||||
/*=
|
/*=
|
||||||
Assorted 'small' utility routines. They're virtually independent of
|
Assorted 'small' utility routines. They're virtually independent of
|
||||||
NetHack, except that rounddiv may call panic(). setrandom calls one
|
NetHack, except that rounddiv may call panic(). setrandom calls one
|
||||||
@@ -947,4 +948,22 @@ unicodeval_to_utf8str(int uval, uint8 *buffer, size_t bufsz)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
case_insensitive_comp(const char *s1, const char *s2)
|
||||||
|
{
|
||||||
|
uchar u1, u2;
|
||||||
|
|
||||||
|
for (;; s1++, s2++) {
|
||||||
|
u1 = (uchar) *s1;
|
||||||
|
if (isupper(u1))
|
||||||
|
u1 = (uchar) tolower(u1);
|
||||||
|
u2 = (uchar) *s2;
|
||||||
|
if (isupper(u2))
|
||||||
|
u2 = (uchar) tolower(u2);
|
||||||
|
if (u1 == '\0' || u1 != u2)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return u1 - u2;
|
||||||
|
}
|
||||||
|
|
||||||
/*hacklib.c*/
|
/*hacklib.c*/
|
||||||
|
|||||||
+1
-55
@@ -28,7 +28,7 @@
|
|||||||
#include "flag.h"
|
#include "flag.h"
|
||||||
#include "dlb.h"
|
#include "dlb.h"
|
||||||
#include "hacklib.h"
|
#include "hacklib.h"
|
||||||
#include <ctype.h>
|
|
||||||
/* version information */
|
/* version information */
|
||||||
#ifdef SHORT_FILENAMES
|
#ifdef SHORT_FILENAMES
|
||||||
#include "patchlev.h"
|
#include "patchlev.h"
|
||||||
@@ -61,13 +61,6 @@ char *bannerc_string(char *, size_t, const char *) NONNULL NONNULLPTRS;
|
|||||||
int case_insensitive_comp(const char *, const char *) NONNULLPTRS;
|
int case_insensitive_comp(const char *, const char *) NONNULLPTRS;
|
||||||
|
|
||||||
static void make_version(void);
|
static void make_version(void);
|
||||||
#if 0
|
|
||||||
static char *eos(char *) NONNULL NONNULLARG1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static char *mdlib_strsubst(char *, const char *, const char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAS_NO_MKSTEMP
|
#ifndef HAS_NO_MKSTEMP
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -420,35 +413,6 @@ mkstemp(char *template)
|
|||||||
#endif /* HAS_NO_MKSTEMP */
|
#endif /* HAS_NO_MKSTEMP */
|
||||||
#endif /* MAKEDEFS_C || FOR_RUNTIME */
|
#endif /* MAKEDEFS_C || FOR_RUNTIME */
|
||||||
|
|
||||||
#if 0
|
|
||||||
static char *
|
|
||||||
eos(char *str)
|
|
||||||
{
|
|
||||||
while (*str)
|
|
||||||
str++;
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static char *
|
|
||||||
mdlib_strsubst(char *bp, const char *orig, const char *replacement)
|
|
||||||
{
|
|
||||||
char *found, buf[BUFSZ];
|
|
||||||
|
|
||||||
if (bp) {
|
|
||||||
/* [this could be replaced by strNsubst(bp, orig, replacement, 1)] */
|
|
||||||
found = strstr(bp, orig);
|
|
||||||
if (found) {
|
|
||||||
Strcpy(buf, found + strlen(orig));
|
|
||||||
Strcpy(found, replacement);
|
|
||||||
Strcat(bp, buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bp;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static char save_bones_compat_buf[BUFSZ];
|
static char save_bones_compat_buf[BUFSZ];
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -899,24 +863,6 @@ build_options(void)
|
|||||||
|
|
||||||
#undef STOREOPTTEXT
|
#undef STOREOPTTEXT
|
||||||
|
|
||||||
int
|
|
||||||
case_insensitive_comp(const char *s1, const char *s2)
|
|
||||||
{
|
|
||||||
uchar u1, u2;
|
|
||||||
|
|
||||||
for (;; s1++, s2++) {
|
|
||||||
u1 = (uchar) *s1;
|
|
||||||
if (isupper(u1))
|
|
||||||
u1 = (uchar) tolower(u1);
|
|
||||||
u2 = (uchar) *s2;
|
|
||||||
if (isupper(u2))
|
|
||||||
u2 = (uchar) tolower(u2);
|
|
||||||
if (u1 == '\0' || u1 != u2)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return u1 - u2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
runtime_info_init(void)
|
runtime_info_init(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "dlb.h"
|
#include "dlb.h"
|
||||||
#include "hacklib.h"
|
#include "hacklib.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#ifdef MAC
|
#ifdef MAC
|
||||||
#if defined(__SC__) || defined(__MRC__) /* MPW compilers */
|
#if defined(__SC__) || defined(__MRC__) /* MPW compilers */
|
||||||
#define MPWTOOL
|
#define MPWTOOL
|
||||||
|
|||||||
Reference in New Issue
Block a user