summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sprintf.c b/sprintf.c
index 3c09a8ed2a..71e5488bce 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -6,14 +6,22 @@
$Date$
created at: Fri Oct 15 10:39:26 JST 1993
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-1999 Yukihiro Matsumoto
************************************************/
#include "ruby.h"
#include <ctype.h>
+#ifndef atof
+double strtod();
+#endif
+
+#ifdef USE_CWGUSI
+static void fmt_setup();
+#else
static void fmt_setup _((char*,char,int,int,int));
+#endif
static char*
remove_sign_bits(str, base)
@@ -548,6 +556,7 @@ rb_f_sprintf(argc, argv)
case 'f':
case 'g':
+ case 'G':
case 'e':
case 'E':
{
@@ -566,7 +575,7 @@ rb_f_sprintf(argc, argv)
fval = rb_big2dbl(val);
break;
case T_STRING:
- fval = atof(RSTRING(val)->ptr);
+ fval = strtod(RSTRING(val)->ptr, 0);
break;
default:
Check_Type(val, T_FLOAT);
@@ -585,7 +594,7 @@ rb_f_sprintf(argc, argv)
}
sprint_exit:
- if (RTEST(rb_verbose) && argc > 1) {
+ if (RTEST(ruby_verbose) && argc > 1) {
rb_raise(rb_eArgError, "too many argument for format string");
}
result = rb_str_new(buf, blen);