diff --git a/sys/unix/Makefile.utl b/sys/unix/Makefile.utl index 84f73b4f6..862a319da 100644 --- a/sys/unix/Makefile.utl +++ b/sys/unix/Makefile.utl @@ -394,8 +394,10 @@ $(TARGETPFX)sf-version.o: ../src/version.c $(HACK_H) $(TARGETPFX)sf-worm.o: ../src/worm.c $(HACK_H) $(TARGET_CC) $(TARGET_CFLAGS) $(SFFLAGS) -o $@ -c ../src/worm.c -sftags: sftags.o $(HACKLIB) - $(CLINK) $(LFLAGS) -o $@ sftags.o $(HACKLIB) $(LIBS) +sftags: sftags.o $(HACKLIB) $(TARGETPFX)sf-alloc.o $(TARGETPFX)panic.o + $(CLINK) $(LFLAGS) -o $@ sftags.o \ + $(TARGETPFX)sf-alloc.o $(TARGETPFX)panic.o \ + $(HACKLIB) $(LIBS) sftags.o: sftags.c $(HACK_H) $(CC) $(CFLAGS) -c sftags.c ../include/sfproto.h: sf.tags sftags diff --git a/sys/windows/Makefile.nmake b/sys/windows/Makefile.nmake index 9fd673698..2097d7183 100644 --- a/sys/windows/Makefile.nmake +++ b/sys/windows/Makefile.nmake @@ -2649,8 +2649,10 @@ $(OUTL)sf-sys.o: $(SRC)sys.c $(HACK_H) $(OUTL)sf-windsys.o: $(MSWSYS)windsys.c $(HACK_H) $(Q)$(CC) $(CFLAGS) $(SFFLAGS) -Fo$@ -c $(MSWSYS)windsys.c -$(UTIL)sftags.exe: $(OUTL)sftags.o $(OUTLHACKLIB) - $(link) $(LFLAGS) /OUT:$@ $(OUTL)sftags.o $(OUTLHACKLIB) +$(UTIL)sftags.exe: $(OUTL)sftags.o $(OUTL)sf-alloc.o $(OUTL)panic.o $(OUTLHACKLIB) + $(link) $(LFLAGS) /OUT:$@ $(OUTL)sftags.o \ + $(OUTL)sf-alloc.o $(OUTL)panic.o \ + $(OUTLHACKLIB) $(OUTL)sftags.o: $(UTIL)sftags.c $(HACK_H) $(Q)$(CC) $(CFLAGS) -Fo$@ -c $(UTIL)sftags.c $(INCL)sfproto.h: $(UTIL)sftags.exe $(UTIL)sf.tags diff --git a/util/sfctool.c b/util/sfctool.c index 8bfc3ccde..ab1ad4d97 100644 --- a/util/sfctool.c +++ b/util/sfctool.c @@ -96,7 +96,7 @@ int util_strncmpi(const char *s1, const char *s2, size_t sz); #ifdef UNIX #define nethack_exit exit ATTRNORETURN void nh_terminate(int) NORETURN; /* bwrite() calls this */ -static void chdirx(const char *); +static void chdirx(const char *, boolean); #else ATTRNORETURN extern void nethack_exit(int) NORETURN; #ifdef WIN32 @@ -184,7 +184,7 @@ main(int argc, char *argv[]) folderbuf[1] = '/'; folderbuf[2] = '\0'; #ifdef CHDIR - chdirx(HACKDIR); + chdirx(HACKDIR, FALSE); #endif #endif #ifdef UNIX @@ -809,8 +809,8 @@ nethack_exit(int code) #ifdef UNIX #ifdef CHDIR -static void -chdirx(const char *dir) +void +chdirx(const char *dir, boolean wr UNUSED) { if (dir) { #ifdef SECURE diff --git a/util/sftags.c b/util/sftags.c index e13ea94ce..9d204cdb3 100644 --- a/util/sftags.c +++ b/util/sftags.c @@ -548,8 +548,8 @@ static void parseExtensionFields (struct tagstruct *tmptag, char *buf) if (colon == (char *)0) { tmptag->tagtype = *field; } else { - const char *key = field; - const char *value = colon + 1; + char *key = field; + char *value = colon + 1; *colon = '\0'; if ((strcmp (key, "struct") == 0) || (strcmp (key, "union") == 0)) { @@ -1844,14 +1844,15 @@ static char * bfsize(const char *str) { static char buf[128]; - const char *c1; - char *c2, *subst; + char *copy_str, *c1, *c2, *subst; + char *retval = buf; if (!str) return (char *)0; + copy_str = dupstr(str); /* kludge */ - subst = strstr(str, ",$/"); + subst = strstr(copy_str, ",$/"); if (subst != 0) { subst++; *subst++ = ' '; @@ -1859,7 +1860,7 @@ bfsize(const char *str) } c2 = buf; - c1 = str; + c1 = copy_str; while (*c1) { if (*c1 == ',') break; @@ -1873,9 +1874,10 @@ bfsize(const char *str) } *c2 = '\0'; } else { - return (char *)0; + retval = (char *) 0; } - return buf; + free((genericptr_t) copy_str); + return retval; } /* Read one line from input, up to and including the next newline