|
@ -33,7 +33,7 @@ |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" SUCH DAMAGE. |
|
|
.\" SUCH DAMAGE. |
|
|
.\" |
|
|
.\" |
|
|
.\" $OpenBSD: atoi.3,v 1.3 1999/06/29 18:36:18 aaron Exp $ |
|
|
|
|
|
|
|
|
.\" $OpenBSD: atoi.3,v 1.4 1999/09/13 07:14:13 deraadt Exp $ |
|
|
.\" |
|
|
.\" |
|
|
.Dd June 4, 1993 |
|
|
.Dd June 4, 1993 |
|
|
.Dt ATOI 3 |
|
|
.Dt ATOI 3 |
|
@ -60,6 +60,17 @@ It is equivalent to: |
|
|
.Bd -literal -offset indent |
|
|
.Bd -literal -offset indent |
|
|
(int)strtol(nptr, (char **)NULL, 10); |
|
|
(int)strtol(nptr, (char **)NULL, 10); |
|
|
.Ed |
|
|
.Ed |
|
|
|
|
|
.Sh CAVEATS |
|
|
|
|
|
.Nm |
|
|
|
|
|
does no overflow checking, handles unsigned numbers poorly, |
|
|
|
|
|
and handles strings containing trailing extra characters |
|
|
|
|
|
(like |
|
|
|
|
|
.Dq "123abc" Ns ) |
|
|
|
|
|
poorly. Careful use of |
|
|
|
|
|
.Xr strtol 3 |
|
|
|
|
|
and |
|
|
|
|
|
.Xr strtoul 3 |
|
|
|
|
|
can alleviate these problems. |
|
|
.Sh SEE ALSO |
|
|
.Sh SEE ALSO |
|
|
.Xr atof 3 , |
|
|
.Xr atof 3 , |
|
|
.Xr atol 3 , |
|
|
.Xr atol 3 , |
|
|