$! LOGIN.COM - The world's longest login command file $! $! Author: Peter Johansson (peter@cs.umbc.edu) $! $! This file is intended for informational purposes only - Execute it at $! your own risk. All code Copyright (C) 1993 by Peter Johansson. $! $! Non-commercial use unrestricted so long as all attributions remain $! intact. That is, if you use any part or parts of this code, I want $! credit for my work. $! $! --- begin origonal file --- $! $! Login.com $! By: Peter<@umbc2.bitnet> Johansson $! $! Last major update: 2-Apr-1989 $! $ save_verify = f$verify(0) ! shut off verify for batch jobs and such... $! $! This program may be called by any user. $! $! Input variables: $! p1 - the user's desired (root) process name $! p2 - if p2 = "SHOW" then the login.com statictics will be shown $! (they will always be shown from any of "my" accounts) $! p3 - if p3 = "NOCHECK" then the autocheck for mail, files, and news $! will be aborted. $! $ set noon $ set control=(t,y) $ on control_y then goto byebye $! $! save the current WALL time and CPU time for later use... $! $ time = f$time() $ starttim = 6000 * f$int(f$cvt(time,,"minute")) + - f$int(f$cvt(time,,"second")+f$cvt(time,,"hundredth")) $ startcputim = f$integer (f$getjpi ("", "cputim")) $! $! CTRL char symbols $! $ bell[0,32] = %x07 $ lf[0,32] = %x0A $ cr[0,32] = %x0D $ esc[0,32] = %x1B $ nl = cr + lf ! new (or next) line $! $! Stuff... $! $ username = f$edit (f$getjpi ("", "username"), "collapse") $ node = f$edit (f$getsyi ("nodename"), "collapse, lowercase") $! $! System SET's $! $ set prot=(s:rwe,o:rwed,g,w)/default $! $! DEFINEitions $! $ define = "define/nolog" $! $! directories -- staff account $! $ define $home "staff:[peter]" $ def_dirs: $ rd = f$search ("staff:[peter]$*.dir") $ if rd .eqs. "" then goto def_dirs_done $ d_log = f$parse (rd,,,"name") $ d_dir = f$element(0,"]",rd) + ".''d_log']" $ define 'd_log 'd_dir $ goto def_dirs $ def_dirs_done: $! $ if f$search("sys$login:$scratch.dir") .nes. "" then - define/job sys$scratch 'f$string(f$trnlnm("sys$login")-"]"+".$scratch]") $! $! ------------------- $! $! Check non-interactive logins... $! (This is a good (allbeit strange) place to seperate $! interactive/noninteractive logins.) $! $ mode = f$mode() $ if mode .eqs. "INTERACTIVE" then goto interactive $! $ write sys$output "Login.com file exited on ''mode' login." $ prcnam = f$extract (0, 15, username + "'S " + mode) $ set process/name="''prcnam'" $ show proc $ delete/symbol define $ exit $! $! ------------------- $! $ interactive: $! $ define dbg$init "$util:init.dbg" $ define lnk$library "sys$library:vaxcrtl" $ define mail$edit "$com:eve_mail" $! $! SYMBOL definitions $! $! EMACS stuff $! (don't even bother to ask what happened to *this* EVE freak...) $! $ emacsdef/output=nla0: $! $! Printer symbols & Latex stuff $! $ @$com:prconfig $ define tex_user_inputs staff:[peter.$tex.$inputs] $ deftex2/output=nla0: $ tex == "@$com:tex tex" $ latex == "@$com:tex latex" $! $! redefine define PF keys $! $ define = "define/key/nolog/erase/echo/term" $ define pf1 "dd" $ define pf2 "recall/all" $ define pf3 "attach eve" $ define pf4 "who" $! $! restore define symbol to it's natural state $ delete/symbol define $! $! Programming (debugging) symbols $! $ init == "@sys$login:login" $ ss == "show symbol" $ ssg == "show symbol/global" $ sl == "show logical/full" $ wr == "write sys$output" $ tron == "set verify" $ troff == "set noverify" $ msg == "set message/fac/ident/sev/text" $ du == "define/user" $ dui == "define/user sys$input" $ duo == "define/user sys$output" $ d4 == "define/key/nolog/noerase/echo/noterm pf4" $! $! General use symbols $! $ vsdef == "set command spell_dict:spell" $ critdef == "set command engl$:comdef" $ ek == "spawn/proc=eve edit/tpu" $ v*iew == "edit/tpu/nojournal/nocreate/modify/nowrite" $ he*lp == "help/nopage" $ w*ho == "show user" $ iam == "set process/name=" $ ra == "recall/all" $ t == "type" $ tp == "type/page" $ del == "delete/confirm" $ pur == "purge/log" $ qc == "delete *.obj;*, *.exe;*" $ qcl == "''qc', *.lis;*, *.out;*, *.log;*" $ lc == "delete *.lis;*, *.dvi;*, *.aux;*, *.ln3;*" $ netc*lean == "delete sys$login:netserver.log;*" $ lock == "set file/prot=(o:rwe)" $ free == "set file/prot=(o:rwed)" $ owner == "set prot=(g,w) $ group == "set prot=(g:re,w) $ world == "set prot=(g:re,w:re) $ d == "directory" $ dd == "directory/width=(filename:26,size:5)/size=all/prot" $ ddd == "''dd'/date=modified" $ ff == "''dd'/exclude=*.dir [...]" $ fff == "''ddd'/exclude=*.dir [...]" $ watch == "show process/continous" $ vt52 == "set term/device=vt52" $ vt1*00 == "set term/device=vt101" $ vt2*00 == "set term/device=vt200" $ lo*gout == "logout" $ bye == "logout" $ off == "stop/id=0" $ arc*hive == "$staff:[peter.$util.$sweep]vmssweep" $ sz == "$staff:[peter.$util.$zmodem]sz -\L 1024 -l 1024" $ rz == "$staff:[peter.$util.$zmodem]rz" $ xm*odem == "$staff:[peter.$util.$xmodem]xmodem" $ xmd*elete == "delete xmodem.log;*" $ compress == "$unsupported$:[lz_compress]lzcmp" $ uncompress == "$unsupported$:[lz_compress]lzdcm" $ zoo == "$$255$dua7:[1988_decus.fall.vax88b5.rcaf88.netf88.vmszoo]zoo" $! $! batch and subprocess commands $! $ batch == "submit/notify/keep/noprint" $ batch1 == "submit/notify/keep/noprint/queue=umbc1_batch" $ batch2 == "submit/notify/keep/noprint/queue=umbc2_batch" $ double == "spawn/nowait/notify/input=nl:/output=sys$scratch:double.out" $ doubletype == "type sys$scratch:double.out" $ doubledel == "delete sys$scratch:double.out;*" $! $! monitor commands (requires privs.) $! $ cpu == "monitor process/topcpu" $ stats == "monitor system" $ cluster == "monitor cluster" $! $! UNIX definitions (for when your in a UNIX kinda mood) $! $ cat == "type" $ cp == "copy" $ df == "show quota" $ echo == "write sys$output" $ ls == "dir" $ more == "type/page" $ mv == "rename" $ ps == "show process/sub" $ pwd == "show default" $ rm == "delete" $ script == "photo" $ f == "attach/id=''f$getjpi("","master_pid")'" $ fg == "attach ''username'_1" $ fgg == "attach ''username'_2" $! $! Compilation/linking/debugging symbols $! $ l == "link" $ ld == "link/debug" $ rd == "run/nodebug" !because debug is default for dbg .EXEs $! $! run_util.com symbol definitions $! $ prun == "@$com:run_util pascal /noopt/lis / /" $ crun == "@$com:run_util cc /lis / /" $ frun == "@$com:run_util fortran /extend/lis / /" $ mrun == "@$com:run_util macro /deb/lis /deb /" $! $! du.com symbol definitions $! $ ds == "''ss' dir$last" $ dirhelp == "@$com:du" $ cd == "@$com:du cd" $ p == "@$com:du prompt" $ h*ome == "@$com:du home" $ up == "@$com:du up" $ do*wn == "@$com:du down" $ mkdir == "@$com:du mkdir" $ rmdir == "@$com:du rmdir" $ tree == "@$com:du tree" $ downto == "@$com:du downto" $ fi*nd == "@$com:du find" $! $! other .com symbol and program definitions $! $ es == "''ss' eve$last" $ e == "@$com:eve" $ lisp == "@$com:lisp" $ clean == "@$com:clean" ! fixed for vms 5.0 4/21/89 $ renum*ber == "@$com:renumber" $ rad == "@$com:rad" $ me == "@$com:howmany" $ when == "@$com:date_time" $ meonly == "@$com:get_me_off" $ inuse == "@$com:inuse nohelp" $ fty*pe == "@$com:ftype" $ decnet == "@$com:decnet" $ where == "@$com:where" $ spy == "@$com:spy" $ user*s == "@$com:users" $ spam == "@$com:spam" $ spamf*ile == "@$com:spamfile" $ dec*ide == "@$com:decide" $ guess == "@$com:guess" $ pay*me == "@$com:timesheet" $ rrn == "@$com:rrn" $ save == "@$com:rrn_save" $ cbip == "@$com:rrn_cbip" $! $! mail/send/phone symbols $! $ fn*ame == "search $misc:names.dat" $ chat == "$staff:[peter.$util.$misc]lisp" $ termlock == "$staff:[peter.$util.$termlock]termlock" $ ql*og == "spawn/nowait/input=nl:/proc=ans_mach " + - "run staff:[peter.$util.$answer]answer" $ q*uiet == "set term/nobroad" $ qg*one == "set term/nobroad/brdcstmbx" $ noq*uiet == "set term/broad" $ m*ail == "mail/ed" $ ph*one == "phone/switch=""`""" $ a*nswer == "''phone' answer" $ busy == "phone reject exit quiet" $ pd1 == "phone dir umbc1::" $ pd2 == "phone dir umbc2::" $ s == "send" $ sfv == "send/file/vms" $ sr == "send/remote" $ sr1 == "''sr' umbc1" $ sr2 == "''sr' umbc2" $ sc == "send/command" $ sc1 == "''sc' umbc1" $ sc2 == "''sc' umbc2" $! $ bitfind == "search bitnet_nodes" $ relayup == "''sc' auvm cpq user relay" $ relay == "send/noprompt relay@auvm" $! $! misc. garbage symbols. $! $ qix == "$staff:[peter.$util.$games]qix" $ yow == "$staff:[peter.$util.$yow]yow" $ coo*kie == "$staff:[al.util]fortune" $ die == "''wr' ""Unfortunately, as a result of your carelessness, the computer has died.""" $ think == "''wr' ""The answer to the ultimate question of life, the universe, and everything is 42.""" $! $! Reset terminal stuff... $! $ setup: $ if f$getdvi ("tt", "devtype") .ne. 0 then goto good_term $ set term/device=vt101 $ wr nl + "Terminal device_type set to VT-101" + bell $ good_term: $ set term/insert $ wr esc+"[?4l" + esc+"[?5l" + esc+"[?8h" $! jump scroll normal scrn auto rep on $! $! Let's determine who is running the show! $! $ my_accounts = "/PETER/" $ if f$loc("/''username'/", my_accounts) .lt. f$len(my_accounts) then goto peter $! $! Someone Else! $ if p1 .eqs. "" then p1 = username $! no show is default $! check is default $!!! @$uselog:uselog "''p1'" ! we don't ned to do this anymore... $ goto set_prcnam $! $ peter: $! "123456789012345" $ p1 = "Rock Lobster" $ p2 = "SHOW" $! check is default $! $ set_prcnam: $ p1 = f$extract(0,15,p1) ! because of "the bug" $ pnam = p1 $ pnum = 1 $ prcnam_loop: $ set process/name = "''pnam'" $ if $severity .eq. 1 then goto greet_me $ p1 = f$extract (0, 13, p1) $ pnum = pnum + 1 $ pnam = "''p1' ''pnum'" $ goto prcnam_loop $! $! Lets have a red carpet welcome! $! $ greet_me: $ set noon $ on control_y then exit $ hr = f$integer (f$cvtime(,,"hour")) $ pun = "." $ if hr .ge. 6 then goto cont $ msg = "What are you doing up so late " $ pun = " ???" $ cont: $ if (hr .ge. 6) .and. (hr .lt. 12) then msg = "Good morning " $ if (hr .ge. 12) .and. (hr .lt. 18) then msg = "Good afternoon " $ if hr .ge. 18 then msg = "Good evening " $ wr esc+"[2J"+esc+"[H" + msg + f$getjpi ("", "prcnam") + pun + nl $! $ when ! date and time $ wr "" $ me ! logins... (howmany) $ wr "" $ cookie ! give us a cookie. $ wr "" $! $ prompt == "[''username'/''node'" $ if logins .gt. 1 then prompt == "''prompt'/''logins'" $ prompt == "''prompt'] " $ set prompt = "''prompt'" $ dir$prompt == 0 ! directory prompt is OFF $! $ time = f$time() $ stoptim = 6000 * f$int(f$cvt(time,,"minute")) + - f$int(f$cvt(time,,"second")+f$cvt(time,,"hundredth")) $ stopcputim = f$integer (f$getjpi ("", "cputim")) $ timeused = stoptim - starttim $ cputimeused = stopcputim - startcputim $ load = timeused / cputimeused $! $ if p2 .nes. "SHOW" then goto loadcheck $ wr nl + "Login.com run statistics:" $ wr "Real seconds (x100) used: " + f$string (timeused) $ wr "CPU seconds (x100) used: " + f$string (cputimeused) $ wr "Approximate system load : " + f$string (load) $ wr nl $! $ loadcheck: $ if p3 .eqs. "NOCHECK" then goto byebye $ if load .lt. 10 then goto mail_check $ type sys$input System load too heavy to check for mail, news and files. Now exiting login.com... $ goto pay_check ! it's never too busy to miss a paycheck! $! $! check for mail... $! $ mail_check: $ on warning then goto nomail $ define/nolog sys$output sys$scratch:mailcheck.tmp $ mail $ deassign sys$output $ open/read/error=nomail mfinp sys$scratch:mailcheck.tmp $ read/end=nomail/error=nomail mfinp stuff $ read/end=nomail/error=nomail mfinp stuff $ close mfinp $ delete sys$scratch:mailcheck.tmp;* $ num = f$int (f$extract (9, 2, stuff)) $ if num .le. 0 then goto file_check $ msg = "it" $ if num .gt. 1 then msg = "them" $ pmt = f$fao ("You have !SL new mail message!%S. Read !AS now? [y/n] ", - num, msg) $ read/end=file_check/error=file_check/prompt="''pmt'" sys$command stuff $ if (.not. stuff) then goto file_check $ define/nolog sys$input sys$command $ mail $ deassign sys$input $ wr "" $ goto file_check $ nomail: $ on warning then goto file_check $ close mfinp $ delete sys$scratch:mailcheck.tmp;* $! $! check for network files... $! $ file_check: $ on warning then goto news_check: $ spe = f$parse (username, "jan_receive:.rsc;*",,,"syntax_only") $ num = 0 $ file_loop: $ if f$search (spe) .eqs. "" then goto file_done $ num = num + 1 $ goto file_loop $ file_done: $ if num .le. 0 then goto news_check $ msg = "it" $ if num .gt. 1 then msg = "them" $ pmt = f$fao ("You have !SL network file!%S. Receive !AS now? [y/n] ", - num, msg) $ read/end=news_check/error=news_check/prompt="''pmt'" sys$command stuff $ if (.not. stuff) then goto news_check $ if f$search("sys$login:$receive.dir") .nes. "" then set default [.$receive] $ define/nolog sys$input sys$command $ receive $ deassign sys$input $ set default sys$login $ wr "" $! $! Check for new entries in NEWS files $! $ news_check: $ on warning then goto news_error $ define/nolog system_news syslib:[news]newslib.txt ! Kludge! $ if f$search("sys$login:news.ver") .eqs. "" then goto pay_check $ open/read/end=news_eof/error=news_error news_in_file sys$login:news.ver $ open/write/error=news_error news_out_file sys$login:news.ver $ news_loop: $ read/end=news_eof news_in_file news_data $ news_logical = f$edit(f$extract(0,40,news_data),"COLLAPSE") $ news_rdt = f$extract (40,23,news_data) $ current_rdt = f$file_attributes(news_logical, "RDT") $ news_data = f$fao("!40AS!23AS",news_logical,current_rdt) $ write news_out_file news_data $ if news_rdt .eqs. current_rdt then goto news_loop $ write sys$output f$fao("More entries were added to !AS on !AS", - news_logical, current_rdt) $! add line here to actually run news program. $ goto news_loop $ news_error: $ type sys$input Error while checking for new news entries or no news data file found. (send me mail for info on how to fix this) $ news_eof: $ on warning then goto pay_check $ if f$trnlnm("news_in_file") .nes. "" then close news_in_file $ if f$trnlnm("news_out_file") .nes. "" then close news_out_file $ purge sys$login:news.ver $! $! do we need to turn in a timesheet or pick up a paycheck? $! $ pay_check: $ on warning then goto byebye $ if f$search("sys$login:paycheck.dat") .eqs. "" then goto byebye $ query_0 = "Have you turned in your timesheet yet? " $ query_1 = "Have you picked up your paycheck yet? " $ open/read pay_datafile sys$login:paycheck.dat $ read pay_datafile pay_date $ read pay_datafile pay_type $ close pay_datafile $ if f$cvtime() .lts. f$cvtime(pay_date) then goto byebye $ pay_pmt = query_'pay_type $ read/end=set_prcnam/error=set_prcnam/prompt="''pay_pmt'" - sys$command pay_choice $ if (.not. pay_choice) then goto byebye $ open/write pay_datafile sys$login:paycheck.dat $ write pay_datafile f$cvtime ("''pay_date'+7-", "ABSOLUTE") $ write pay_datafile f$string ((.not. (pay_type-1)) + 1) $ close pay_datafile $ purge sys$login:paycheck.dat $! $ byebye: $ set noon $ exit $!