diff --git a/src/io.c b/src/io.c index 8ce47af..1efc662 100644 --- a/src/io.c +++ b/src/io.c @@ -190,11 +190,7 @@ Object General_File_Operation (Object s, register int op) { return s; } Alloca (r, char*, strlen (dir) + 1 + strlen (p) + 1); -#ifdef WIN32 - sprintf (r, "%s\\%s", dir, p); -#else - sprintf (r, "%s/%s", dir, p); -#endif + sprintf (r, "%s" SEPARATOR_STRING "%s", dir, p); ret = Make_String (r, strlen (r)); Alloca_End; return ret; @@ -241,11 +237,7 @@ Object Open_File (char *name, int flags, int err) { p = Internal_Tilde_Expand (name, &dir); if (p) { Alloca (name, char*, strlen (dir) + 1 + strlen (p) + 1); -#ifdef WIN32 - sprintf (name, "%s\\%s", dir, p); -#else - sprintf (name, "%s/%s", dir, p); -#endif + sprintf (name, "%s" SEPARATOR_STRING "%s", dir, p); } if (!err && stat (name, &st) == -1 && (errno == ENOENT || errno == ENOTDIR)) { @@ -300,13 +292,8 @@ Object General_Open_File (Object name, int flags, Object path) { Alloca (buf, char*, blen); } memcpy (buf, STRING(pref)->data, plen); -#ifdef WIN32 - if (buf[plen-1] != '\\') - buf[plen++] = '\\'; -#else - if (buf[plen-1] != '/') - buf[plen++] = '/'; -#endif + if (buf[plen-1] != SEPARATOR_CHAR) + buf[plen++] = SEPARATOR_CHAR; memcpy (buf+plen, fn, len); buf[len+plen] = '\0'; port = Open_File (buf, flags, 0); diff --git a/src/libelk.c b/src/libelk.c index 4a479a0..9f6ad3d 100644 --- a/src/libelk.c +++ b/src/libelk.c @@ -309,11 +309,7 @@ void Elk_Init (int ac, char **av, int init_objects, char *toplevel) { */ Set_Error_Tag ("scheme-init"); initfile = Safe_Malloc (strlen (Scm_Dir) + 1 + sizeof (INITFILE) + 1); -#ifdef WIN32 - sprintf (initfile, "%s\\%s", Scm_Dir, INITFILE); -#else - sprintf (initfile, "%s/%s", Scm_Dir, INITFILE); -#endif + sprintf (initfile, "%s" SEPARATOR_STRING "%s", Scm_Dir, INITFILE); if (stat (initfile, &st) == -1 && errno == ENOENT) file = Make_String (INITFILE, sizeof(INITFILE)-1); else diff --git a/src/loadlib.c b/src/loadlib.c index 47c50f5..771ba68 100644 --- a/src/loadlib.c +++ b/src/loadlib.c @@ -197,21 +197,21 @@ static void Load_Lib (Object libs) { /* Our line starts with dlname='... */ if (strncmp (buffer, "dlname", 6)) continue; - dlname = index (buffer, '\''); + dlname = strchr (buffer, '\''); if (dlname == NULL) continue; dlname++; - eol = rindex (buffer, '\''); + eol = strrchr (buffer, '\''); if (eol == NULL || eol == dlname) continue; *eol = '\0'; path = strdup (STRING(PORT(port)->name)->data); - eol = rindex (path, '/'); + eol = strrchr (path, SEPARATOR_CHAR); if (eol == NULL) eol = path; *eol = '\0'; lib = malloc (strlen (path) + 1 + strlen (dlname) + 1); - sprintf (lib, "%s/%s", path, dlname); + sprintf (lib, "%s" SEPARATOR_STRING "%s", path, dlname); free (path); break; }