Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Apr 2001 02:15:33 -0400 (EDT)
From:      adrian@ubergeeks.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   docs/26451: ctype and related manpages are incomplete
Message-ID:  <200104090615.f396FXp44582@lorax.ubergeeks.com>

next in thread | raw e-mail | index | archive | help

>Number:         26451
>Category:       docs
>Synopsis:       ctype.h defined functions are not accurately documented, if at all
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 08 23:10:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Adrian Filipi-Martin
>Release:        FreeBSD 4.3-RC i386
>Organization:
Ubergeeks Consulting
>Environment:
System: FreeBSD lorax.ubergeeks.com 4.3-RC FreeBSD 4.3-RC #0: Sat Mar 31 20:53:47 EST 2001 root@lorax.ubergeeks.com:/home/obj/usr/src/sys/LORAX i386

>Description:
	1. ctype.h defines digittoint(), isnumber() and ishexnmber(), yet
	they are not documented in any of the manpages.  

	2. The ctype manpage references a non-existent manpage for
	digittoint().

	3. The isascii() manpage claims it is standards compliant, when
	it isn't.

	4. isblank() claims it is _not_ standards compliant, when it
	is.  Note, I only have the C99 standard, so the manpage references
	C99 instead of C89.  It may be compliant with the old standard as well,
	but someone else needs to check.

>How-To-Repeat:
	Read ctype.h and ctype.3.
>Fix:

	Apply the attched patch in /usr/src/lib/libc/locale.

--- Makefile.inc.orig	Mon Apr  9 00:24:08 2001
+++ Makefile.inc	Mon Apr  9 01:58:18 2001
@@ -10,11 +10,11 @@
 	tolower.c toupper.c utf2.c
 
 .if ${LIB} == "c"
-MAN3+=	ctype.3 isalnum.3 isalpha.3 isascii.3 isblank.3 iscntrl.3 \
-	isdigit.3 isgraph.3 islower.3 isprint.3 ispunct.3 isspace.3 \
-	isupper.3 isxdigit.3 mbrune.3 multibyte.3 rune.3 setlocale.3 \
-	toascii.3 tolower.3 toupper.3
-MAN4+=	euc.4 utf2.4
+MAN3+=  ctype.3 digittoint.3 isalnum.3 isalpha.3 isascii.3 isblank.3 \
+	iscntrl.3 isdigit.3 isgraph.3 islower.3 \
+	isprint.3 ispunct.3 isspace.3 isupper.3 isxdigit.3 mbrune.3 \
+	multibyte.3 rune.3 setlocale.3 toascii.3 tolower.3 toupper.3
+MAN4+=  euc.4 utf2.4
 
 MLINKS+=mbrune.3 mbmb.3 mbrune.3 mbrrune.3
 MLINKS+=multibyte.3 mblen.3 multibyte.3 mbstowcs.3 multibyte.3 mbtowc.3 \
@@ -23,4 +23,6 @@
 	rune.3 setinvalidrune.3 rune.3 setrunelocale.3 rune.3 sgetrune.3 \
 	rune.3 sputrune.3
 MLINKS+=setlocale.3 localeconv.3
+MLINKS+=isxdigit.3 ishexnumber.3
+MLINKS+=isdigit.3 isnumber.3
 .endif
--- ctype.3.orig	Mon Apr  9 00:18:24 2001
+++ ctype.3	Mon Apr  9 01:58:18 2001
@@ -55,6 +55,7 @@
 .Nm isspecial ,
 .Nm isupper ,
 .Nm isxdigit ,
+.Nm digittoint ,
 .Nm toascii ,
 .Nm tolower ,
 .Nm toupper
@@ -100,6 +101,8 @@
 .Ft int
 .Fn isxdigit "int c"
 .Ft int
+.Fn digittoint "int c"
+.Ft int
 .Fn toascii "int c"
 .Ft int
 .Fn tolower "int c"
@@ -126,6 +129,7 @@
 .Xr isspace 3 ,
 .Xr isupper 3 ,
 .Xr isxdigit 3 ,
+.Xr digittoint 3 ,
 .Xr toascii 3 ,
 .Xr tolower 3 ,
 .Xr toupper 3 ,
@@ -134,7 +138,6 @@
 These functions, except for
 .Fn digittoint ,
 .Fn isascii ,
-.Fn isblank ,
 .Fn ishexnumber ,
 .Fn isideogram ,
 .Fn isnumber ,
@@ -145,3 +148,6 @@
 .Fn toascii ,
 conform to
 .St -isoC .
+.Fn isblank
+conforms to
+.St -isoC-99 .
--- digittoint.3.orig	Mon Apr  9 00:40:31 2001
+++ digittoint.3	Mon Apr  9 02:06:55 2001
@@ -0,0 +1,77 @@
+.\" Copyright (c) 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"	This product includes software developed by the University of
+.\"	California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+.\"
+.\"	@(#)digittoint.3	8.1 (Berkeley) 6/4/93
+.\" $FreeBSD$
+.\"
+.Dd April 6, 2001
+.Dt DIGITTOINT 3
+.Os
+.Sh NAME
+.Nm digittoint
+.Nd convert a numeric character to its integer value
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.Fd #include <ctype.h>
+.Ft int
+.Fn digittoint "int c"
+.Sh DESCRIPTION
+The
+.Fn digittoint
+function converts a numeric character to its corresponding integer value.  The
+character an be any decimal digit or hexadecimal digit.  With hexadecimal
+characters, the case of the values does not matter.
+.Sh RETURN VALUES
+The
+.Fn digittoint
+function always returns an integer from the range of 0 to 15.  If the
+given character was not a digit as defined by
+.Xr isxdigit 3 , the function will return 0.
+
+.Sh SEE ALSO
+.Xr isalnum 3 ,
+.Xr isalpha 3 ,
+.Xr isascii 3 ,
+.Xr iscntrl 3 ,
+.Xr isdigit 3 ,
+.Xr isgraph 3 ,
+.Xr islower 3 ,
+.Xr isprint 3 ,
+.Xr ispunct 3 ,
+.Xr isspace 3 ,
+.Xr isupper 3 ,
+.Xr isxdigit 3 ,
+.Xr stdio 3 ,
+.Xr digittoint 3 ,
+.Xr tolower 3 ,
+.Xr toupper 3 ,
+.Xr ascii 7
--- isascii.3.orig	Mon Apr  9 00:37:32 2001
+++ isascii.3	Mon Apr  9 01:58:18 2001
@@ -54,8 +54,3 @@
 .Sh SEE ALSO
 .Xr ctype 3 ,
 .Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isascii
