home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC1.ZIP / TOLOWER.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.3 KB  |  52 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - tolower.c
  3.  *
  4.  * function(s)
  5.  *        tolower - translates characters to lower-case
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <ctype.h>
  18.  
  19. /*---------------------------------------------------------------------*
  20.  
  21. Name            tolower - translates characters to lower-case
  22.  
  23. Usage           int tolower(int c);
  24.  
  25. Prototype in    ctype.h
  26.  
  27. Description     tolower is a function that converts an integer c (in the range
  28.                 EOF to 255) to its lower-case value (if it was upper-case): all
  29.                 others are left unchanged.
  30.  
  31. Return value    returns the converted value of c, on success, and nothing
  32.                 on failure.
  33.  
  34. *---------------------------------------------------------------------*/
  35. #if defined(__FARFUNCS__)
  36. #include <_farfunc.h>
  37. #endif
  38.  
  39. int _CType tolower( int ch )
  40.   {
  41.   if( ch == -1 )  return( -1 );
  42.  
  43.   if( isupper( (unsigned char)ch) )
  44.     {
  45.     return( _tolower((unsigned char)ch) );
  46.     }
  47.   else
  48.     {
  49.     return( (unsigned char)ch );
  50.     }
  51.   }
  52.