diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-11-24 07:13:53 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-11-24 07:13:53 +0000 |
commit | 9031679facdaf5fff73afc68683b53ae34fc3f44 (patch) | |
tree | a4a41211bac9c651e93bc4e8553ce4489eaac1a9 /error.c | |
parent | b1d45b805c22e9dba70400100aa080c515e0f2c9 (diff) |
19991124-1.4.3pre1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -26,8 +26,11 @@ int sys_nerr = 256; #endif -#if defined __CYGWIN__ && defined _sys_nerr -#define sys_nerr _sys_nerr +#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; @@ -38,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); } } @@ -436,7 +445,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 |