From a574455a13b6702c818ef58f706f68e3533d8640 Mon Sep 17 00:00:00 2001 From: Gary Houston Date: Sat, 15 Mar 1997 18:10:35 +0000 Subject: [PATCH] * 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. --- libguile/ChangeLog | 12 +++++++++ libguile/async.c | 5 +++- libguile/error.c | 62 ---------------------------------------------- libguile/error.h | 3 --- libguile/posix.c | 4 ++- 5 files changed, 19 insertions(+), 67 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 710edf81e..035267c0e 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,15 @@ +Sat Mar 15 01:11:40 1997 Gary Houston + + * 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 * acconfig.h: Removed PACKAGE. diff --git a/libguile/async.c b/libguile/async.c index d2478fd65..115cc8c2f 100644 --- a/libguile/async.c +++ b/libguile/async.c @@ -84,7 +84,10 @@ * */ - +/* 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; diff --git a/libguile/error.c b/libguile/error.c index cab5c0d28..a2a8c7fcd 100644 --- a/libguile/error.c +++ b/libguile/error.c @@ -58,70 +58,8 @@ */ -/* 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. */ diff --git a/libguile/error.h b/libguile/error.h index c8c12c88b..7327f27d6 100644 --- a/libguile/error.h +++ b/libguile/error.h @@ -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, diff --git a/libguile/posix.c b/libguile/posix.c index 9016dd2d6..0ab49f05b 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -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);