Module Name:    src
Committed By:   snj
Date:           Sun Jul 26 18:40:36 UTC 2009

Modified Files:
        src/lib/libc/stdlib [netbsd-5-0]: strtol.3 strtoul.3

Log Message:
Pull up following revision(s) (requested by dholland in ticket #868):
        lib/libc/stdlib/strtol.3: revisions 1.25, 1.26
        lib/libc/stdlib/strtoul.3: revisions 1.22, 1.23
Clarify the description of the errno behavior, based on the recent
thread in tech-userlevel.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.44.1 src/lib/libc/stdlib/strtol.3
cvs rdiff -u -r1.19 -r1.19.44.1 src/lib/libc/stdlib/strtoul.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdlib/strtol.3
diff -u src/lib/libc/stdlib/strtol.3:1.22 src/lib/libc/stdlib/strtol.3:1.22.44.1
--- src/lib/libc/stdlib/strtol.3:1.22	Mon Sep  8 17:54:33 2003
+++ src/lib/libc/stdlib/strtol.3	Sun Jul 26 18:40:36 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strtol.3,v 1.22 2003/09/08 17:54:33 wiz Exp $
+.\"	$NetBSD: strtol.3,v 1.22.44.1 2009/07/26 18:40:36 snj Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\"     from: @(#)strtol.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd August 11, 2002
+.Dd July 23, 2009
 .Dt STRTOL 3
 .Os
 .Sh NAME
@@ -186,17 +186,22 @@
 .Va errno
 is set to
 .Er ERANGE .
+.Pp
+If no error occurs,
+.Va errno
+is left unchanged.
+This behavior (which is unlike most library functions) is guaranteed
+by the pertinent standards.
 .Sh EXAMPLES
-Ensuring that a string is a valid number (i.e., in range and containing no
-trailing characters) requires clearing
+Because the return value of
+.Fn strtol
+cannot be used unambiguously to detect an error,
 .Va errno
-beforehand explicitly since
+is left unchanged after a successful call.
+To ensure that a string is a valid number (i.e., in range and containing no
+trailing characters), clear
 .Va errno
-is not changed on a successful call to
-.Fn strtol ,
-and the return value of
-.Fn strtol
-cannot be used unambiguously to signal an error:
+beforehand explicitly, then check it afterwards:
 .Bd -literal -offset indent
 char *ep;
 long lval;

Index: src/lib/libc/stdlib/strtoul.3
diff -u src/lib/libc/stdlib/strtoul.3:1.19 src/lib/libc/stdlib/strtoul.3:1.19.44.1
--- src/lib/libc/stdlib/strtoul.3:1.19	Mon Sep  8 17:54:33 2003
+++ src/lib/libc/stdlib/strtoul.3	Sun Jul 26 18:40:36 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strtoul.3,v 1.19 2003/09/08 17:54:33 wiz Exp $
+.\"	$NetBSD: strtoul.3,v 1.19.44.1 2009/07/26 18:40:36 snj Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\"     from: @(#)strtoul.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd August 11, 2002
+.Dd July 23, 2009
 .Dt STRTOUL 3
 .Os
 .Sh NAME
@@ -184,17 +184,22 @@
 examining the string in
 .Fa nptr
 directly.
+.Pp
+If no error occurs,
+.Va errno
+is left unchanged.
+This behavior (which is unlike most library functions) is guaranteed
+by the pertinent standards.
 .Sh EXAMPLES
-Ensuring that a string is a valid number (i.e., in range and containing no
-trailing characters) requires clearing
+Because the return value of
+.Fn strtoul
+cannot be used unambiguously to detect an error,
 .Va errno
-beforehand explicitly since
+is left unchanged after a successful call.
+To ensure that a string is a valid number (i.e., in range and containing no
+trailing characters), clear
 .Va errno
-is not changed on a successful call to
-.Fn strtoul ,
-and the return value of
-.Fn strtoul
-cannot be used unambiguously to signal an error:
+beforehand explicitly, then check it afterwards:
 .Bd -literal -offset indent
 char *ep;
 unsigned long ulval;

Reply via email to