From 69a3aaf154948d653fa3653cd2b3c3b3af979769 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 1 Sep 1999 09:48:03 +0000 Subject: regexp literal (e.g. \202) match, etc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sprintf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sprintf.c') diff --git a/sprintf.c b/sprintf.c index c3a2772e67..3c71e9771f 100644 --- a/sprintf.c +++ b/sprintf.c @@ -23,7 +23,7 @@ double strtod(); #ifdef USE_CWGUSI static void fmt_setup(); #else -static void fmt_setup _((char*,char,int,int,int)); +static void fmt_setup _((char*,int,int,int,int)); #endif static char* @@ -263,6 +263,9 @@ rb_f_sprintf(argc, argv) p--; case '\0': case '%': + if (flags != FNONE) { + rb_raise(rb_eArgError, "illegal format character - %%"); + } PUSH("%", 1); break; @@ -620,7 +623,8 @@ rb_f_sprintf(argc, argv) static void fmt_setup(buf, c, flags, width, prec) - char *buf, c; + char *buf; + int c; int flags, width, prec; { *buf++ = '%'; -- cgit v1.2.3