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 / MONTHNAM.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-30  |  1.2 KB  |  59 lines

  1. /*
  2.  * monthnam.c
  3.  * contains: monthname(),wkday()
  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.  *  char *
  13.  * monthname(n)
  14.  *
  15.  * ARGUMENT
  16.  *  (int)    n    -    month number, 1==January etc.
  17.  *
  18.  * DESCRIPTION
  19.  *  Given the integer value for the month (1=january etc) return
  20.  *  a pointer to a string containing the name of the month.
  21.  *
  22.  * RETURNS
  23.  *  Pointer to string containing the month name.
  24.  */
  25. char* GF_CONV monthname(n)
  26. int n;
  27. {
  28.     static char *name[] = {
  29.         "illegal month","January","February","March","April",
  30.         "May","June","July","August","September",
  31.         "October","November","December"
  32.     };
  33.     return((n<1||n>12)?name[0]:name[n]);
  34. }
  35.  
  36. /*
  37.  *  char *
  38.  * wkday(iday)
  39.  *
  40.  * ARGUMENT
  41.  *  (int)    iday    -    Integer value of day of week, 1==MONDAY
  42.  *
  43.  * DESCRIPTION
  44.  *  Given the integer value of the day of week (1=MONDAY, 2=TUESDAY,
  45.  *  3=WEDNESDAY etc. return pointer to string containing the name of
  46.  *  the day.
  47.  *
  48.  * RETURNS
  49.  *  Pointer to string name of day.
  50.  */
  51. char* GF_CONV wkday(iday)
  52. int iday;
  53. {
  54.     static char *day_tab[] = { 
  55.         "Sunday","Monday","Tuesday","Wednesday",
  56.         "Thursday","Friday","Saturday","illegal day"     };
  57.     return day_tab[iday];
  58. }
  59.