os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/compat/fixstrtod.c
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/compat/fixstrtod.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,38 @@
1.4 +/*
1.5 + * fixstrtod.c --
1.6 + *
1.7 + * Source code for the "fixstrtod" procedure. This procedure is
1.8 + * used in place of strtod under Solaris 2.4, in order to fix
1.9 + * a bug where the "end" pointer gets set incorrectly.
1.10 + *
1.11 + * Copyright (c) 1995 Sun Microsystems, Inc.
1.12 + *
1.13 + * See the file "license.terms" for information on usage and redistribution
1.14 + * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.15 + *
1.16 + * RCS: @(#) $Id: fixstrtod.c,v 1.2 1998/09/14 18:39:44 stanton Exp $
1.17 + */
1.18 +
1.19 +#include <stdio.h>
1.20 +
1.21 +#undef strtod
1.22 +
1.23 +/*
1.24 + * Declare strtod explicitly rather than including stdlib.h, since in
1.25 + * somes systems (e.g. SunOS 4.1.4) stdlib.h doesn't declare strtod.
1.26 + */
1.27 +
1.28 +extern double strtod();
1.29 +
1.30 +double
1.31 +fixstrtod(string, endPtr)
1.32 + char *string;
1.33 + char **endPtr;
1.34 +{
1.35 + double d;
1.36 + d = strtod(string, endPtr);
1.37 + if ((endPtr != NULL) && (*endPtr != string) && ((*endPtr)[-1] == 0)) {
1.38 + *endPtr -= 1;
1.39 + }
1.40 + return d;
1.41 +}