(scm_system): Convert SCM strings to locale strings instead of
authorMarius Vollmer <mvo@zagadka.de>
Thu, 12 Aug 2004 17:38:52 +0000 (17:38 +0000)
committerMarius Vollmer <mvo@zagadka.de>
Thu, 12 Aug 2004 17:38:52 +0000 (17:38 +0000)
accessing their internals.

libguile/simpos.c

index ff4637d..d0a5a28 100644 (file)
@@ -64,8 +64,9 @@ SCM_DEFINE (scm_system, "system", 0, 1, 0,
            "indicating whether the command processor is available.")
 #define FUNC_NAME s_scm_system
 {
-  int rv;
-
+  int rv, eno;
+  char *c_cmd;
+  
   if (SCM_UNBNDP (cmd))
     {
       rv = system (NULL);
@@ -73,7 +74,9 @@ SCM_DEFINE (scm_system, "system", 0, 1, 0,
     }  
   SCM_VALIDATE_STRING (1, cmd);
   errno = 0;
-  rv = system (SCM_STRING_CHARS (cmd));
+  c_cmd = scm_to_locale_string (cmd);
+  rv = system (c_cmd);
+  eno = errno; free (c_cmd); errno = eno;
   if (rv == -1 || (rv == 127 && errno != 0))
     SCM_SYSERROR;
   return scm_from_int (rv);