From ab5dba9e1b6351f0c9a4eb3fdacae5ede216078c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 27 Nov 2003 07:46:01 +0000 Subject: new files, from Paul Eggert --- lib/c-strtod.c | 34 ++++++++++++++++++++++++++++++++++ lib/c-strtod.h | 1 + 2 files changed, 35 insertions(+) create mode 100644 lib/c-strtod.c create mode 100644 lib/c-strtod.h 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 +#include + +double +c_strtod (char const *nptr, char **endptr) +{ + double r; + setlocale (LC_NUMERIC, "C"); + r = strtod (nptr, endptr); + setlocale (LC_NUMERIC, ""); + return r; +} diff --git a/lib/c-strtod.h b/lib/c-strtod.h new file mode 100644 index 000000000..f16dbc118 --- /dev/null +++ b/lib/c-strtod.h @@ -0,0 +1 @@ +double c_strtod (char const *, char **); -- cgit v1.2.3-54-g00ecf