16#define WHO "newinclude"
18int rename(
const char *,
const char *);
22 logmsg(
WHO,111,FATAL,
"out of memory");
26 logmsg(
WHO,100,USAGE,
"newinclude list");
43 logmsg(
WHO,111,FATAL,B(
"unable to read: ",
fnlist));
47 logmsg(
WHO,111,FATAL,B(
"unable to write to ",
fntmp));
50static void out(
char *s,
int len)
60 logmsg(
WHO,111,FATAL,
"empty :include: filenames not permitted");
61 if (byte_chr(
buf,len,
'\n') != len)
62 logmsg(
WHO,111,FATAL,
"newlines not permitted in :include: filenames");
63 if (byte_chr(
buf,len,
'\0') != len)
64 logmsg(
WHO,111,FATAL,
"NUL not permitted in :include: filenames");
65 if ((
buf[0] !=
'.') && (
buf[0] !=
'/'))
76 logmsg(
WHO,111,FATAL,
"empty recipient addresses not permitted");
77 if (byte_chr(
buf,len,
'\n') != len)
78 logmsg(
WHO,111,FATAL,
"newlines not permitted in recipient addresses");
79 if (byte_chr(
buf,len,
'\0') != len)
80 logmsg(
WHO,111,FATAL,
"NUL not permitted in recipient addresses");
82 logmsg(
WHO,111,FATAL,
"addresses must be under 800 bytes");
83 if ((
buf[len - 1] ==
' ') || (
buf[len - 1] ==
'\t'))
84 logmsg(
WHO,111,FATAL,
"spaces and tabs not permitted at ends of addresses");
93 logmsg(
WHO,111,FATAL,
"unable to read controls");
107 fddir = open_read(
".");
109 logmsg(
WHO,111,FATAL,
"unable to open current directory");
121 x = env_get(
"QMAILDEFAULTDOMAIN");
127 x = env_get(
"QMAILDEFAULTHOST");
133 x = env_get(
"QMAILPLUSDOMAIN");
136 if (fchdir(fddir) == -1)
137 logmsg(
WHO,111,FATAL,
"unable to set current directory");
163 for (i = 0;i <
tokaddr.len;++i)
174 logmsg(
WHO,111,FATAL,B(
"file delivery for ",
address.s,
" not supported"));
179 logmsg(
WHO,111,FATAL,B(
"program delivery for ",
address.s,
" not supported"));
208 logmsg(
WHO,111,FATAL,B(
"unable to parse this line: ",
line.s));
229 while (t > beginning)
230 switch ((--t)->
type) {
234 if (t >= beginning + 2)
238 if (!byte_diff(t[-1].
s,7,
"include")) {
287 if (!stralloc_cats(&
bin,
".bin"))
nomem();
291 if (!stralloc_cats(&
tmp,
".tmp"))
nomem();
304 if (!
line.len)
break;
314 logmsg(
WHO,111,FATAL,B(
"unable to move ",
fntmp,
" to: ",
fnbin));
int control_readline(stralloc *sa, char *fn)
int stralloc_copys(stralloc *, char const *)
void doincl(char *buf, int len)
void dorecip(char *buf, int len)
int rename(const char *, const char *)
int token822_parse(token822_alloc *ta, stralloc *sa, stralloc *buf)