From James Bielman: dirname() for win32.
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,
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)
};
void wos_install_interrupt_handlers(struct lisp_exception_frame *handler);
+char *dirname(char *path);
+
;;; 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"