summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-19 08:38:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-19 08:38:11 +0000
commitb8148f45947eee7461986536114949556f4eda40 (patch)
tree16ae7f6b7588cc228e0175fe26e4ce15be539c47 /sprintf.c
parentc613f625b7c0c72771d74f86a1177e00290577df (diff)
downloadruby-b8148f45947eee7461986536114949556f4eda40.tar.gz
2000-06-19
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sprintf.c b/sprintf.c
index 204ea145d2..a3350b4578 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -264,13 +264,15 @@ rb_f_sprintf(argc, argv)
if (flags & FPREC) {
rb_raise(rb_eArgError, "precision given twice");
}
+ flags |= FPREC;
prec = 0;
p++;
if (*p == '*') {
GETASTER(prec);
- if (prec > 0)
- flags |= FPREC;
+ if (prec < 0) { /* ignore negative precision */
+ flags &= ~FPREC;
+ }
p++;
goto retry;
}
@@ -281,8 +283,6 @@ rb_f_sprintf(argc, argv)
if (p >= end) {
rb_raise(rb_eArgError, "malformed format string - %%.[0-9]");
}
- if (prec > 0)
- flags |= FPREC;
goto retry;
case '\n':