! This is a TECO program to view files (sort of like the TYPE command). To run it, type VIEW . To create VIEW.EXE, run EMACS:TECO (without using EMACS:TECO.INIT) and type erVIEW.TECO @y m(hfx*) 10f? ei @ejVIEW.EXE Written by David Eppstein, 12-Oct-82. Edit history: [DE] 1-Apr-83 Add % command to toggle --More-- vs --nn%-- display. [DE] 2-Aug-83 Add L command to list viewed file names. ^Z exits. [DE] 2-Oct-85 Speed up G to current page (e.g. for losing search). Q-Register usage: mC - clear echo area mF - find a new file. pre-comma means look at JCL first mG - go to a given page in the file qL - list of wildcard files qN - page number mP - go forward arg pages mR - read a line from the terminal mT - attempt to ER a filename qX - fs IF Access for next page ! -1fs^IDisable !Make tabs work right for comments! 1fs^LInsert !Leave formfeeds in files! :i*fsSString !No search default yet! 1fsBothCase !Ignore case in searches! 0fs%Bottom !Don't complain about cursor! 0fs%Top !being anywhere on the screen! @:i*|1fsEchoLines|fsTTYMacro !One line echo area! -1fs^REcho !Echo typed in commands! 1fsEchoErrors !Echo errors in echo area! 1fs^RMore !Use --More-- instead of percent! 1fsInvMode !Mode line in reverse video! @:i*|-(fsQPPtr*2)fsModeCh f[BBind i[Viewing g(fsDFile)i, page qN\]i hx..J0|fsModeMac !Set up mode line macro! @:iC|:i*CfsEchoDispw| !qC clears echo area! @:iP|[0 1fsModeCh f"l w'<.u0 zj a z-.f(+qXuX)"e q0j "g @fg'' 0,.k -@f ki  j qN"n 2f= "e 2d'' %N>| !qP goes to the next page of file! @:iT|[0 1:"e 0' f=(fsError)OPN0113"l fsError' "n fsError' qL[..o hk 1:<1,111110000001.ez0>f"n ' j<.-z@; :x*(@L1,)mTf"e '> fsError| !qT checks a file and sets up list! fsBConsuL !qL is list of files! @:iF|fsDFile[0 @fn/q0fsDFile/ 0[1 "n f[BBind hk fj j:l -@f L .,zk z"n fsMSNamefsDSName q..omT"e fsDFileu1'"# @fg qN"l 0fsPJATYw fsErroru..J fr' "# mC fsError@fg 0'''"# qN:"l 1: w0'' f]BBind' "e fsDFilemT"e fsDFileu1'' q1"e @fg fsErroru..J fr 1fsModeCh'> -1fsPJATY fsIFVersfsDVers fsDFileu0 hk 0uN 0uX 1:mP| !qF finds a file! @:iG|-qN"e' :f"g @fg0'-qNf"G:mP' 0fsIFAccess hk 0uN 0uX :mP| !qG goes to a given page! @:iR|q..o[2 f[BBind [0 [1 !ReDisp! mC @ft1..o "n @fg' oRedisp' q0-"e u0 @ft0 g0 !' q0-"e 1f[NoQuit fiu0 f]NoQuit' @ft0 q0i>| !qR reads a line w/line editing! 0fs^RInitu0 -1u1 !Set up to clear key defs! 400. !Clear defs of all keys! afs^RInitu0 a-1u1 26 !Set lower-case synonyms! @:i.L|ff&3"e-1fsPJATY' "# 1fsModeCh mC 0'| !^L refreshes screen (mode line w/arg)! :i  !^M does nothing quietly! :i.N"l -:mP' @L .-z"e @fg -1@L' :f 0@:f 0 !^N goes to next line! q.Nu !Linefeed ditto! @:i.P|"l -:mN' -@L 0f[%Center 0f[%End 0@v 0| !^P goes to previous line! q.Pu^ !Uparrow ditto! @:i |"l -:m' [0 <.u0 0:f fsWindow-(zj :f fsWindow (q0j))"e qN-(1mP qN)"e @fg 0:f '' "# 1:'> 0:f | !Space goes forward a screenful! q u.V !as does ^V! @:i|"l -:m ' <."e qN-1f"e @fg 0'mG zj :f fsWindowj' "# -1"e @'-1:f fsWindowj'>| !Backspace goes back a screenful! 460.fs^RInitu0 57.u1 10 !Minus autoarguments! :i|zj :f fsWindowj 0| !> goes to end of page! @:i%|0fsModified -(fs^RMore"'e)fs^RMorew| !% toggles --More-- or --nn%-- display! @:i-|."e @fg 0' fsHeight-2/2@:f fsWindowj 0| !- goes back half a page! @:i+|1: .-z"e fsWindowj @fg 0' 0@:f 0| !+ goes forward half a page! @:i*|fqL"e @fg 0' [0 qL[..o ff&3"n j-1@L' <.-z@; :x*(@L1,)mT"e ]..o hk 0uN 0uX 1:mP'> @fg 0| !* goes to the next file in a group! qFuF !F finds a new file! qGuJ !J goes to a given page number! @:iL|fqL"e @fg 0' qL[..o .[1 fnq1j -l .[1 ftFiles being viewed (* is current):  j 0[0 <.-z; fsListen@:; .-q1"e ft* '"# ft ' %0:= q0-10"lft '"#ft ' tl> 0| !L lists files being viewed! :iNqN+:mG !N goes to the next page! :iPqN-:mG !P goes to the previous page! :iR-:mS !R is reverse search! qRu.R !as is ^R! @:iS|fsSString[0 f[BBind -1"n f"l+1"n -\ i''"#\ i'' "liReverse ' iSearch fq0"g i (0)' i:  q0,(hfx*(f]BBind))mRu0 fq0"l 0'fq0"g 0s0' qN[1 .[2 qN[3 :"l @:L <:s"e qN-(1mPqN)"e q1mG q2j 0;' !' qNu1 .u2> 0@L qN-q3"e :f 0@:f 0'"# 0:f'' -<-:s"e qN-1"e q1mG q2j @fg 0;' qN-1mG zj !' qNu1 .u2> 0@L qN-q3"e 0f[%Center 0f[%End 0@v 0'"# 0:f'| !S searches! qSu.S !as does ^S! @:iQ|ec mC fsExit 1:"n 1f[NoQuit 0fsPJATYw fsError[..J fr :mF' qXfsIFAccessw| !Q exits to superior, closing file! qQu.Z !as does ^Z! :iZ-1:mP !Z goes to the last page of the file! qCu !Delete clears echo area, arguments! @:i?|ft VIEW command characters ^L refreshes the screen, or with an argument the mode line. ^N goes to the next line, ^P to the previous line on the page. Space goes to the next screen, backspace the previous screen. Digits build up an argument for other key commands. + goes forward half a screen, - back half a screen. * goes to the next file in a wildcard spec. L lists viewed files. < goes to the start of the current page, > the end of the page. F finds a new file (this is done automatically on startup). J goes to the start of the file, or to a given page. N goes to the next page in the file, P to the previous page. Q exits the VIEW program (it can be continued). S is search, and R is reverse search for some string. Z goes to the last page in the file. % toggles --More--. Delete clears the the echo area. ? types this cruft.  0| !? lists available commands! -1uN !No page number yet! @:i..L|1fsNoQuit m(fsTTYMacro) 1,mF | !Enter recursive edit on startup! !(should be no way to exit it)! fsMSNamefsDSName etFOO..0 !Reset default filenames! @:i*|0fsNoQuit|fs^REnter !Allow ^G once user is in ^R! Local Modes: Mode:TECO Comment Start:! Comment Begin:! Comment End:! Comment Column: 40 End: