0.9.8.33:
authorChristophe Rhodes <csr21@cam.ac.uk>
Wed, 11 Jan 2006 13:33:20 +0000 (13:33 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Wed, 11 Jan 2006 13:33:20 +0000 (13:33 +0000)
From James Bielman: dirname() for win32.

src/runtime/runtime.c
src/runtime/win32-os.c
src/runtime/win32-os.h
version.lisp-expr

index 876ed3a..bcbe86e 100644 (file)
@@ -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,
index 75b2b87..9e41866 100644 (file)
@@ -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)
index 4435b6f..4cb3de4 100644 (file)
@@ -48,3 +48,5 @@ struct lisp_exception_frame {
 };
 
 void wos_install_interrupt_handlers(struct lisp_exception_frame *handler);
+char *dirname(char *path);
+
index e10932c..84e08c1 100644 (file)
@@ -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"