From b514a325b560d0f36451050e15dd7ff985171d7b Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Tue, 7 Dec 1999 16:47:21 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'v1_4_3'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_4_3@582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'error.c') diff --git a/error.c b/error.c index 6a48210b4e..feb3778d54 100644 --- a/error.c +++ b/error.c @@ -26,6 +26,13 @@ int sys_nerr = 256; #endif +#if defined __CYGWIN__ +# include +# 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); } } @@ -432,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 -- cgit v1.2.3