Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/man/man3 Document <stdlib.h>.



details:   https://anonhg.NetBSD.org/src/rev/30bb5ff3e809
branches:  trunk
changeset: 753379:30bb5ff3e809
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu Mar 25 06:56:20 2010 +0000

description:
Document <stdlib.h>.

Written with minimum maintenance costs in mind; only the defined types and
macros are described.

diffstat:

 share/man/man3/Makefile   |    4 +-
 share/man/man3/stddef.3   |    5 +-
 share/man/man3/stdlib.3   |  108 ++++++++++++++++++++++++++++++++++++++++++++++
 share/man/man3/sysexits.3 |   28 +++++++----
 4 files changed, 130 insertions(+), 15 deletions(-)

diffs (209 lines):

diff -r 0a86ef56defa -r 30bb5ff3e809 share/man/man3/Makefile
--- a/share/man/man3/Makefile   Thu Mar 25 01:15:00 2010 +0000
+++ b/share/man/man3/Makefile   Thu Mar 25 06:56:20 2010 +0000
@@ -1,10 +1,10 @@
-#      $NetBSD: Makefile,v 1.45 2010/03/21 21:23:51 jruoho Exp $
+#      $NetBSD: Makefile,v 1.46 2010/03/25 06:56:20 jruoho Exp $
 #      @(#)Makefile    8.2 (Berkeley) 12/13/93
 
 MAN=   _DIAGASSERT.3 __UNCONST.3 CMSG_DATA.3 \
        __arraycount.3 assert.3 bits.3 bitstring.3 dlfcn.3 end.3 \
        fast_divide32.3 gcq.3 intro.3 inttypes.3 iso646.3 offsetof.3 queue.3 \
-       stdarg.3 stdbool.3 stddef.3 stdint.3 sysexits.3 \
+       stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \
        tgmath.3 timeradd.3 tree.3 varargs.3
 
 USETBL=        # used by queue.3
diff -r 0a86ef56defa -r 30bb5ff3e809 share/man/man3/stddef.3
--- a/share/man/man3/stddef.3   Thu Mar 25 01:15:00 2010 +0000
+++ b/share/man/man3/stddef.3   Thu Mar 25 06:56:20 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: stddef.3,v 1.5 2010/03/22 10:15:00 wiz Exp $
+.\" $NetBSD: stddef.3,v 1.6 2010/03/25 06:56:20 jruoho Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -67,8 +67,7 @@
 Some of the described types and macros may appear also in other headers.
 .Sh SEE ALSO
 .Xr offsetof 3 ,
-.Xr stdbool 3 ,
-.Xr stdint 3
+.Xr stdlib 3
 .Sh STANDARDS
 As described here, the
 .In stddef.h
diff -r 0a86ef56defa -r 30bb5ff3e809 share/man/man3/stdlib.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man3/stdlib.3   Thu Mar 25 06:56:20 2010 +0000
@@ -0,0 +1,108 @@
+.\" $NetBSD: stdlib.3,v 1.1 2010/03/25 06:56:20 jruoho Exp $
+.\"
+.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jukka Ruohonen.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd March 25, 2010
+.Os
+.Dt STDLIB 3
+.Sh NAME
+.Nm stdlib
+.Nd standard library definitions
+.Sh SYNOPSIS
+.In stdlib.h
+.Sh DESCRIPTION
+The
+.In stdlib.h
+header defines the following types and macros:
+.Bl -enum -offset 4n
+.It
+.Dv NULL
+- an implementation-defined null pointer constant;
+.It
+.Vt size_t
+and
+.Vt wchar_t
+- integer types described in
+.Xr stddef 3 ;
+.It
+.Vt div_t ,
+.Vt ldiv_t ,
+and
+.Vt lldiv_t
+- structures that are returned by the
+.Xr div 3 ,
+.Xr ldiv 3 ,
+and
+.Xr lldiv 3
+functions, respectively;
+.It
+.Dv RAND_MAX
+- a macro which expands to an integer constant
+that is the maximum value returned by the
+.Xr rand 3
+function;
+.It
+.Dv MB_CUR_MAX
+- an integer expression of type
+.Vt size_t
+whose value is the maximum number of bytes in a
+character specified by the current locale; and
+.It
+.Dv EXIT_SUCCESS
+and
+.Dv EXIT_FAILURE
+- macros which expand to integer constants
+suitable for use as an argument to the
+.Xr exit 3
+function.
+.El
+.Pp
+The
+.In stdlib.h
+header also prototypes several important functions such as
+.Xr abort 3 ,
+.Xr atoi 3 ,
+.Xr bsearch 3 ,
+.Xr free 3 ,
+.Xr malloc 3 ,
+and
+.Xr strtol 3 .
+.Sh SEE ALSO
+.Xr stddef 3
+.Sh STANDARDS
+As described here, the
+.In stdlib.h
+header conforms to
+.St -isoC-99
+and
+.St -p1003.1-2001 .
+.Sh HISTORY
+In the current form the
+.In stdlib.h
+header was introduced in
+.Nx 0.8 .
diff -r 0a86ef56defa -r 30bb5ff3e809 share/man/man3/sysexits.3
--- a/share/man/man3/sysexits.3 Thu Mar 25 01:15:00 2010 +0000
+++ b/share/man/man3/sysexits.3 Thu Mar 25 06:56:20 2010 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sysexits.3,v 1.3 2009/03/09 19:24:28 joerg Exp $
+.\"    $NetBSD: sysexits.3,v 1.4 2010/03/25 06:56:20 jruoho Exp $
 .\"
 .\" Copyright (c) 1996 Joerg Wunsch
 .\"
@@ -27,7 +27,7 @@
 .\" $FreeBSD: src/share/man/man3/sysexits.3,v 1.16 2005/06/30 13:13:49 hmp Exp $
 .\"
 .\" "
-.Dd March 31, 1996
+.Dd March 25, 2010
 .Dt SYSEXITS 3
 .Os
 .Sh NAME
@@ -38,11 +38,18 @@
 .Sh DESCRIPTION
 It is not a good practice to call
 .Xr exit 3
-with arbitrary values to indicate a failure condition when ending
-a program.
-Instead, the pre-defined exit codes from
-.Nm
-should be used, so the caller of the process can get a rough
+with arbitrary values to indicate a failure condition when ending a program.
+In addition to the two standard constants in
+.In stdlib.h ,
+.Dv EXIT_SUCCESS
+and
+.Dv EXIT_FAILURE ,
+the header
+.In sysexits.h
+defines few exit codes that can be used as a parameter to the
+.Xr exit 3
+function.
+By using these constants the caller of the process can get a rough
 estimation about the failure class without looking up the source code.
 .Pp
 The successful exit is always indicated by a status of 0, or
@@ -127,15 +134,16 @@
 parenthesis for easy reference.
 .Sh SEE ALSO
 .Xr err 3 ,
-.Xr exit 3
+.Xr exit 3 ,
+.Xr stdlib 3
 .Sh HISTORY
 The
 .Nm
 file appeared somewhere after
 .Bx 4.3 .
 The
-.Nm
-man page appeared in
+.Xr sysexits 3
+manual page appeared in
 .Nx 4.0 .
 .Sh AUTHORS
 This manual page was written by



Home | Main Index | Thread Index | Old Index