diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 876ed3ad0..bcbe86ea3 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -307,11 +307,7 @@ main(int argc, char *argv[], char *envp[]) char *envstring, *copied_core, *dir; char *stem = "SBCL_HOME="; copied_core = copied_string(core); -#ifndef LISP_FEATURE_WIN32 dir = dirname(copied_core); -#else /* LISP_FEATURE_WIN32 */ - dir = ""; -#endif envstring = (char *) calloc(strlen(stem) + strlen(dir) + 1, diff --git a/src/runtime/win32-os.c b/src/runtime/win32-os.c index 75b2b87e3..9e4186676 100644 --- a/src/runtime/win32-os.c +++ b/src/runtime/win32-os.c @@ -581,6 +581,28 @@ void *memcpy(void *dest, const void *src, size_t n) return dest; } +char *dirname(char *path) +{ + static char buf[PATH_MAX + 1]; + size_t pathlen = strlen(path); + int i; + + if (pathlen >= sizeof(buf)) { + lose("Pathname too long in dirname.\n"); + return NULL; + } + + strcpy(buf, path); + for (i = pathlen; i >= 0; --i) { + if (buf[i] == '/' || buf[i] == '\\') { + buf[i] = '\0'; + break; + } + } + + return buf; +} + /* This is a manually-maintained version of ldso_stubs.S. */ void scratch(void) diff --git a/src/runtime/win32-os.h b/src/runtime/win32-os.h index 4435b6fd7..4cb3de41c 100644 --- a/src/runtime/win32-os.h +++ b/src/runtime/win32-os.h @@ -48,3 +48,5 @@ struct lisp_exception_frame { }; void wos_install_interrupt_handlers(struct lisp_exception_frame *handler); +char *dirname(char *path); + diff --git a/version.lisp-expr b/version.lisp-expr index e10932c23..84e08c12c 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.8.32" +"0.9.8.33"