home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / ISLXX.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-30  |  809 b   |  48 lines

  1. /*
  2.  * islxx.c
  3.  * contains: isleap(), isletter()
  4.  *
  5.  *   Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include "gfuncts.h"
  10.  
  11. /*
  12.  *  bool
  13.  * isleap(year)
  14.  *
  15.  * ARGUMENT
  16.  *  (int)    year    -    year to test
  17.  *
  18.  * DESCRIPTION
  19.  *  Determine if specified year is a leap year.
  20.  *
  21.  * RETURNS
  22.  *  TRUE if is leap year, else FALSE
  23.  */
  24. bool GF_CONV isleap(year)
  25. int year;
  26. {
  27.     return(year%4==0&&year%100!=0||year%400==0);
  28. }
  29.  
  30. /*
  31.  *  bool
  32.  * isletter(c)
  33.  *
  34.  * ARGUMENT
  35.  *  (char)    c    -    character to test
  36.  *
  37.  * DESCRIPTION
  38.  *  Tests character for alphabetic or underline
  39.  *
  40.  * RETURNS
  41.  *  TRUE if character is alphabetic or underline else FALSE
  42.  */
  43. bool GF_CONV isletter(c)
  44. char c;
  45. {
  46.     return ((c>='a'&& c<='z')||(c>='A'&&c<='Z')||c=='_');
  47. }
  48.