summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/plain/base/llist.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-12 23:46:46 +0000
committerKarl Berry <karl@freefriends.org>2006-01-12 23:46:46 +0000
commitb1c871653d37d9c6fd0f97b048dca051b5b1db27 (patch)
tree3f925e95aa3461b9ecb75df861259a7f71bc3f23 /Master/texmf-dist/tex/plain/base/llist.tex
parent82770e7491344072d5dd54ce9a78546eebe99c3f (diff)
trunk/Master/texmf-dist/tex/plain
git-svn-id: svn://tug.org/texlive/trunk@621 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/plain/base/llist.tex')
-rw-r--r--Master/texmf-dist/tex/plain/base/llist.tex67
1 files changed, 67 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/plain/base/llist.tex b/Master/texmf-dist/tex/plain/base/llist.tex
new file mode 100644
index 00000000000..f107169e248
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/base/llist.tex
@@ -0,0 +1,67 @@
+% Makes a landscape listing of one or more files
+% Typical usage:
+% tex llist *.c \\end
+
+\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{\ifright \headlinefont \hfill Page \folio
+ \else\filenamefont#1\quad\headlinefont \today\ at \hours\hfill \fi}
+ \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=4.6truein
+\vsize=7truein
+\hoffset=-.5truein
+\voffset=-.2truein
+\newif\ifright
+\newbox\lefthalf
+\output{\ifright
+ \shipout\hbox{\hbox to5.5in{\box\lefthalf\hss}%
+ \vbox{\makeheadline\pagebody\makefootline}}
+ \advancepageno\global\rightfalse
+ \else\global\setbox\lefthalf\vbox{\makeheadline\pagebody\makefootline}
+ \global\righttrue\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 91 characters on a line without an overfull box.
+% (But lines with more than 84 characters will be clipped, if they
+% appear on a righthand halfpage.)