22 |
This exception does not however invalidate any other reasons why |
This exception does not however invalidate any other reasons why |
23 |
the executable file might be covered by the GNU General Public License. */ |
the executable file might be covered by the GNU General Public License. */ |
24 |
|
|
25 |
#include <ctype.h> |
#include "ansidecl.h" |
26 |
|
#include "safe-ctype.h" |
27 |
|
|
28 |
extern double atof (); |
extern double atof (); |
29 |
|
|
43 |
|
|
44 |
p = str; |
p = str; |
45 |
|
|
46 |
while (isspace (*p)) |
while (ISSPACE (*p)) |
47 |
++p; |
++p; |
48 |
|
|
49 |
if (*p == '+' || *p == '-') |
if (*p == '+' || *p == '-') |
89 |
} |
} |
90 |
|
|
91 |
/* digits, with 0 or 1 periods in it. */ |
/* digits, with 0 or 1 periods in it. */ |
92 |
if (isdigit (*p) || *p == '.') |
if (ISDIGIT (*p) || *p == '.') |
93 |
{ |
{ |
94 |
int got_dot = 0; |
int got_dot = 0; |
95 |
while (isdigit (*p) || (!got_dot && *p == '.')) |
while (ISDIGIT (*p) || (!got_dot && *p == '.')) |
96 |
{ |
{ |
97 |
if (*p == '.') |
if (*p == '.') |
98 |
got_dot = 1; |
got_dot = 1; |
106 |
i = 1; |
i = 1; |
107 |
if (p[i] == '+' || p[i] == '-') |
if (p[i] == '+' || p[i] == '-') |
108 |
++i; |
++i; |
109 |
if (isdigit (p[i])) |
if (ISDIGIT (p[i])) |
110 |
{ |
{ |
111 |
while (isdigit (p[i])) |
while (ISDIGIT (p[i])) |
112 |
++i; |
++i; |
113 |
*ptr = p + i; |
*ptr = p + i; |
114 |
return atof (str); |
return atof (str); |