/* -*-C-*-
-$Id: bchutl.c,v 1.12 2002/11/20 19:46:07 cph Exp $
+$Id: bchutl.c,v 1.13 2002/11/20 20:49:46 cph Exp $
-Copyright (c) 1991-2000 Massachusetts Institute of Technology
+Copyright (c) 1991-2000, 2002 Massachusetts Institute of Technology
This file is part of MIT Scheme.
# include <unistd.h>
#endif
\f
+#ifdef HAVE_STRERROR
+
+char *
+DEFUN (error_name, (code), int code)
+{
+ static char buf [512];
+ sprintf (buf, "%d, %s", code, (strerror (code)));
+ return (buf);
+}
+
+#else /* not HAVE_STRERROR */
#ifdef __WIN32__
#define lseek _lseek
char *
DEFUN (error_name, (code), int code)
{
- static char buf[512];
-
- sprintf (&buf[0], "%d, unknown error", code);
- return (&buf[0]);
+ static char buf [512];
+ sprintf (buf, "%d, unknown error", code);
+ return (buf);
}
#else /* not __WIN32__ */
#ifdef __OS2__
#if defined(__IBMC__) || defined(__WATCOMC__) || defined(__EMX__)
-#include <io.h>
+# include <io.h>
#endif
char *
DEFUN (error_name, (code), int code)
{
static char buf [512];
- sprintf ((&buf[0]), "%d, unknown error", code);
- return (&buf[0]);
+ sprintf (buf, "%d, unknown error", code);
+ return (buf);
}
#else /* not __OS2__ */
char *
DEFUN (error_name, (code), int code)
{
- static char buf[512];
-
+ static char buf [512];
if ((code >= 0) && (code <= sys_nerr))
- sprintf (&buf[0], "%d, %s", code, sys_errlist[code]);
+ sprintf (buf, "%d, %s", code, sys_errlist[code]);
else
- sprintf (&buf[0], "%d, unknown error", code);
- return (&buf[0]);
+ sprintf (buf, "%d, unknown error", code);
+ return (buf);
}
#endif /* not __OS2__ */
#endif /* not __WIN32__ */
+#endif /* not HAVE_STRERROR */
#ifndef SEEK_SET
-#define SEEK_SET 0
+# define SEEK_SET 0
#endif
int
/* -*-C-*-
-$Id: uxtop.c,v 1.26 2002/11/20 19:46:15 cph Exp $
+$Id: uxtop.c,v 1.27 2002/11/20 20:49:57 cph Exp $
-Copyright (c) 1990-2000 Massachusetts Institute of Technology
+Copyright (c) 1990-2000, 2002 Massachusetts Institute of Technology
This file is part of MIT Scheme.
}
}
+#ifdef HAVE_STRERROR
+
+CONST char *
+DEFUN (OS_error_code_to_message, (syserr), unsigned int syserr)
+{
+ return (strerror (syserr_to_error_code ((enum syserr_names) syserr)));
+}
+
+#else /* not HAVE_STRERROR */
+
#ifdef __HPUX__
-#define NEED_ERRLIST_DEFINITIONS
+# define NEED_ERRLIST_DEFINITIONS
#endif
#ifdef NEED_ERRLIST_DEFINITIONS
-extern char * sys_errlist [];
-extern int sys_nerr;
+ extern char * sys_errlist [];
+ extern int sys_nerr;
#endif
CONST char *
int code = (syserr_to_error_code ((enum syserr_names) syserr));
return (((code > 0) && (code <= sys_nerr)) ? (sys_errlist [code]) : 0);
}
+
+#endif /* not HAVE_STRERROR */
\f
static char * syscall_names_table [] =
{