%
%   Either:
%      \address 3
%
%   then enter three addresses, blank lines between them, or
%
%      \faddress foo.tex
%
%   where foo.tex contains a bunch of labels, with blank lines between them.
%
%   Make sure to use \done to exit, rather than \bye.
%
\hsize=8.25truein\hoffset=-0.875truein
\vsize=11truein\voffset=-1.0truein
\nopagenumbers\raggedbottom\offinterlineskip
%
\newdimen\vlsize\newdimen\hlsize
\vlsize=1.56truein
\hlsize=2.75truein
%
\font\huge=cmbx12 scaled\magstep 4
\font\notsohuge=cmbx10 scaled\magstep3
\font\bigtt=cmtt10 scaled 1200
\font\lbls=cmbx10 scaled\magstephalf
\font\hugelogo=logobf10 scaled\magstep 5
\def\hugeMF{{\hugelogo METAFONT}}
%
\def\prompt{\immediate\write0{\noexpand\address\noexpand\faddress\noexpand\done}
   \immediate\write0{<\number\labcount> Total Labels}}
%
\newcount\n
\def\dotimes #1 #2{\n=#1
   \loop
      #2
   \advance\n by -1
   \ifnum\n>0\repeat}
%
\let\LMR=L
\newbox\leftbox
\newbox\midbox
\newcount\labcount
\labcount=0
\def\ship#1{\if L\LMR
      \global\setbox\leftbox=#1 \global\let\LMR=M
   \else\if M\LMR
      \global\setbox\midbox=#1 \global\let\LMR=R
   \else
      \line{\box\leftbox\hss\box\midbox\hss #1} \global\let\LMR=L
   \fi\fi
   \global\advance\labcount by1}
%
\def\emptybox{\vbox to \vlsize{\hsize=\hlsize\vfill\centerline{\strut}}}
\def\done{\if M\LMR \ship\emptybox\ship\emptybox
   \else\if R\LMR \ship\emptybox
   \fi\fi\vfill\eject\end}
%
\def\oninterlineskip{\baselineskip=12pt\lineskip=1pt\lineskiplimit=0pt}
%
\newif\ifok
\def\blankline{\par}
\newif\ifcont
%
\newdimen\maxadsize
\maxadsize=2.6truein
\newbox\addbox
\def\makeadd{\vbox{\oninterlineskip
   \loop
      \read0 to\add
      \ifx\add\blankline
         \global\contfalse
      \else
         \global\conttrue
      \fi
      \ifcont
         \setbox\addbox=\hbox{\add}
         \ifdim\maxadsize<\wd\addbox
            \message{Line too wide!}
         \else
            \box\addbox
         \fi
   \repeat}}
%
\def\address #1 {\dotimes #1
   {\ship{\vbox to \vlsize{\hsize=\hlsize
       \oninterlineskip
       \lbls
       \vss\hbox to\hlsize{\hss
          \makeadd
       \hss}\vss}}}
   \prompt}
%
\newread\filein
\def\fakeadd{\vbox{\oninterlineskip
   \loop
      \read\filein to\add
      \ifx\add\blankline
         \global\contfalse
      \else
         \global\conttrue
      \fi
      \ifcont
         \setbox\addbox=\hbox{\add}
         \ifdim\maxadsize<\wd\addbox
            \message{\add: }
            \message{Line too wide!}
         \else
            \box\addbox
         \fi
   \repeat}}
%
\newif\ifstillokay
\def\dofadds{
   \loop
      \ship{\vbox to \vlsize{\hsize=\hlsize
         \oninterlineskip
         \lbls
         \vss\hbox to\hlsize{\hss\fakeadd\hss}
      \vss}}
      \ifeof\filein
         \stillokayfalse
      \else
         \stillokaytrue
      \fi
      \ifstillokay
   \repeat
   \closein\filein}
%
\def\faddress #1 {
   \openin\filein=#1
   \ifeof\filein
      \message{#1: File not found}
   \else
      \dofadds
   \fi
   \prompt}
%
\prompt
