diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-10-16 10:33:06 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-10-16 10:33:06 +0000 |
commit | 40a3f601e43a137e56b2c28454ffb6ce79d7ec7e (patch) | |
tree | cf4e94cab7bee1f0e15d9ab8d1885fb0739fb408 /error.c | |
parent | 3196645aee3add70a33f3d926d1d6e3820d39377 (diff) | |
download | ruby-40a3f601e43a137e56b2c28454ffb6ce79d7ec7e.tar.gz |
ruby -v
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -34,14 +34,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); } } |