1: #if !defined(lint) && defined(DOSCCS)
   2: static  char *sccsid = "@(#)calendar.c	4.5.1 (2.11BSD) 1996/10/23";
   3: #endif
   4: 
   5: /* /usr/libexec/calendar produces an egrep -f file
   6:    that will select today's and tomorrow's
   7:    calendar entries, with special weekend provisions
   8: 
   9:    used by calendar command
  10: */
  11: #include <sys/time.h>
  12: 
  13: #define DAY (3600*24L)
  14: 
  15: char *month[] = {
  16:     "[Jj]an",
  17:     "[Ff]eb",
  18:     "[Mm]ar",
  19:     "[Aa]pr",
  20:     "[Mm]ay",
  21:     "[Jj]un",
  22:     "[Jj]ul",
  23:     "[Aa]ug",
  24:     "[Ss]ep",
  25:     "[Oo]ct",
  26:     "[Nn]ov",
  27:     "[Dd]ec"
  28: };
  29: struct tm *localtime();
  30: 
  31: tprint(t)
  32: long t;
  33: {
  34:     struct tm *tm;
  35:     tm = localtime(&t);
  36:     printf("(^|[ 	(,;])((%s[^ \t]*[ \t]*|(0%d|%d)/)0*%d)([^0123456789]|$)\n",
  37:         month[tm->tm_mon],
  38:         tm->tm_mon + 1, tm->tm_mon + 1, tm->tm_mday);
  39:     printf("(^|[ 	(,;])((\\*[ \t]*)0*%d)([^0123456789]|$)\n",
  40:         tm->tm_mday);
  41: }
  42: 
  43: main()
  44: {
  45:     long t;
  46:     time(&t);
  47:     tprint(t);
  48:     switch(localtime(&t)->tm_wday) {
  49:     case 5:
  50:         t += DAY;
  51:         tprint(t);
  52:     case 6:
  53:         t += DAY;
  54:         tprint(t);
  55:     default:
  56:         t += DAY;
  57:         tprint(t);
  58:     }
  59: }

Defined functions

main defined in line 43; never used
tprint defined in line 31; used 4 times

Defined variables

month defined in line 15; used 1 times
  • in line 37
sccsid defined in line 2; never used

Defined macros

DAY defined in line 13; used 3 times
Last modified: 1996-10-24
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2511
Valid CSS Valid XHTML 1.0 Strict