Bug 126487

Summary: fix language on atol(3) manpage
Product: Documentation Reporter: edwin
Component: Books & ArticlesAssignee: Giorgos Keramidas <keramida>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description edwin 2008-08-13 02:10:01 UTC
Man page now says:

  ERRORS
       The functions atol() and atoll() need not affect the value
       of errno on an error.

That line doesn't make sense, it should be replaced with:

  ERRORS
       The functions atol() and atoll() do not affect the value
       of errno on an error.

or

  ERRORS
       The functions atol() and atoll() do not affect the value
       of errno in case of an error.
Comment 1 newsonia 2008-08-14 13:36:14 UTC
You should change ports packet or upate your Ports
Comment 2 Giorgos Keramidas freebsd_committer freebsd_triage 2009-01-27 00:05:37 UTC
Responsible Changed
From-To: freebsd-doc->keramida

I'll handle this one.
Comment 3 Giorgos Keramidas freebsd_committer freebsd_triage 2009-02-01 06:21:15 UTC
On Wed, 13 Aug 2008 11:06:47 +1000 (EST), Edwin Groothuis <edwin@mavetju.org> wrote:
> After discussions with bjk on #bsddocs:
>
> If, for some reason, it *might* change it, then it should read:
>
>   ERRORS
>        The functions atol() and atoll() might affect the value of
>        errno in case of an error.

Hi Edwin,

AFAICT, our atol() and atoll() functions are just thin wrappers around
strtol() and strtoll() respectively.

Does the following look 'ok' as a change that clarifies what the
standards say about atol/atoll and what our own version does?

%%%
diff -r d060dd4c20d0 lib/libc/stdlib/atol.3
--- a/lib/libc/stdlib/atol.3	Sat Jan 31 10:27:14 2009 +0200
+++ b/lib/libc/stdlib/atol.3	Sun Feb 01 08:20:47 2009 +0200
@@ -78,13 +78,41 @@
 It is equivalent to:
 .Pp
 .Dl "strtoll(nptr, (char **)NULL, 10);"
+.Sh COMPATIBILITY
+The
+.Fx implementation of the
+.Fn atol
+and
+.Fn atoll
+functions is a thin wrapper around
+.Fn strtol
+and
+.Fn stroll
+respectively, so these functions may affect the value of
+.Va errno
+in the same ways that
+.Fn strtol
+and
+.Fn stroll
+is permitted to change it.
+This behavior of
+.Fn atol
+and
+.Fn atoll
+is not required by
+.St -isoC
+or
+.St -isoC-c99 ,
+but it is allowed by all of
+.St -isoC , St -isoC-99
+and
+.St -p1003.1-2001 .
 .Sh ERRORS
 The functions
 .Fn atol
 and
 .Fn atoll
-need not
-affect the value of
+may affect the value of
 .Va errno
 on an error.
 .Sh SEE ALSO
%%%
Comment 4 Giorgos Keramidas freebsd_committer freebsd_triage 2009-02-08 08:27:08 UTC
State Changed
From-To: open->patched

Fixed by change 188305 in /head.
Comment 5 dfilter service freebsd_committer freebsd_triage 2009-02-08 08:27:13 UTC
Author: keramida (doc committer)
Date: Sun Feb  8 08:26:58 2009
New Revision: 188305
URL: http://svn.freebsd.org/changeset/base/188305

Log:
  Fix language on atol(3) manpage.  Add a COMPATIBILITY section
  stating that in FreeBSD the atol() and atoll() functions affect
  errno in the same way as strtol() and stroll().
  
  PR:		docs/126487
  Submitted by:	edwin
  Reviewed by:	trhodes, gabor
  MFC after:	1 week

Modified:
  head/lib/libc/stdlib/atol.3

Modified: head/lib/libc/stdlib/atol.3
==============================================================================
--- head/lib/libc/stdlib/atol.3	Sun Feb  8 08:13:36 2009	(r188304)
+++ head/lib/libc/stdlib/atol.3	Sun Feb  8 08:26:58 2009	(r188305)
@@ -32,7 +32,7 @@
 .\"     @(#)atol.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd November 28, 2001
+.Dd February 1, 2009
 .Dt ATOL 3
 .Os
 .Sh NAME
@@ -78,13 +78,42 @@ representation.
 It is equivalent to:
 .Pp
 .Dl "strtoll(nptr, (char **)NULL, 10);"
+.Sh COMPATIBILITY
+The
+.Fx
+implementations of the
+.Fn atol
+and
+.Fn atoll
+functions are thin wrappers around
+.Fn strtol
+and
+.Fn stroll
+respectively, so these functions will affect the value of
+.Va errno
+in the same way that the
+.Fn strtol
+and
+.Fn stroll
+functions are able to.
+This behavior of
+.Fn atol
+and
+.Fn atoll
+is not required by
+.St -isoC
+or
+.St -isoC-c99 ,
+but it is allowed by all of
+.St -isoC , St -isoC-99
+and
+.St -p1003.1-2001 .
 .Sh ERRORS
 The functions
 .Fn atol
 and
 .Fn atoll
-need not
-affect the value of
+may affect the value of
 .Va errno
 on an error.
 .Sh SEE ALSO
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 6 Giorgos Keramidas freebsd_committer freebsd_triage 2011-02-15 07:05:18 UTC
State Changed
From-To: patched->closed

Fixed in stable/7 and stable/8 too now.