Debian Codegraph @

texmf-dist/tex/plain/base/list.tex

raw
1 % Makes a listing of one or more files
2 % Typical usage:
3 % tex list *.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= cmtex10
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 \raggedbottom
26 \nopagenumbers
27
28 \chardef\other=12
29 \def\doit#1{\message{@Listing #1@}
30 \begingroup \everypar{} \frenchspacing
31 \headline{\filenamefont#1\quad\headlinefont \today\ at \hours
32 \hfill Page \folio}
33 \def\do##1{\catcode`##1=\other}\dospecials
34 \catcode127=\other \catcode9=\other \catcode12=\other
35 \parindent 0pt \parfillskip=0pt plus 1fil minus 1in
36 \everypar{\hangindent 1in} \rightskip=0pt plus 2in
37 \def\par{\ifvmode\penalty-500\medskip\else\endgraf\fi}
38 \listingfont \obeylines \obeyspaces \global\pageno=1
39 \input #1 {\eoffont(end of\/ file)}\endgraf\vfill\eject\endgroup}
40 {\obeyspaces\global\let =\ }
41 \catcode`\_=\other % allow _ in file names
42
43 % A tab (^^I) prints as lowercase gamma.
44 % Character ^^M could be made visible, with a bit of work;
45 % at present, it's indistinguishable from newline (^^J).
46
47 % You can get up to 103 characters on a line without an overfull box.