      SUBROUTINE MAIN
      INTEGER NOW(7), DAY, FORM
      INTEGER WKDAY, GETARG, EQUAL
      LOGICAL*1 DATE(10), TIME(9)
      LOGICAL*1 SUNDAY(7)
      LOGICAL*1 MONDAY(7)
      LOGICAL*1 TUESDA(8)
      LOGICAL*1 WEDNES(10)
      LOGICAL*1 THURSD(9)
      LOGICAL*1 FRIDAY(7)
      LOGICAL*1 SATURD(9)
      LOGICAL*1 TWOBLK(3)
      LOGICAL*1 MINUSN(3)
      DATA SUNDAY(1)/83/,SUNDAY(2)/117/,SUNDAY(3)/110/,SUNDAY(4)/100/,SU
     *NDAY(5)/97/,SUNDAY(6)/121/,SUNDAY(7)/0/
      DATA MONDAY(1)/77/,MONDAY(2)/111/,MONDAY(3)/110/,MONDAY(4)/100/,MO
     *NDAY(5)/97/,MONDAY(6)/121/,MONDAY(7)/0/
      DATA TUESDA(1)/84/,TUESDA(2)/117/,TUESDA(3)/101/,TUESDA(4)/115/,TU
     *ESDA(5)/100/,TUESDA(6)/97/,TUESDA(7)/121/,TUESDA(8)/0/
      DATA WEDNES(1)/87/,WEDNES(2)/101/,WEDNES(3)/100/,WEDNES(4)/110/,WE
     *DNES(5)/101/,WEDNES(6)/115/,WEDNES(7)/100/,WEDNES(8)/97/,WEDNES(9)
     */121/,WEDNES(10)/0/
      DATA THURSD(1)/84/,THURSD(2)/104/,THURSD(3)/117/,THURSD(4)/114/,TH
     *URSD(5)/115/,THURSD(6)/100/,THURSD(7)/97/,THURSD(8)/121/,THURSD(9)
     */0/
      DATA FRIDAY(1)/70/,FRIDAY(2)/114/,FRIDAY(3)/105/,FRIDAY(4)/100/,FR
     *IDAY(5)/97/,FRIDAY(6)/121/,FRIDAY(7)/0/
      DATA SATURD(1)/83/,SATURD(2)/97/,SATURD(3)/116/,SATURD(4)/117/,SAT
     *URD(5)/114/,SATURD(6)/100/,SATURD(7)/97/,SATURD(8)/121/,SATURD(9)/
     *0/
      DATA TWOBLK(1)/32/,TWOBLK(2)/32/,TWOBLK(3)/0/
      DATA MINUSN(1)/45/,MINUSN(2)/110/,MINUSN(3)/0/
      CALL QUERY(18Husage:  date [-n].)
      FORM = 1
      IF (.NOT.(GETARG(1, DATE, 10) .NE. -1))GOTO 23000
      CALL FOLD(DATE)
      IF (.NOT.(EQUAL(DATE, MINUSN) .EQ. 1))GOTO 23002
      FORM = 2
23002 CONTINUE
23000 CONTINUE
      CALL GETNOW(NOW)
      CALL FMTDAT(DATE, TIME, NOW, FORM)
      DAY = WKDAY(NOW(2), NOW(3), NOW(1))
      IF (.NOT.(DAY .EQ. 1))GOTO 23004
      CALL PUTLIN(SUNDAY, 2)
      GOTO 23005
23004 CONTINUE
      IF (.NOT.(DAY .EQ. 2))GOTO 23006
      CALL PUTLIN(MONDAY, 2)
      GOTO 23007
23006 CONTINUE
      IF (.NOT.(DAY .EQ. 3))GOTO 23008
      CALL PUTLIN(TUESDA, 2)
      GOTO 23009
23008 CONTINUE
      IF (.NOT.(DAY .EQ. 4))GOTO 23010
      CALL PUTLIN(WEDNES, 2)
      GOTO 23011
23010 CONTINUE
      IF (.NOT.(DAY .EQ. 5))GOTO 23012
      CALL PUTLIN(THURSD, 2)
      GOTO 23013
23012 CONTINUE
      IF (.NOT.(DAY .EQ. 6))GOTO 23014
      CALL PUTLIN(FRIDAY, 2)
      GOTO 23015
23014 CONTINUE
      IF (.NOT.(DAY .EQ. 7))GOTO 23016
      CALL PUTLIN(SATURD, 2)
23016 CONTINUE
23015 CONTINUE
23013 CONTINUE
23011 CONTINUE
23009 CONTINUE
23007 CONTINUE
23005 CONTINUE
      CALL PUTLIN(TWOBLK, 2)
      CALL PUTLIN(DATE, 2)
      CALL PUTLIN(TWOBLK, 2)
      CALL PUTLIN(TIME, 2)
      CALL PUTCH(10, 2)
      RETURN
      END
