| 1 |
% Makes a landscape listing of one or more files |
| 2 |
% Typical usage: |
| 3 |
% tex llist *.c \\end |
| 4 |
|
| 5 |
\def\grabfile#1 {\setbox0=\lastbox\endgraf\doit{#1}} |
| 6 |
\everypar{\grabfile} |
| 7 |
|
| 8 |
\font\filenamefont= cmtt8 scaled\magstep3 |
| 9 |
\font\headlinefont= cmr8 |
| 10 |
\font\listingfont= cmtex8 |
| 11 |
\font\eoffont= cmti8 |
| 12 |
|
| 13 |
\def\today{\ifcase\month\or |
| 14 |
January\or February\or March\or April\or May\or June\or |
| 15 |
July\or August\or September\or October\or November\or December\fi |
| 16 |
\space\number\day, \number\year} |
| 17 |
\newcount\m \newcount\n |
| 18 |
\n=\time \divide\n 60 \m=-\n \multiply\m 60 \advance\m \time |
| 19 |
\def\hours{\twodigits\n\twodigits\m} |
| 20 |
\def\twodigits#1{\ifnum #1<10 0\fi \number#1} |
| 21 |
|
| 22 |
\newlinechar=`@ |
| 23 |
\message{@\today\space at \hours} |
| 24 |
|
| 25 |
\baselineskip=9pt |
| 26 |
\medskipamount=4pt minus 1pt |
| 27 |
\raggedbottom |
| 28 |
\nopagenumbers |
| 29 |
|
| 30 |
\chardef\other=12 |
| 31 |
\def\doit#1{\message{@Listing #1@} |
| 32 |
\begingroup \everypar{} \frenchspacing |
| 33 |
\headline{\ifright \headlinefont \hfill Page \folio |
| 34 |
\else\filenamefont#1\quad\headlinefont \today\ at \hours\hss \fi} |
| 35 |
\def\do##1{\catcode`##1=\other}\dospecials |
| 36 |
\catcode127=\other \catcode9=\other \catcode12=\other |
| 37 |
\parindent 0pt \parfillskip=0pt plus 1fil minus .8in |
| 38 |
\everypar{\hangindent 1in} \rightskip=0pt plus 2in |
| 39 |
\def\par{\ifvmode\penalty-50\medskip\else\endgraf\fi} |
| 40 |
\listingfont \obeylines \obeyspaces \global\pageno=1 |
| 41 |
\input #1 {\eoffont(end of\/ file)}\endgraf\vfill\eject |
| 42 |
\ifright\null\vfill\eject\fi\endgroup} |
| 43 |
{\obeyspaces\global\let =\ } |
| 44 |
\catcode`\_=\other % allow _ in file names |
| 45 |
|
| 46 |
\hsize=4.6truein |
| 47 |
\vsize=7truein |
| 48 |
\hoffset=-.5truein |
| 49 |
\voffset=-.2truein |
| 50 |
\newif\ifright |
| 51 |
\newbox\lefthalf |
| 52 |
\output{\ifright |
| 53 |
\shipout\hbox{\hbox to5.5in{\box\lefthalf\hss}% |
| 54 |
\vbox{\makeheadline\pagebody\makefootline}} |
| 55 |
\advancepageno\global\rightfalse |
| 56 |
\else\global\setbox\lefthalf\vbox{\makeheadline\pagebody\makefootline} |
| 57 |
\global\righttrue\fi} |
| 58 |
|
| 59 |
\special{landscape} |
| 60 |
|
| 61 |
% A tab (^^I) prints as lowercase gamma. |
| 62 |
% Character ^^M could be made visible, with a bit of work; |
| 63 |
% at present, it's indistinguishable from newline (^^J). |
| 64 |
|
| 65 |
% You can get up to 91 characters on a line without an overfull box. |
| 66 |
% (But lines with more than 84 characters will be clipped, if they |
| 67 |
% appear on a righthand halfpage.) |