sl@0: /* sl@0: * fixstrtod.c -- sl@0: * sl@0: * Source code for the "fixstrtod" procedure. This procedure is sl@0: * used in place of strtod under Solaris 2.4, in order to fix sl@0: * a bug where the "end" pointer gets set incorrectly. sl@0: * sl@0: * Copyright (c) 1995 Sun Microsystems, Inc. sl@0: * sl@0: * See the file "license.terms" for information on usage and redistribution sl@0: * of this file, and for a DISCLAIMER OF ALL WARRANTIES. sl@0: * sl@0: * RCS: @(#) $Id: fixstrtod.c,v 1.2 1998/09/14 18:39:44 stanton Exp $ sl@0: */ sl@0: sl@0: #include sl@0: sl@0: #undef strtod sl@0: sl@0: /* sl@0: * Declare strtod explicitly rather than including stdlib.h, since in sl@0: * somes systems (e.g. SunOS 4.1.4) stdlib.h doesn't declare strtod. sl@0: */ sl@0: sl@0: extern double strtod(); sl@0: sl@0: double sl@0: fixstrtod(string, endPtr) sl@0: char *string; sl@0: char **endPtr; sl@0: { sl@0: double d; sl@0: d = strtod(string, endPtr); sl@0: if ((endPtr != NULL) && (*endPtr != string) && ((*endPtr)[-1] == 0)) { sl@0: *endPtr -= 1; sl@0: } sl@0: return d; sl@0: }