* posix.c (scm_uname): throw an error if uname fails instead
authorGary Houston <ghouston@arglist.com>
Sat, 15 Mar 1997 18:10:35 +0000 (18:10 +0000)
committerGary Houston <ghouston@arglist.com>
Sat, 15 Mar 1997 18:10:35 +0000 (18:10 +0000)
of returning errno.

* error.h (scm_errno, scm_perror): obsolete prototypes removed.

* error.c (err_head, scm_errno, scm_perror): obsolete procedures
removed.

* async.c (scm_ints_disabled): definition moved from error.c.

libguile/ChangeLog
libguile/async.c
libguile/error.c
libguile/error.h
libguile/posix.c

index 710edf8..035267c 100644 (file)
@@ -1,3 +1,15 @@
+Sat Mar 15 01:11:40 1997  Gary Houston  <ghouston@actrix.gen.nz>
+
+       * posix.c (scm_uname): throw an error if uname fails instead
+       of returning errno.
+
+       * error.h (scm_errno, scm_perror): obsolete prototypes removed.
+
+       * error.c (err_head, scm_errno, scm_perror): obsolete procedures
+       removed.
+
+       * async.c (scm_ints_disabled): definition moved from error.c.
+
 Sat Mar 15 00:06:08 1997  Mikael Djurfeldt  <mdj@mdj.nada.kth.se>
 
        * acconfig.h: Removed PACKAGE.
index d2478fd..115cc8c 100644 (file)
  *
  */
 
-
+/* True between SCM_DEFER_INTS and SCM_ALLOW_INTS, and
+ * when the interpreter is not running at all.
+ */
+int scm_ints_disabled = 1;
 
 unsigned int scm_async_clock = 20;
 static unsigned int scm_async_rate = 20;
index cab5c0d..a2a8c7f 100644 (file)
  */
 
 
-/* True between SCM_DEFER_INTS and SCM_ALLOW_INTS, and
- * when the interpreter is not running at all.
- */
-int scm_ints_disabled = 1;
-
 extern int errno;
 
-static void err_head SCM_P ((char *str));
-
-static void 
-err_head (str)
-     char *str;
-{
-  int oerrno = errno;
-  if (SCM_NIMP (scm_cur_outp))
-    scm_fflush (scm_cur_outp);
-  scm_gen_putc ('\n', scm_cur_errp);
-#if 0
-  if (SCM_BOOL_F != *scm_loc_loadpath)
-    {
-      scm_prin1 (*scm_loc_loadpath, scm_cur_errp, 1);
-      scm_gen_puts (scm_regular_string, ", line ", scm_cur_errp);
-      scm_intprint ((long) scm_linum, 10, scm_cur_errp);
-      scm_gen_puts (scm_regular_string, ": ", scm_cur_errp);
-    }
-#endif
-  scm_fflush (scm_cur_errp);
-  errno = oerrno;
-  if (scm_cur_errp == scm_def_errp)
-    {
-      if (errno > 0)
-       perror (str);
-      fflush (stderr);
-      return;
-    }
-}
-
-
-SCM_PROC(s_errno, "errno", 0, 1, 0, scm_errno);
-SCM
-scm_errno (arg)
-     SCM arg;
-{
-  int old = errno;
-  if (!SCM_UNBNDP (arg))
-    {
-      if (SCM_FALSEP (arg))
-       errno = 0;
-      else
-       errno = SCM_INUM (arg);
-    }
-  return SCM_MAKINUM (old);
-}
-
-SCM_PROC(s_perror, "perror", 1, 0, 0, scm_perror);
-SCM 
-scm_perror (arg)
-     SCM arg;
-{
-  SCM_ASSERT (SCM_NIMP (arg) && SCM_STRINGP (arg), arg, SCM_ARG1, s_perror);
-  err_head (SCM_CHARS (arg));
-  return SCM_UNSPECIFIED;
-}
-
 void (*scm_error_callback) () = 0;
 
 /* All errors should pass through here.  */
index c8c12c8..7327f27 100644 (file)
@@ -59,9 +59,6 @@ extern int scm_ints_disabled;
 #define SCM_NORETURN
 #endif
 
-
-extern SCM scm_errno SCM_P ((SCM arg));
-extern SCM scm_perror SCM_P ((SCM arg));
 extern void scm_error SCM_P ((SCM key, char *subr, char *message,
                              SCM args, SCM rest)) SCM_NORETURN;
 extern void (*scm_error_callback) SCM_P ((SCM key, char *subr,
index 9016dd2..0ab49f0 100644 (file)
@@ -773,8 +773,9 @@ scm_uname ()
   struct utsname buf;
   SCM ans = scm_make_vector(SCM_MAKINUM(5), SCM_UNSPECIFIED, SCM_BOOL_F);
   SCM *ve = SCM_VELTS (ans);
+  SCM_DEFER_INTS;
   if (uname (&buf))
-    return SCM_MAKINUM (errno);
+    scm_syserror (s_uname);
   ve[0] = scm_makfrom0str (buf.sysname);
   ve[1] = scm_makfrom0str (buf.nodename);
   ve[2] = scm_makfrom0str (buf.release);
@@ -784,6 +785,7 @@ scm_uname ()
    a linux special?
   ve[5] = scm_makfrom0str (buf.domainname);
 */
+  SCM_ALLOW_INTS;
   return ans;
 #else
   scm_sysmissing (s_uname);