-function conforms to
-.St -isoC .
--- isblank.3.orig	Mon Apr  9 01:15:09 2001
+++ isblank.3	Mon Apr  9 01:58:18 2001
@@ -66,3 +66,7 @@
 .Xr ctype 3 ,
 .Xr multibyte 3 ,
 .Xr ascii 7
+.Sh STANDARDS
+.Fn isblank
+conforms to
+.St -isoC-99 .
--- isdigit.3.orig	Mon Apr  9 01:38:15 2001
+++ isdigit.3	Mon Apr  9 01:58:18 2001
@@ -40,7 +40,7 @@
 .Dt ISDIGIT 3
 .Os
 .Sh NAME
-.Nm isdigit
+.Nm isdigit, isnumber
 .Nd decimal-digit character test
 .Sh LIBRARY
 .Lb libc
@@ -48,6 +48,8 @@
 .Fd #include <ctype.h>
 .Ft int
 .Fn isdigit "int c"
+.Ft int
+.Fn isnumber "int c"
 .Sh DESCRIPTION
 The
 .Fn isdigit
@@ -68,11 +70,25 @@
 .It "\&060\ ``0'' \t061\ ``1'' \t062\ ``2'' \t063\ ``3'' \t064\ ``4''"
 .It "\&065\ ``5'' \t066\ ``6'' \t067\ ``7'' \t070\ ``8'' \t071\ ``9''"
 .El
+.Pp
+The difference bwtween
+.Fn isdigit
+and
+.Fn isnumber
+is that
+.Fn isnumber
+uses the current locale, but
+.Fn isdigit
+always uses the 
+.Li "\&""C""
+locale.
 .Sh RETURN VALUES
 The
 .Fn isdigit
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isnumber
+functions return zero if the character tests false and
+return non-zero if the character tests true.
 .Sh SEE ALSO
 .Xr ctype 3 ,
 .Xr multibyte 3 ,
--- isxdigit.3.orig	Mon Apr  9 01:30:38 2001
+++ isxdigit.3	Mon Apr  9 01:58:18 2001
@@ -40,7 +40,7 @@
 .Dt ISXDIGIT 3
 .Os
 .Sh NAME
-.Nm isxdigit
+.Nm isxdigit, ishexnumber
 .Nd hexadecimal-digit character test
 .Sh LIBRARY
 .Lb libc
@@ -48,6 +48,8 @@
 .Fd #include <ctype.h>
 .Ft int
 .Fn isxdigit "int c"
+.Ft int
+.Fn ishexnumber "int c"
 .Sh DESCRIPTION
 The
 .Fn isxdigit
@@ -71,11 +73,25 @@
 .It "\&106\ ``F'' \t141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d''"
 .It "\&145\ ``e'' \t146\ ``f''"
 .El
+.Pp
+The difference bwtween
+.Fn isxdigit
+and
+.Fn ishexnumber
+is that
+.Fn ishexnumber
+uses the current locale, but
+.Fn isxdigit
+always uses the 
+.Li "\&""C""
+locale.
 .Sh RETURN VALUES
 The
 .Fn isxdigit
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn ishexnumber
+functions return zero if the character tests false and
+return non-zero if the character tests true.
 .Sh SEE ALSO
 .Xr ctype 3 ,
 .Xr multibyte 3 ,
--- toascii.3.orig	Mon Apr  9 00:18:24 2001
+++ toascii.3	Mon Apr  9 01:58:18 2001
@@ -54,6 +54,7 @@
 .Fn toascii
 function always returns a valid ASCII character.
 .Sh SEE ALSO
+.Xr digittoint 3 ,
 .Xr isalnum 3 ,
 .Xr isalpha 3 ,
 .Xr isascii 3 ,
--- tolower.3.orig	Mon Apr  9 00:18:24 2001
+++ tolower.3	Mon Apr  9 01:58:18 2001
@@ -68,6 +68,7 @@
 function returns the corresponding lower-case letter if there is
 one; otherwise the argument is returned unchanged.
 .Sh SEE ALSO
+.Xr digittoint 3 ,
 .Xr isalnum 3 ,
 .Xr isalpha 3 ,
 .Xr isascii 3 ,
--- toupper.3.orig	Mon Apr  9 00:18:24 2001
+++ toupper.3	Mon Apr  9 01:58:18 2001
@@ -68,6 +68,7 @@
 function returns the corresponding upper-case letter if there is
 one; otherwise the argument is returned unchanged.
 .Sh SEE ALSO
+.Xr digittoint 3 ,
 .Xr isalnum 3 ,
 .Xr isalpha 3 ,
 .Xr isascii 3 ,
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104090615.f396FXp44582>