Back out errno preserving
This commit is contained in:
parent
c79d7cebd4
commit
a6e7c78be5
@ -64,8 +64,6 @@ It is equivalent to:
|
||||
strtod(nptr, (char **)NULL);
|
||||
.Ed
|
||||
.Pp
|
||||
except the handling of errors.
|
||||
.Pp
|
||||
The decimal point
|
||||
character is defined in the program's locale (category
|
||||
.Dv LC_NUMERIC ) .
|
||||
@ -80,9 +78,9 @@ function has been deprecated by
|
||||
.Fn strtod
|
||||
and should not be used in new code.
|
||||
.Sh ERRORS
|
||||
The
|
||||
The function
|
||||
.Fn atof
|
||||
function does not detect errors.
|
||||
need not affect the value of errno on an error.
|
||||
.Sh SEE ALSO
|
||||
.Xr atoi 3 ,
|
||||
.Xr atol 3 ,
|
||||
|
@ -37,18 +37,11 @@
|
||||
static char sccsid[] = "@(#)atof.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
double
|
||||
atof(ascii)
|
||||
const char *ascii;
|
||||
{
|
||||
double r;
|
||||
int saverr;
|
||||
|
||||
saverr = errno;
|
||||
r = strtod(ascii, (char **)NULL);
|
||||
errno = saverr;
|
||||
return r;
|
||||
return strtod(ascii, (char **)NULL);
|
||||
}
|
||||
|
@ -63,8 +63,6 @@ It is equivalent to:
|
||||
.Bd -literal -offset indent
|
||||
(int)strtol(nptr, (char **)NULL, 10);
|
||||
.Ed
|
||||
.Pp
|
||||
except the handling of errors.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
The
|
||||
.Fn atoi
|
||||
@ -76,9 +74,9 @@ function has been deprecated by
|
||||
.Fn strtol
|
||||
and should not be used in new code.
|
||||
.Sh ERRORS
|
||||
The
|
||||
The function
|
||||
.Fn atoi
|
||||
function does not detect errors.
|
||||
need not affect the value of errno on an error.
|
||||
.Sh SEE ALSO
|
||||
.Xr atof 3 ,
|
||||
.Xr atol 3 ,
|
||||
|
@ -37,17 +37,11 @@
|
||||
static char sccsid[] = "@(#)atoi.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
atoi(str)
|
||||
const char *str;
|
||||
{
|
||||
int r, saverr;
|
||||
|
||||
saverr = errno;
|
||||
r = (int)strtol(str, (char **)NULL, 10);
|
||||
errno = saverr;
|
||||
return r;
|
||||
return (int)strtol(str, (char **)NULL, 10);
|
||||
}
|
||||
|
@ -70,8 +70,6 @@ It is equivalent to:
|
||||
.Pp
|
||||
.Dl "strtol(nptr, (char **)NULL, 10);"
|
||||
.Pp
|
||||
except the handling of errors.
|
||||
.Pp
|
||||
The
|
||||
.Fn atoll
|
||||
function converts the initial portion of the string pointed to by
|
||||
@ -84,15 +82,13 @@ representation.
|
||||
It is equivalent to:
|
||||
.Pp
|
||||
.Dl "strtoll(nptr, (char **)NULL, 10);"
|
||||
.Pp
|
||||
except the handling of errors.
|
||||
.Sh ERRORS
|
||||
The
|
||||
The functions
|
||||
.Fn atol
|
||||
function does not detect errors.
|
||||
The
|
||||
and
|
||||
.Fn atoll
|
||||
function does not detect errors.
|
||||
need not
|
||||
affect the value of errno on an error.
|
||||
.Sh SEE ALSO
|
||||
.Xr atof 3 ,
|
||||
.Xr atoi 3 ,
|
||||
|
@ -37,18 +37,11 @@
|
||||
static char sccsid[] = "@(#)atol.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
long
|
||||
atol(str)
|
||||
const char *str;
|
||||
{
|
||||
long r;
|
||||
int saverr;
|
||||
|
||||
saverr = errno;
|
||||
r = strtol(str, (char **)NULL, 10);
|
||||
errno = saverr;
|
||||
return r;
|
||||
return strtol(str, (char **)NULL, 10);
|
||||
}
|
||||
|
@ -33,18 +33,11 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
long long
|
||||
atoll(str)
|
||||
const char *str;
|
||||
{
|
||||
long long r;
|
||||
int saverr;
|
||||
|
||||
saverr = errno;
|
||||
r = strtoll(str, (char **)NULL, 10);
|
||||
errno = saverr;
|
||||
return r;
|
||||
return strtoll(str, (char **)NULL, 10);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user