| Line | |
|---|
| 1 | /* |
|---|
| 2 | * fixstrtod.c -- |
|---|
| 3 | * |
|---|
| 4 | * Source code for the "fixstrtod" procedure. This procedure is |
|---|
| 5 | * used in place of strtod under Solaris 2.4, in order to fix |
|---|
| 6 | * a bug where the "end" pointer gets set incorrectly. |
|---|
| 7 | * |
|---|
| 8 | * Copyright (c) 1995 Sun Microsystems, Inc. |
|---|
| 9 | * |
|---|
| 10 | * See the file "license.terms" for information on usage and redistribution |
|---|
| 11 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
|---|
| 12 | * |
|---|
| 13 | * RCS: @(#) $Id: fixstrtod.c,v 1.3 2007/04/16 13:36:34 dkf Exp $ |
|---|
| 14 | */ |
|---|
| 15 | |
|---|
| 16 | #include <stdio.h> |
|---|
| 17 | |
|---|
| 18 | #undef strtod |
|---|
| 19 | |
|---|
| 20 | /* |
|---|
| 21 | * Declare strtod explicitly rather than including stdlib.h, since in |
|---|
| 22 | * somes systems (e.g. SunOS 4.1.4) stdlib.h doesn't declare strtod. |
|---|
| 23 | */ |
|---|
| 24 | |
|---|
| 25 | extern double strtod(char *, char **); |
|---|
| 26 | |
|---|
| 27 | double |
|---|
| 28 | fixstrtod( |
|---|
| 29 | char *string, |
|---|
| 30 | char **endPtr) |
|---|
| 31 | { |
|---|
| 32 | double d; |
|---|
| 33 | d = strtod(string, endPtr); |
|---|
| 34 | if ((endPtr != NULL) && (*endPtr != string) && ((*endPtr)[-1] == 0)) { |
|---|
| 35 | *endPtr -= 1; |
|---|
| 36 | } |
|---|
| 37 | return d; |
|---|
| 38 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.