Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ctype(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ascii(M)

chrtbl(M)

environ(M)

stdio(S)


 ctype(S)                       6 January 1993                       ctype(S)


 Name

    ctype - character handling routines

 Syntax


    #include <ctype.h>

    int isdigit(c);
    int c;

     . . .

    tolower(c)
    int c;


 Description

    The character classification macros listed below are defined by the
    <ctype.h> header file.  They each return nonzero for true, zero for
    false.

    These functions classify character-coded integer values according to the
    rules of the coded character set defined by character type information in
    the program's locale (category LCTYPE).

    In the C locale, or in a locale where character type information is not
    defined, characters are classified according to the rules of the US-ASCII
    7-bit coded chracter set, returning zero for values above octal 0177.

    In all cases the argument is an integer, the value of which must be
    representable as an unsigned char or must equal the value of the macro
    EOF.  If the argument has any other value, the behaviour is undefined.
    isascii is defined on all integer values.

    isdigit   tests for the digits 0 through 9.

    isxdigit  tests for any character for which isdigit is true or for the
              letters a through f or A through F.

    islower   tests for any lowercase letter as defined by the character set.

    isupper   tests for any uppercase letter as defined by the character set.

    isalpha   tests for any character for which islower or isupper is true
              and possibly any others as defined by the character set.

    isalnum   tests for any character for which isalpha or isdigit is true.

    isspace   tests for a space, horizontal-tab, carriage return, newline,
              vertical-tab, or form-feed.

    iscntrl   tests for ``control characters'' as defined by the character
              set.

    ispunct   tests for any character other than the ones for which isalnum,
              iscntrl, or isspace is true.

    isprint   tests for a space or any character for which isalnum or ispunct
              is true or other ``printing character'' as defined by the char-
              acter set.

    isgraph   tests for any character for which isprint is true, except for
              space.

    isascii   tests for an ASCII character (a non-negative number less than
              0200).

    The conversion functions and macros translate a character from lowercase
    (uppercase) to uppercase (lowercase).


    tolower   if the character is one for which isupper is true and there is
              a corresponding lowercase character, tolower returns the corre-
              sponding lowercase character.  Otherwise, the character is
              returned unchanged.

    toupper   if the character is one for which islower is true and there is
              a corresponding uppercase character, otherwise, the character
              is returned unchanged.

    toascii   turns off the bits that are not part of the ASCII character
              set.

    tolower  returns the lowercase representation of a character for which
              isupper is true, otherwise undefined.

    toupper  returns the uppercase representation of a character for which
              islower is true, otherwise undefined.

    The conversion macros have the same functionality of the functions on
    valid input, but the macros are faster because they do not do range
    checking.

    All the character classification macros and the conversion functions and
    macros do a table lookup.

 See also

    ascii(M), chrtbl(M), environ(M), stdio(S)

 Diagnostics

    If the argument to any of the character handling macros is not in the
    domain of the function, the result is undefined.

 Warning

    If a character variable or constant is passed to these functions or mac-
    ros, undefined results may occur on machines which sign-extend characters
    by default.

 Standards conformance

    isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint, ispunct,
    isspace, isupper, isxdigit, tolower and toupper are conformant with:
    AT&T SVID Issue 2;
    X/Open Portability Guide, Issue 3, 1989;
    ANSI X3.159-1989 Programming Language -- C;
    IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C
    Language] (ISO/IEC 9945-1);
    and NIST FIPS 151-1.

    tolower and toupper are conformant with:
    AT&T SVID Issue 2;
    and X/Open Portability Guide, Issue 3, 1989.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026