From 6b7d41f8c5a19961e127bc5168f899e7da8fee47 Mon Sep 17 00:00:00 2001 From: landry <> Date: Fri, 13 Jun 2008 21:04:24 +0000 Subject: Add strtof() to libc, some ports seem to like it. Currently it's a simple call to strtod() with bounding check. Discussed with pyr@ and otto@ ok otto@ deraadt@ --- src/lib/libc/stdlib/strtod.3 | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/lib/libc/stdlib/strtod.3') diff --git a/src/lib/libc/stdlib/strtod.3 b/src/lib/libc/stdlib/strtod.3 index 504307a624..3d8b2e07a0 100644 --- a/src/lib/libc/stdlib/strtod.3 +++ b/src/lib/libc/stdlib/strtod.3 @@ -29,21 +29,25 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: strtod.3,v 1.10 2007/11/11 12:23:36 tobias Exp $ +.\" $OpenBSD: strtod.3,v 1.11 2008/06/13 21:04:24 landry Exp $ .\" -.Dd $Mdocdate: November 11 2007 $ +.Dd $Mdocdate: June 13 2008 $ .Dt STRTOD 3 .Os .Sh NAME -.Nm strtod +.Nm strtod , +.Nm strtof .Nd convert .Tn ASCII -string to double +string to double or float .Sh SYNOPSIS .Fd #include .Fd #include .Ft double .Fn strtod "const char *nptr" "char **endptr" +.Pp +.Ft float +.Fn strtof "const char *nptr" "char **endptr" .Sh DESCRIPTION The .Fn strtod @@ -52,6 +56,13 @@ function converts the initial portion of the string pointed to by to .Li double representation. +The +.Fn strtof +function converts the initial portion of the string pointed to by +.Fa nptr +to +.Li float +representation. .Pp The expected form of the string is an optional plus .Pq Ql + @@ -71,7 +82,9 @@ function) are skipped. .Sh RETURN VALUES The .Fn strtod -function returns the converted value, if any. +and +.Fn strtof +functions returns the converted value, if any. .Pp If .Fa endptr @@ -110,5 +123,7 @@ Overflow or underflow occurred. .Sh STANDARDS The .Fn strtod -function conforms to +and +.Fn strtof +functions conforms to .St -ansiC . -- cgit v1.2.3-55-g6feb