% Makes a 10-column landscape listing of one or more files with narrow lines
% Typical usage:
% tex 10list foo \\end
% and then use gv to print the result (my dvips has trouble with landscape)
\def\grabfile#1 {\setbox0=\lastbox\endgraf\doit{#1}}
\everypar{\grabfile}
\font\filenamefont= cmtt8 scaled\magstep3
\font\headlinefont= cmr8
\font\listingfont= cmtex8
\font\eoffont= cmti8
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day, \number\year}
\newcount\m \newcount\n
\n=\time \divide\n 60 \m=-\n \multiply\m 60 \advance\m \time
\def\hours{\twodigits\n\twodigits\m}
\def\twodigits#1{\ifnum #1<10 0\fi \number#1}
\newlinechar=`@
\message{@\today\space at \hours}
\baselineskip=9pt
\medskipamount=4pt minus 1pt
\raggedbottom
\nopagenumbers
\chardef\other=12
\def\doit#1{\message{@Listing #1@}
\begingroup \everypar{} \frenchspacing
\headline{\hbox to10in{\filenamefont#1\quad
\headlinefont \today\ at \hours\hskip3in Page \folio\hss}\hss}
\def\do##1{\catcode`##1=\other}\dospecials
\catcode127=\other \catcode9=\other \catcode12=\other
\parindent 0pt \parfillskip=0pt plus 1fil minus .8in
\everypar{\hangindent 1in} \rightskip=0pt plus 2in
\def\par{\ifvmode\penalty-50\medskip\else\endgraf\fi}
\listingfont \obeylines \obeyspaces \global\pageno=1
\input #1 {\eoffont(end of\/ file)}\endgraf\vfill\eject
\ifright\null\vfill\eject\fi\endgroup}
{\obeyspaces\global\let =\ }
\catcode`\_=\other % allow _ in file names
\hsize=.9truein
\vsize=7truein
\hoffset=-.5truein
\voffset=-.2truein
\newif\ifright
\newcount\boxnum \boxnum=0
\output{\ifright\else\ifcase\boxnum
\global\setbox0=\vbox{\makeheadline\pagebody\makefootline}\global\boxnum=1\or
\global\setbox1=\vbox{\pagebody\makefootline}\global\boxnum=2\or
\global\setbox2=\vbox{\pagebody\makefootline}\global\boxnum=3\or
\global\setbox3=\vbox{\pagebody\makefootline}\global\boxnum=4\or
\global\setbox4=\vbox{\pagebody\makefootline}\global\boxnum=5\or
\global\setbox5=\vbox{\pagebody\makefootline}\global\boxnum=6\or
\global\setbox6=\vbox{\pagebody\makefootline}\global\boxnum=7\or
\global\setbox7=\vbox{\pagebody\makefootline}\global\boxnum=8\or
\global\setbox8=\vbox{\pagebody\makefootline}\global\boxnum=9\or
\shipout\hbox{\hbox to1truein{\box0\hss}%
\hbox to1truein{\box1\hss}%
\hbox to1truein{\box2\hss}%
\hbox to1truein{\box3\hss}%
\hbox to1truein{\box4\hss}%
\hbox to1truein{\box5\hss}%
\hbox to1truein{\box6\hss}%
\hbox to1truein{\box7\hss}%
\hbox to1truein{\box8\hss}%
\vbox{\pagebody\makefootline}}
\advancepageno\global\boxnum=0\fi\fi}
\special{landscape}
% A tab (^^I) prints as lowercase gamma.
% Character ^^M could be made visible, with a bit of work;
% at present, it's indistinguishable from newline (^^J).
% You can get up to 63 characters on a line without an overfull box.
% (But lines with more than 59 characters may overlap with the next column,
% or be clipped off in the rightmost column.)