os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/compat/fixstrtod.c
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/* 
sl@0
     2
 * fixstrtod.c --
sl@0
     3
 *
sl@0
     4
 *	Source code for the "fixstrtod" procedure.  This procedure is
sl@0
     5
 *	used in place of strtod under Solaris 2.4, in order to fix
sl@0
     6
 *	a bug where the "end" pointer gets set incorrectly.
sl@0
     7
 *
sl@0
     8
 * Copyright (c) 1995 Sun Microsystems, Inc.
sl@0
     9
 *
sl@0
    10
 * See the file "license.terms" for information on usage and redistribution
sl@0
    11
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
sl@0
    12
 *
sl@0
    13
 * RCS: @(#) $Id: fixstrtod.c,v 1.2 1998/09/14 18:39:44 stanton Exp $
sl@0
    14
 */
sl@0
    15
sl@0
    16
#include <stdio.h>
sl@0
    17
sl@0
    18
#undef strtod
sl@0
    19
sl@0
    20
/*
sl@0
    21
 * Declare strtod explicitly rather than including stdlib.h, since in
sl@0
    22
 * somes systems (e.g. SunOS 4.1.4) stdlib.h doesn't declare strtod.
sl@0
    23
 */
sl@0
    24
sl@0
    25
extern double strtod();
sl@0
    26
sl@0
    27
double
sl@0
    28
fixstrtod(string, endPtr)
sl@0
    29
    char *string;
sl@0
    30
    char **endPtr;
sl@0
    31
{
sl@0
    32
    double d;
sl@0
    33
    d = strtod(string, endPtr);
sl@0
    34
    if ((endPtr != NULL) && (*endPtr != string) && ((*endPtr)[-1] == 0)) {
sl@0
    35
	*endPtr -= 1;
sl@0
    36
    }
sl@0
    37
    return d;
sl@0
    38
}