summaryrefslogtreecommitdiff
path: root/lib/c-strtod.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-11-27 07:46:01 +0000
committerJim Meyering <jim@meyering.net>2003-11-27 07:46:01 +0000
commitab5dba9e1b6351f0c9a4eb3fdacae5ede216078c (patch)
tree81d1a35db1c7c8c7f57d110779daf96f562cb321 /lib/c-strtod.c
parent5564a80c71d5b039d4da5f981f8743c735822c0d (diff)
downloadcoreutils-ab5dba9e1b6351f0c9a4eb3fdacae5ede216078c.tar.xz
new files, from Paul Eggert
Diffstat (limited to 'lib/c-strtod.c')
-rw-r--r--lib/c-strtod.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/c-strtod.c b/lib/c-strtod.c
new file mode 100644
index 000000000..b3fac020a
--- /dev/null
+++ b/lib/c-strtod.c
@@ -0,0 +1,34 @@
+/* Convert string to double, using the C locale.
+
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Written by Paul Eggert. */
+
+#include "c-strtod.h"
+
+#include <locale.h>
+#include <stdlib.h>
+
+double
+c_strtod (char const *nptr, char **endptr)
+{
+ double r;
+ setlocale (LC_NUMERIC, "C");
+ r = strtod (nptr, endptr);
+ setlocale (LC_NUMERIC, "");
+ return r;
+}