home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_11 / 8n11010a < prev    next >
Text File  |  1990-10-12  |  3KB  |  171 lines

  1.  
  2. /* isalnum function
  3.  * copyright (c) 1990 by P.J. Plauger
  4.  */
  5. #include <ctype.h>
  6.  
  7. /* test for alphanumeric character
  8.  */
  9. #undef isalnum
  10. int isalnum(int c)
  11.     {
  12.     return (_Ctype[c] & (_DI|_LO|_UP|_XA));
  13.     }
  14.  
  15. /* isalpha function
  16.  * copyright (c) 1990 by P.J. Plauger
  17.  */
  18. #include <ctype.h>
  19.  
  20. /* test for alphabetic character
  21.  */
  22. #undef isalpha
  23. int isalpha(int c)
  24.     {
  25.     return (_Ctype[c] & (_LO|_UP|_XA));
  26.     }
  27.  
  28. /* iscntrl function
  29.  * copyright (c) 1990 by P.J. Plauger
  30.  */
  31. #include <ctype.h>
  32.  
  33. /* test for control character
  34.  */
  35. #undef iscntrl
  36. int iscntrl(int c)
  37.     {
  38.     return (_Ctype[c] & (_BB|_CN));
  39.     }
  40.  
  41. /* isdigit function
  42.  * copyright (c) 1990 by P.J. Plauger
  43.  */
  44. #include <ctype.h>
  45.  
  46. /* test for digit
  47.  */
  48. #undef isdigit
  49. int isdigit(int c)
  50.     {
  51.     return (_Ctype[c] & _DI);
  52.     }
  53.  
  54. /* isgraph function
  55.  * copyright (c) 1990 by P.J. Plauger
  56.  */
  57. #include <ctype.h>
  58.  
  59. /* test for graphic character
  60.  */
  61. #undef isgraph
  62. int isgraph(int c)
  63.     {
  64.     return (_Ctype[c] & (_DI|_LO|_PU|_UP|_XA));
  65.     }
  66.  
  67. /* islower function
  68.  * copyright (c) 1990 by P.J. Plauger
  69.  */
  70. #include <ctype.h>
  71.  
  72. /* test for lowercase character
  73.  */
  74. #undef islower
  75. int islower(int c)
  76.     {
  77.     return (_Ctype[c] & _LO);
  78.     }
  79.  
  80. /* isprint function
  81.  * copyright (c) 1990 by P.J. Plauger
  82.  */
  83. #include <ctype.h>
  84.  
  85. /* test for printable character
  86.  */
  87. #undef isprint
  88. int isprint(int c)
  89.     {
  90.     return (_Ctype[c] & (_DI|_LO|_PU|_SP|_UP|_XA));
  91.     }
  92.  
  93. /* ispunct function
  94.  * copyright (c) 1990 by P.J. Plauger
  95.  */
  96. #include <ctype.h>
  97.  
  98. /* test for punctuation character
  99.  */
  100. #undef ispunct
  101. int ispunct(int c)
  102.     {
  103.     return (_Ctype[c] & _PU);
  104.     }
  105.  
  106. /* isspace function
  107.  * copyright (c) 1990 by P.J. Plauger
  108.  */
  109. #include <ctype.h>
  110.  
  111. /* test for spacing character
  112.  */
  113. #undef isspace
  114. int isspace(int c)
  115.     {
  116.     return (_Ctype[c] & (_CN|_SP|_XS<~>));
  117.     }
  118.  
  119. /* isupper function
  120.  * copyright (c) 1990 by P.J. Plauger
  121.  */
  122. #include <ctype.h>
  123.  
  124. /* test for uppercase character
  125.  */
  126. #undef isupper
  127. int isupper(int c)
  128.     {
  129.     return (_Ctype[c] & _UP);
  130.     }
  131.  
  132. /* isxdigit function
  133.  * copyright (c) 1990 by P.J. Plauger
  134.  */
  135. #include <ctype.h>
  136.  
  137. /* test for hexadecimal digit
  138.  */
  139. #undef isxdigit
  140. int isxdigit(int c)
  141.     {
  142.     return (_Ctype[c] & _XD);
  143.     }
  144.  
  145. /* tolower function
  146.  * copyright (c) 1990 by P.J. Plauger
  147.  */
  148. #include <ctype.h>
  149.  
  150. /* convert to lowercase character
  151.  */
  152. #undef tolower
  153. int tolower(int c)
  154.     {
  155.     return (_Tolower[c]);
  156.     }
  157.  
  158. /* toupper function
  159.  * copyright (c) 1990 by P.J. Plauger
  160.  */
  161. #include <ctype.h>
  162.  
  163. /* convert to uppercase character
  164.  */
  165. #undef toupper
  166. int toupper(int c)
  167.     {
  168.     return (_Toupper[c]);
  169.     }
  170.  
  171.