mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ruby -v
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3196645aee
commit
40a3f601e4
6 changed files with 53 additions and 28 deletions
14
error.c
14
error.c
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue