8 ! !This is a modified version of LOGIN, with an additional GOSUB at 28000 !and call to this GOSUB at line 5150. This GOSUB updates the date/time !of last LOGIN in the MAIL System file MAIL.TXT, if it exists, on the !account being logged into. This code also includes FND% at line 29000 5150 GOSUB 28000 !MAIL System stuff 28000 ! !<><><><><><><><> UPDATE MAIL.TXT HEADER FOR THIS ACCT, IF PRESENT ><><><> ! 28005 DIM D$(2%) 28010 M0$="["+M0$+"]MAIL.TXT" \ OPEN M0$ FOR INPUT AS FILE 11%,RECORDSIZE 49% ! TRY TO OPEN THE MAIL.TXT FILE IF IT EXISTS ON THE ACCOUNT ! 28020 FIELD #11%, 10% AS N0$, 13% AS N1$, 13% AS N2$, 13% AS N3$ \ GET #11%,RECORD 1% ! Read MAIL.TXT header record ! 28026 D$(0%)=N1$+""\ D$(1%)=N2$+""\ D$(2%)=N3$+"" \ D1%=FND%(D$(0%),D$(1%),D%) ! D$(0%) = d/t of latest msg ! D$(1%) = d/t of last MAIL check by user ! D$(2%) = d/t of last LOGIN ! 28027 M0$=CVT$$(DATE$(0%),-1%)+CVT$$(TIME$(0%),-1%) \ M0$=LEFT(M0$,11%)+RIGHT(M0$,13%) \ LSET N3$=M0$ \ PUT #11%,RECORD 1% \ CLOSE 11% !Update the d/t of this LOGIN in MAIL.TXT header, then close it ! 28040 GOTO 28900 IF D1%<=0% !Skip to RETRUN if no new MAIL 28050 PRINT \ PRINT TAB(6%);"<>< You have received new MAIL during the past "; \ PRINT "year(s)"; IF D1%=1% \ PRINT "month(s)"; IF D1%=2% \ PRINT "few days"; IF D1%=3% \ PRINT "few hours"; IF D1%=4% \ PRINT "few minutes"; IF D1%=5% \ PRINT " ><>" \ PRINT \ PRINT ! Print the appropriate informational message if new MAIL present ! 28100 GOTO 28900 ! 28900 RETURN ! 29000 ! !FUNCTION TO COMPARE DATE/TIME STRINGS; RETURN CODES ARE: ! Negative if first is earlier, Positive is second is earlier, Zero if same ! and value indicates at what level the difference occurred; ! 1=yr, 2=mo, 3=day, 4=hr, 5=min ! 29010 !The expected d/t format for D1$/D2$ is dd-MMM-yyhhmm, length of 13 ! 29020 ! 29030 DEF FND%(D1$,D2$,D%) !DATE1, DATE2, RETURN CODE 29040 DIM D0$(12%) 29050 D%=0% \ D1$=CVT$$(D1$,-1%) \ D2$=CVT$$(D2$,-1%) ! Initialize return code at 0, CVT$$ the d/t's 29060 D0$(1%)="JAN" \ D0$(2%)="FEB" \ D0$(3%)="MAR" \ D0$(4%)="APR" \ D0$(5%)="MAY" \ D0$(6%)="JUN" \ D0$(7%)="JUL" \ D0$(8%)="AUG" \ D0$(9%)="SEP" \ D0$(10%)="OCT" \ D0$(11%)="NOV" \ D0$(12%)="DEC" ! Month name list array 29070 ! 29080 Y1$=MID(D1$,8%,2%) \ Y2$=MID(D2$,8%,2%) \ M1$=MID(D1$,4%,3%) \ M2$=MID(D2$,4%,3%) \ H1$=MID(D1$,10%,2%)\ H2$=MID(D2$,10%,2%)\ X1$=RIGHT(D1$,12%) \ X2$=RIGHT(D2$,12%) \ E1$=LEFT(D1$,2%) \ E2$=LEFT(D2$,2%) !E=day; M=month; Y=year; H=hour; X=minute ! 29090 GOTO 29180 IF LEFT(D1$,9%)=LEFT(D2$,9%) ! If dates are same, skip to time check 29100 D%=-1% IF VAL(Y1$) < VAL(Y2$) \ D%=1% IF VAL(Y1$) > VAL(Y2$) \ GOTO 29200 IF D%<>0% !Discriminate on the year first, if possible 29110 ! 29120 FOR D3%=1% TO 12% \ GOTO 29140 IF M1$=D0$(D3%) 29130 NEXT D3% 29140 FOR D2%=1% TO 12% \ GOTO 29160 IF M2$=D0$(D2%) 29150 NEXT D2% !Determine the month numbers (1-12) for the two dates ! 29160 D%=-2% IF D3% < D2% \ D%=2% IF D3% > D2% \ GOTO 29200 IF D%<>0% !Discriminate on the month number next, if possible 29170 D%=-3% IF VAL(E1$) < VAL(E2$) \ D%=3% IF VAL(E1$) > VAL(E2$) \ GOTO 29200 IF D%<>0% !Discriminate on the day next, if possible 29180 D%=-4% IF VAL(H1$) < VAL(H2$) \ D%=4% IF VAL(H1$) > VAL(H2$) \ GOTO 29200 IF D%<>0% !Discriminate on the hour next, if possible 29190 D%=-5% IF VAL(X1$) < VAL(X2$) \ D%=5% IF VAL(X1$) > VAL(X2$) !Discriminate on minutes last, if d/t are same, return code stays 0 ! 29200 FND%=D% \ FNEND 29999 !