summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mailing/mailing.sty
blob: a1b445dafceef87332cd2f7355cc83ec31fcc07b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
%%
%% This is file `mailing.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mailing.dtx  (with options: `package')
%% 
%% Copyright (C) 1999-2004 Johannes Braams. All rights reserved.
%% 
%% This file was generated from file(s) of the mailing package.
%% ------------------------------------------------------------
%% 
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% The Current Maintainer of this work is Johannes Braams.
%% 
%% This file may only be distributed together with a copy of the
%% mailing package. You may however distribute the mailing package
%% without such generated files.
%% 
%% The list of all files belonging to the mailing package is
%% given in the file `manifest.txt.
%% 
%% The list of derived (unpacked) files belonging to the distribution
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% Copyright (C) 1999-2004 Johannes L. Braams texniek at braams.cistron.nl
%%
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mailing}
    [2004/02/20 v1.0b Send letters to multiple addresses]
\newcommand{\addressfile}[1]{%
  \def\M@filename{#1}}
\long\def\mailingtext#1{\global\mailing@text={#1}}
\def\makemailing{%
  \M@openadrfile
  \loop
    \read@info
    \if@notready
      \begin{letter}{\M@toname\\\M@toaddress}%
        \opening{\M@opening}%
        \vskip\baselineskip
        \the\mailing@text
      \end{letter}
    \fi
    \if@notready
  \repeat}
\newread\M@adrfile
\newtoks\mailing@text
\newif\if@notready
\newif\if@notemptyoreof
\def\M@openadrfile{%
  \openin\M@adrfile\M@filename\relax
  \ifeof\M@adrfile
    \loop
      %\PackageWarning{mailing}{I can't find the file \M@filename}
      \typeout{I can't find the file \M@filename!}
      \closein\M@adrfile
      \typein[\M@filename]{Enter a new name}
      \openin\M@adrfile\M@filename
      \ifeof\M@adrfile
    \repeat
  \fi}
\def\read@info{%
  \skip@empty@lines
  \if@notready
    \let\M@toname\M@line
    \read\M@adrfile to\M@toaddress
    \read\M@adrfile to\M@opening
    \test@eof
    \if@notready\read@defs\fi
  \fi
  }
\def\read@defs{%
  \def\M@defns{}%
  {\loop
    \endlinechar=-1
    \read\M@adrfile to\M@line
    \endlinechar=`\^^M
    \expandafter\toks@\expandafter\expandafter
      \expandafter{\expandafter\M@defns\M@line}%
    \xdef\M@defns{\the\toks@}%
    \test@emptyoreof
    \if@notemptyoreof
    \repeat}%
  \M@defns
  }
\def\test@eof{%
  \ifeof\M@adrfile
    \@notreadyfalse
  \else
    \@notreadytrue
  \fi}
\def\test@emptyoreof{%
  \@notemptyoreoftrue
  \ifx\M@line\@empty
    \global\@notemptyoreoffalse
  \fi
  \ifeof\M@adrfile
    \global\@notemptyoreoffalse
    \global\@notreadyfalse
  \fi}
\def\skip@empty@lines{%
  {\loop
    \endlinechar=-1
    \ifeof\M@adrfile
      \global\@notreadyfalse
      \@tempswafalse
    \else
      \global\@notreadytrue
      \global\read\M@adrfile to\M@line
      \ifx\M@line\@empty
        \@tempswatrue
      \else
        \@tempswafalse
      \fi
    \fi
    \if@tempswa
    \repeat}%
  }
\endinput
%%
%% End of file `mailing.sty'.