summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/error.c b/error.c
index 6a48210b4e..f528eccacd 100644
--- a/error.c
+++ b/error.c
@@ -6,7 +6,7 @@
$Date$
created at: Mon Aug 9 16:11:34 JST 1993
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
@@ -26,6 +26,13 @@
int sys_nerr = 256;
#endif
+#if defined __CYGWIN__
+# include <cygwin/version.h>
+# if (CYGWIN_VERSION_API_MAJOR > 0) || (CYGWIN_VERSION_API_MINOR >= 8)
+# define sys_nerr _sys_nerr
+# endif
+#endif
+
int ruby_nerrs;
static void
@@ -34,14 +41,20 @@ err_snprintf(buf, len, fmt, args)
int len;
va_list args;
{
+ int n;
+
if (!ruby_sourcefile) {
vsnprintf(buf, len, fmt, args);
+ return;
+ }
+ else if (ruby_sourceline == 0) {
+ n = snprintf(buf, len, "%s: ", ruby_sourcefile);
}
else {
- int n = snprintf(buf, len, "%s:%d: ", ruby_sourcefile, ruby_sourceline);
- if (len > n) {
- vsnprintf((char*)buf+n, len-n, fmt, args);
- }
+ n = snprintf(buf, len, "%s:%d: ", ruby_sourcefile, ruby_sourceline);
+ }
+ if (len > n) {
+ vsnprintf((char*)buf+n, len-n, fmt, args);
}
}
@@ -373,6 +386,7 @@ check_backtrace(bt)
static VALUE
exc_set_backtrace(exc, bt)
VALUE exc;
+ VALUE bt;
{
return rb_iv_set(exc, "bt", check_backtrace(bt));
}
@@ -432,7 +446,7 @@ static const syserr_index_entry syserr_index[]= {
static VALUE *syserr_list;
#endif
-#ifndef NT
+#if !defined NT && !defined sys_nerr
extern int sys_nerr;
#endif