+-+-+-+ Beginning of part 3 +-+-+-+
X3080`009l%=swap%(cvt$%(mid(buff9$,k%,2%))) &
X`009\ m.token$=mid(buff9$,k%+2%,1%) &
X`009\ m.from$=mid(buff9$,k%+3%,l%-1%) if m.token$=chr$(129%) &
X`009\ m.subj$=mid(buff9$,k%+3%,l%-1%) if m.token$=chr$(135%) &
X`009\ k%=k%+l%+2% &
X`009\ k%=k%+1% if mid(buff9$,k%,1%)=chr$(0%) &
X`009\ goto 3080 if (m.from$="" or m.subj$="") unless m.token$=chr$(255%) &
X`009\ m.rept$="  "+fnmaildate$(mid(buff9$,8%,12%))+" Subj: " &
X`009\ m.subj$="<blank>" if m.subj$="" &
X`009\ m.rept$=m.rept$+m.subj$ &
X`009\ m.rept$=left(m.rept$,78%)+chr$(13%)+chr$(10%) &
X`009\ m.found%=0% &
X`009\ m.found%=1% if left(m.from$,len(who$)+1%)=who$+" " and nodreq%=0% &
X`009! If From: field is 'MUMBLE ' &
X`009\ m.found%=1% if left(m.from$,len(who$)+1%)=who$+" " and nodreq%<>0% &
X`009   and where$="" &
X`009! If From: field is 'MUMBLE ' &
X`009\ m.found%=1% if mid(m.from$,instr(1%,m.from$,"::")+2%,len(who$)+1%)= &
X`009   who$+" " and nodreq%=0% &
X`009! If From: field is '<anything>::MUMBLE ' &
X`009\ m.found%=1% if left(m.from$,len(who$)+len(where$)+3%)= &
X`009   where$+"::"+who$+" " and nodreq%<>0% &
X`009! If From: field is 'MUMBLE::MUMBLE ' &
X`009\ m.count%=m.count%+1% if m.found%=1% &
X`009\ msg$="  Has the following unread message(s) from you:"+chr$(13%)+ &
X`009   chr$(10%) &
X`009\ gosub 27000 if (m.count%=1% and m.found%=1%) &
X`009\ msg$=m.rept$ &
X`009\ gosub 27000 if m.found%=1% &
X`009! Gather the info we need, report results to user. &
X
X3090`009next j% &
X`009\ m%=33% &
X`009\ goto 3070 if i%<>0% &
X`009! Get next message in this block. If done here, get next block if &
X`009! there is one after forcing scan from start of block. &
X
X3100`009close #9% &
X`009! Close the mail file as we're done with it (hooray) &
X
X3110`009goto 3150 if (flags%(3%) and 2%) <> 2% &
X`009\ msg$=" Plan: " &
X`009\ a$="_SY:["+num1$(u.proj%)+","+num1$(u.prog%)+"]FINGER.PLN" &
X`009\ open a$ for input as file #9%, mode 4096%, access read, allow modify &
X`009\ msg$=msg$+chr$(13%)+chr$(10%) &
X`009\ gosub 27000 &
X`009! Open the user's planfile for input. &
X
X3120`009input line #9%, a$ &
X`009\ a$=xlate(a$,bypass$) if (flags%(3%) and 1%) <> 1% &
X`009\ msg$=a$ &
X`009\ gosub 27000 &
X`009\ goto 3120 &
X`009! See if bypass is enabled. If it isn't, translate to remove the &
X`009! control characters. Display the message and loop for another line. &
X
X3130`009msg$=msg$+"(no plan file)"+chr$(13%)+chr$(10%) &
X`009\ gosub 27000 &
X`009\ goto 3150 &
X`009! Say the user has no plan file and exit. &
X
X3140`009close #9% &
X`009! Close the plan file and exit. &
X
X3150`009close #10% &
X`009\ goto 32600 &
X`009! All done, bail out... &
X`012
X
X4000`009! We either had a wildcarded username or no exact match for the &
X`009! username. So, try to match any record in the complete database. &
X`009&
X`009nonwld%=len(user$) &
X`009\ for i%=1% to len(user$) &
X`009\ a$=mid(user$,i%,1%) &
X`009\ nonwld%=nonwld%-1% if a$="?" &
X`009\ nonwld%=nonwld%-1% if a$="%" &
X`009\ nonwld%=nonwld%-1% if a$="@" &
X`009\ next i% &
X`009\ goto 4005 if nonwld%>=minwld% &
X`009\ msg$="?FINGER - Too few non-wild characters in username."+ &
X`009   chr$(13%)+chr$(10%) &
X`009\ gosub 27000 &
X`009\ goto 4040 &
X`009! Determine the number of non-wild characters in the request. Compare &
X`009! with site-specified limit. Complain if too short. &
X
X4005`009find #10%, key #1% ge " " &
X`009! Start looking through the personal name fields &
X
X4010`009get #10% &
X`009\ goto 4010 if alias$="Y" &
X`009\ match$=cvt$$(persname$,160%) &
X`009\ goto 4010 if fnwild%(user$,match$)=0% &
X`009! Get the next record of personal names. If we don't match one, skip &
X`009! to next personal name. &
X
X4020`009msg$=username$+" - "+cvt$$(persname$,128%)+chr$(13%)+chr$(10%) &
X`009\ gosub 27000 &
X`009\ any%=any%+1% &
X`009\ goto 4010 &
X`009! Build the message string and display it. Increment the count of &
X`009! matched names and go get another. &
X
X4030`009msg$=user$+": No such user."+chr$(13%)+chr$(10%) &
X`009\ gosub 27000 if any%=0% &
X`009! Report the non-matching if indeed we didn't match any. &
X
X4040`009close #10% &
X`009\ goto 32600 &
X`009! All done, bail out. &
X`012
X
X25000`009! Functions and stuff &
X`009&
X`009def* fndatim$(zdate%,ztime%) &
X`009\ a$=sys(chr$(6%)+chr$(20%)+chr$(zdate%)+chr$(swap%(zdate%)) &
X`009   +chr$(1%)+chr$(swap%(1%))+string$(10%,0%)+chr$(ztime%) &
X`009   +chr$(swap%(ztime%))+chr$(1%)+chr$(swap%(1%))+string$(10%,0%)) &
X`009\ year%=val(mid(a$,7%,2%))+1900% &
X`009\ month%=val(mid(a$,10%,2%)) &
X`009\ day%=val(mid(a$,13%,2%)) &
X`009\ yf%=year%+(month%-14%)/12% &
X`009\ yf2%=yf%-(int(yf%/100%))*100% &
X`009\ dow%=((13%*(month%+10%-(month%+10%)/13%*12%)-1%)/5% &
X`009   +day%+77%+5%*yf2%/4% &
X`009   +yf%/400% &
X`009   -yf%/100%*2%) &
X`009\ dow%=dow%-(int(dow%/7%))*7% &
X`009\ fndatim$=day.week$(dow%)+", "+num1$(day%)+"-"+month.year$(month%-1%) &
X`009   +"-19"+mid(a$,7%,2%)+" "+mid(a$,21%,5%) &
X`009\ fnend &
X`009! Isn't this ugly? &
X`009! Get system date, pervert to sep. month, day, year values. &
X`009! Incant to get correct day of week (you don't want to know) &
X`009! and return w/ lookup text. &
X
X25010`009def* fnmaildate$(maildate$) &
X`009\ year%=val(left(maildate$,4%)) &
X`009\ month%=val(mid(maildate$,5%,2%)) &
X`009\ day%=val(mid(maildate$,7%,2%)) &
X`009\ yf%=year%+(month%-14%)/12% &
X`009\ yf2%=yf%-(int(yf%/100%))*100% &
X`009\ dow%=((13%*(month%+10%-(month%+10%)/13%*12%)-1%)/5% &
X`009   +day%+77%+5%*yf2%/4% &
X`009   +yf%/400% &
X`009   -yf%/100%*2%) &
X`009\ dow%=dow%-(int(dow%/7%))*7% &
X`009\ fnmaildate$=day.week$(dow%)+", "+num1$(day%)+"-"+ &
X`009   month.year$(month%-1%)+"-"+left(maildate$,4%)+" "+ &
X`009   mid(maildate$,9%,2%)+":"+mid(maildate$,11%,2%) &
X`009\ fnend &
X`009! Like fndatim$, but for Mail-11 internal format dates. &
X
X25020`009def* fnppntoname$(u.ppn$) &
X`009\ a$="<Unknown>" &
X`009\ get #10%, key #0% eq u.ppn$ &
X`009\ a$=cvt$$(username$,128%) &
X`009\ a$="<Logged out>" if u.ppn$=chr$(0%)+chr$(0%) &
X`009! Look up PPN in database. Default to "<Unknown>" if not present, &
X`009! or "<Logged out>" if the job is running under PPN [0,0]. &
X
X25030`009fnppntoname$=a$ &
X`009\ fnend &
X`009! Set the returned string and exit. &
X
X25040`009def* fnwild%(pattern$,candidate$) &
X`009\ r0%=0% &
X`009\ goto 25045 if wild%<>0% &
X`009\ goto 25080 if instr(1%,candidate$,pattern$)<>0% &
X`009\ goto 25100 &
X`009! See if a wildcard is present. If not, do fast lookup. &
X
X25045`009pattern$="*"+pattern$+"*" &
X`009\ r4%=len(pattern$) &
X`009\ r2%=len(candidate$) &
X`009\ r5%=1% &
X`009\ r3%=1% &
X`009\ r6%=0% &
X
X25050`009r4%=r4%-1% &
X`009\ goto 25070 if r4%<0% &
X`009\ r1$=mid(pattern$,r5%,1%) &
X`009\ r5%=r5%+1% &
X`009\ goto 25090 if r1$="*" &
X`009\ r2%=r2%-1% &
X`009\ goto 25100% if r2%<0% &
X`009\ a$=mid(candidate$,r3%,1%) &
X`009\ r3%=r3%+1% &
X`009\ goto 25050 if r1$=a$ &
X`009\ goto 25050 if r1$="%" &
X`009\ goto 25050 if r1$="?" &
X
X25060`009r6%=r6%-1% &
X`009\ goto 25100 if r6%<0% &
X`009\ r7%=r7%+1% &
X`009\ r2%=r6% &
X`009\ r3%=r7% &
X`009\ r4%=r8% &
X`009\ r5%=r9% &
X`009\ goto 25050 &
X
X25070`009goto 25060 if r2%<>0% &
X
X25080`009r0%=1% &
X`009\ goto 25100 &
X
X25090`009goto 25080 if r4%=0% &
X`009\ r6%=r2% &
X`009\ r7%=r3% &
X`009\ r8%=r4% &
X`009\ r9%=r5% &
X`009\ goto 25050 &
X
X25100`009fnwild%=r0% &
X`009\ fnend &
X`009! This function returns the match status of a pattern in a candidate. &
X`009! It was lifted from VMS FINGER's WILD.MAR routine, which sort of &
X`009! makes this a VAX in your 11 (or is that a turkey in your tank)? &
X
X25110`009def* fnactive%(u.proj%,u.prog%,j%) &
X`009\ fnactive%=0% &
X`009\ job0$=sys(chr$(6%)+chr$(26%)+chr$(j%)+chr$(0%)) &
X`009\ job1$=sys(chr$(6%)+chr$(26%)+chr$(j%)+chr$(1%)) &
X`009\ job2$=sys(chr$(6%)+chr$(26%)+chr$(j%)+chr$(2%)) &
X`009\ fnactive%=1% if (u.proj%=ascii(mid(job0$,22%,1%)) and &
X`009    u.prog%=ascii(mid(job0$,21%,1%))) &
X`009\ fnactive%=1% if u.proj%+u.prog%=0% &
X`009! See if user u.proj%,u.prog% is active on job j%. Return active if &
X`009! we are asking about any PPN as well. &
X
X25120`009fnend &
X`009! Return status to caller &
X
X25130`009def* fnheader% &
X`009\ msg$="" &
X`009\ msg$=msg$+"Job " if flags%(2%) and 1% &
X`009\ msg$=msg$+"Username     " if flags%(2%) and 2% &
X`009\ msg$=msg$+"  PPN   " if flags%(2%) and 4% &
X`009\ msg$=msg$+"Personal name        " if flags%(2%) and 8% &
X`009\ msg$=msg$+"Progrm " if flags%(2%) and 16% &
X`009\ msg$=msg$+"Term   " if flags%(2%) and 32% &
X`009\ msg$=msg$+"Login " if flags%(2%) and 64% &
X`009\ msg$=msg$+" CPU  " if flags%(2%) and 128% &
X`009\ msg$=msg$+"ST " if flags%(2%) and 256% &
X`009\ msg$=msg$+"Size  " if flags%(2%) and 512% &
X`009\ msg$=msg$+"Location         " if flags%(2%) and 1024% &
X`009\ msg$=msg$+"TTType  " if flags%(2%) and 2048% &
X`009\ msg$=msg$+"Pri/Rb " if flags%(2%) and 4096% &
X`009\ msg$=msg$+"RTS    " if flags%(2%) and 8192% &
X`009\ msg$=msg$+chr$(13%)+chr$(10%) &
X`009\ gosub 27000 if len(msg$)>3% &
X`009\ hdrout%=1% &
X`009\ fnend &
X`009! Display the status header &
X
X25140`009def* fngetjob%(j%) &
X`009\ u.proj%=ascii(mid(job0$,22%,1%)) &
X`009\ u.prog%=ascii(mid(job0$,21%,1%)) &
X`009\ u.ppn$=cvt%$(swap%(u.proj%)+u.prog%) &
X`009\ user$=fnppntoname$(u.ppn$) &
X`009\ u.name$=cvt$$(persname$,128%) &
X`009\ i%=ascii(mid(job2$,15%,1%)) &
X`009\ jobtyp%=1% if i%<2% &
X`009\ jobtyp%=2% if i%=2% &
X`009\ jobtyp%=4% if i%>3% &
X`009\ jobtyp%=8% if (u.proj%=1% and u.prog%=2%) &
X`009\ fngetjob%=jobtyp% &
X`009\ i%=fnheader% if hdrout%=0% &
X`009\ msg$="" &
X`009\ goto 25150 if (flags%(2%) and 1%) <> 1% &
X`009\ msg$=msg$+" " if j%<10% &
X`009\ msg$=msg$+num1$(j%)+"  " &
X`009! Look up the PPN and username of this job. Compute the job type. &
X`009! Display the header if required. Add the job number to the string &
X`009! if we are displaying it. &
X
X25150`009msg$=msg$+user$+string$(13%-len(user$),32%) if flags%(2%) and 2% &
X`009\ goto 25160 if (flags%(2%) and 4%) <> 4% &
X`009\ msg$=msg$+" " if u.proj%<10% &
X`009\ msg$=msg$+" " if u.proj%<100% &
X`009\ msg$=msg$+num1$(u.proj%)+","+num1$(u.prog%) unless &
X`009   u.proj%+u.prog%=0% &
X`009\ msg$=msg$+"*,*" if u.proj%+u.prog%=0% &
X`009\ msg$=msg$+" " if u.prog%<10% &
X`009\ msg$=msg$+" " if u.prog%<100% &
X`009\ msg$=msg$+" " &
X`009! Tack on username if required. Add the PPN to the string if we are &
X`009! displaying it. &
X
V25160`009msg$=msg$+u.name$+string$(21%-len(u.name$),32%) if flags%(2%) and 8%
X &
X`009\ msg$=msg$+rad$(swap%(cvt$%(mid(job0$,17%,2%))))+ &
X`009   rad$(swap%(cvt$%(mid(job0$,19%,2%))))+" " if flags%(2%) and 16% &
X`009\ i%=ascii(mid(job0$,4%,1%)) &
X`009\ detflg%=0% &
X`009\ detflg%=1% if i%>127% &
X`009\ goto 25170 if (flags%(2%) and 32%) <> 32% &
X`009\ msg$=msg$+"Det   " if detflg%=1% &
X`009\ msg$=msg$+"KB"+num1$(i%)+":" if detflg%=0% &
X`009\ msg$=msg$+" " if i%<10% &
X`009\ msg$=msg$+" " if i%<100% &
X`009\ msg$=msg$+" " &
X`009! Tack on the personal name if desired. Tack on the program name if &
X`009! desired. Tack on the KB number if desired. &
X
X25170`009goto 25200 if (flags%(2%) and 64%) <> 64% &
X`009\ i%=swap%(cvt$%(mid(job0$,9%,2%))) &
X`009\ j%=peek(514%) &
X`009\ k%=i%+j% &
X`009! Skip this mess if login time not desired. Otherwise get connect &
X`009! time, time now, and sum them &
X
X25180`009goto 25190 if k%<1441% &
X`009\ k%=k%-1440% &
X`009\ goto 25180 &
X`009! Normalize the time. &
X
X25190`009msg$=msg$+"      " if detflg%=1% &
X`009\ a$=sys(chr$(6%)+chr$(20%)+chr$(0%)+chr$(swap%(0%)) &
X`009   +chr$(1%)+chr$(swap%(1%))+string$(10%,0%)+chr$(k%) &
X`009   +chr$(swap%(k%))+chr$(1%)+chr$(swap%(1%))+string$(10%,0%)) &
X`009\ msg$=msg$+mid(a$,21%,5%)+" " if detflg%=0% &
X`009! Convert the time value to 24-hour format, unless the job is de- &
X`009! tached in which case we blank it out. &
X
X25200`009goto 25210 if (flags%(2%) and 128%) <> 128% &
X`009\ c=swap%(cvt$%(mid(job0$,7%,2%))) &
X`009\ c=c+65536. if c<0. &
X`009\ c=c+65536.*ascii(mid(job0$,16%,1%)) &
X`009\ c=c/10. &
X`009\ msg$=msg$+right(num1$((c/60.)+100000.),2%)+" " if c>5999. &
X`009\ goto 25210 if c>5999. &
X`009\ i%=c &
X`009\ j%=i%/60% &
X`009\ k%=i%-(j%*60%) &
X`009\ msg$=msg$+right(num1$(j%+100%),2%)+":"+right(num1$(k%+100%),2%)+" " &
X`009! Skip CPU time if not wanted. Determine the time in seconds and &
X`009! format it as '99999' if it won't fit as '99:59', otherwise format &
X`009! as '99:59' &
X
X25210`009msg$=msg$+fnstate$+" " if flags%(2%) and 256% &
X`009\ goto 25220 if (flags%(2%) and 512%) <> 512% &
X`009\ i%=ascii(mid(job1$,13%,1%)) &
X`009\ j%=ascii(mid(job1$,19%,1%)) &
X`009\ msg$=msg$+" " if i%<10% &
X`009\ msg$=msg$+num1$(i%)+"/" &
X`009\ msg$=msg$+" " if j%<10% &
X`009\ msg$=msg$+num1$(j%)+" " &
X`009! Tack on job state if desired. Tack on current/maximum size if &
X`009! desired. &
X
X25220`009locatn$="                " &
X`009\ locatn$="- Batch queue - " if jobtyp%=2% &
X        \ locatn$="- DECnet -      " if jobtyp%=4% &
X`009\ locatn$="- Detached -    " if detflg%=1% &
X`009\ tttype$="       " &
X`009\ goto 25240 if left(locatn$,1%)<>" " &
X`009\ i%=ascii(mid(job0$,4%,1%))+8% &
X`009\ j%=i%/8% &
X`009\ k%=(i%-(j%*8%))*64% &
X`009\ get #9%, record j%+1% &
X`009\ locatn$=mid(buff9$,k%+4%,16%) &
X`009\ tttype$=mid(buff9$,k%+20%,7%) &
X`009\ a$=sys(chr$(6%)+chr$(22%)+chr$(12%)+chr$(6%)+chr$(0%)+chr$(0%)+ &
X`009   chr$(i%-8%)+string$(3%,0%)+chr$(9%)+string$(29%,0%)) &
X`009! Preset location and terminal type to spaces. If detached, bail &
X`009! out. Otherwise get the record we want (add 4 for a header). &
X`009! Make a try for LAT information. &
X
X25230`009i%=ascii(mid(buff9$,3%,1%)) &
X`009\ b$=mid(buff9$,4%,i%) &
X`009\ j%=ascii(mid(buff9$,i%+4%,1%)) &
X`009\ locatn$=mid(buff9$,i%+5%,j%)+" "+b$ &
X`009\ locatn$="Dialup "+right(b$,8%) if left(b$,7%)="DIALUP." &
X`009\ locatn$=left(locatn$,16%) if len(locatn$)>16% &
X`009\ locatn$=locatn$+string$(16%-len(locatn$),32%) &
X`009! Construct a LAT location field &
X
X25240`009msg$=msg$+locatn$+" " if flags%(2%) and 1024% &
X`009\ goto 25250 if (flags%(2%) and 2048%) <> 2048% &
X`009\ msg$=msg$+tttype$+" " if tttype$<>"Unknown" &
X`009\ goto 25250 if tttype$<>"Unknown" &
X`009\ a$=sys(chr$(6%)+chr$(16%)+chr$(1%)+mid(job0$,4%,1%)+string$(26%,0%)) &
X`009\ i%=ascii(mid(a$,5%,1%)) &
X`009\ goto 25250 if i%<1% &
X`009\ goto 25250 if i%>50% &
X`009\ msg$=msg$+mid(tttabl$,(i%-1%)*7%+1%,7%)+" " &
X`009! Tack on location field. Bail out if terminal type not desired, &
X`009! otherwise tack on user text if not 'Unknown', else get type code &
X`009! from system and convert to type. &
X
X25250`009goto 25260 if (flags%(2%) and 4096%) <> 4096% &
X`009\ b$=num1$(ascii(mid(job1$,17%,1%))*256%/256%) &
X`009\ msg$=msg$+string$(3%-len(b$),32%)+b$+"/" &
X`009\ i%=ascii(mid(job1$,18%,1%)) &
X`009\ msg$=msg$+num1$(i%) &
X`009\ msg$=msg$+" " if i%<10% &
X`009\ msg$=msg$+" " &
X`009! Skip this if PRI/RB not desired. Otherwise tack on priority and &
X`009! runburst information. &
X
X25260`009goto 25270 if (flags%(2%) and 8192%) <> 8192% &
X`009\ msg$=msg$+rad$(swap%(cvt$%(mid(job0$,27%,2%))))+ &
-+-+-+-+-+ End of part 3 +-+-+-+-+-
