|
1
|
1 |
From bfad3b50c43499cfce28b403ba1a8d8e0bdee08c Mon Sep 17 00:00:00 2001
|
|
|
2 |
From: Tomas Zeman <tzeman@volny.cz>
|
|
|
3 |
Date: Tue, 6 Nov 2007 11:43:46 +0100
|
|
|
4 |
Subject: [PATCH] diet-qmailanalog-0.70-1-i686
|
|
|
5 |
* added
|
|
|
6 |
|
|
|
7 |
---
|
|
|
8 |
source/dietlibc/diet-qmailanalog/FrugalBuild | 37 +
|
|
|
9 |
.../diet-qmailanalog/qmailanalog-multilog.patch | 885 ++++++++++++++++++++
|
|
|
10 |
2 files changed, 922 insertions(+), 0 deletions(-)
|
|
|
11 |
create mode 100644 source/dietlibc/diet-qmailanalog/FrugalBuild
|
|
|
12 |
create mode 100644 source/dietlibc/diet-qmailanalog/qmailanalog-multilog.patch
|
|
|
13 |
|
|
|
14 |
diff --git a/source/dietlibc/diet-qmailanalog/FrugalBuild b/source/dietlibc/diet-qmailanalog/FrugalBuild
|
|
|
15 |
new file mode 100644
|
|
|
16 |
index 0000000..27908f9
|
|
|
17 |
--- /dev/null
|
|
|
18 |
+++ b/source/dietlibc/diet-qmailanalog/FrugalBuild
|
|
|
19 |
@@ -0,0 +1,37 @@
|
|
|
20 |
+# Maintainer: Tomas Zeman <tzeman@volny.cz>
|
|
|
21 |
+# Accepts tai64 format dates (lines starting with @....) + mlmatchup
|
|
|
22 |
+# see http://www.magma.com.ni/moin/TipsAnd/QmailAnalog
|
|
|
23 |
+
|
|
|
24 |
+branch=diet
|
|
|
25 |
+pkgorig=qmailanalog
|
|
|
26 |
+pkgname=$branch-$pkgorig
|
|
|
27 |
+pkgver=0.70
|
|
|
28 |
+pkgrel=1
|
|
|
29 |
+pkgdesc=""
|
|
|
30 |
+makedepends=(dietlibc)
|
|
|
31 |
+url="http://cr.yp.to/qmailanalog.html"
|
|
|
32 |
+archs=(i686)
|
|
|
33 |
+up2date='lynx -dump -nolist $url|grep $pkgorig|grep tar.gz|head -1|sed -e "s/.*$pkgorig-\(.*\)\.tar.gz.*$/\1/"'
|
|
|
34 |
+source=(http://cr.yp.to/software/$pkgorig-$pkgver.tar.gz \
|
|
|
35 |
+ qmailanalog-multilog.patch)
|
|
|
36 |
+sha1sums=('d9f47b6c5348759aeba3873b6b7653b823b2f92c' \
|
|
|
37 |
+ '05b9b7995e3bef33d8c9c2af239d9d23d95f813f')
|
|
|
38 |
+provides=(qmailanalog)
|
|
|
39 |
+
|
|
|
40 |
+build() {
|
|
|
41 |
+ qmail_dir=/var/qmail
|
|
|
42 |
+ Fcd $pkgorig-$pkgver
|
|
|
43 |
+ echo "$qmail_dir" > conf-home
|
|
|
44 |
+ echo "diet gcc $CFLAGS" > conf-cc
|
|
|
45 |
+ echo "diet gcc -s -static" > conf-ld
|
|
|
46 |
+ Fmkdir $qmail_dir
|
|
|
47 |
+ patch -p1 < $Fsrcdir/qmailanalog-multilog.patch || Fdie
|
|
|
48 |
+ sed -i -e "s{(auto_home,{(\"$Fdestdir$qmail_dir\",{" hier.c
|
|
|
49 |
+ make || Fdie
|
|
|
50 |
+ make setup || Fdie
|
|
|
51 |
+ Frm $qmail_dir/man/cat*
|
|
|
52 |
+ Fmkdir /usr/share/doc/$pkgname-$pkgver
|
|
|
53 |
+ Fmv $qmail_dir/doc/* /usr/share/doc/$pkgname-$pkgver
|
|
|
54 |
+ Frm $qmail_dir/doc
|
|
|
55 |
+}
|
|
|
56 |
+# vim: ft=sh
|
|
|
57 |
diff --git a/source/dietlibc/diet-qmailanalog/qmailanalog-multilog.patch b/source/dietlibc/diet-qmailanalog/qmailanalog-multilog.patch
|
|
|
58 |
new file mode 100644
|
|
|
59 |
index 0000000..0b4505a
|
|
|
60 |
--- /dev/null
|
|
|
61 |
+++ b/source/dietlibc/diet-qmailanalog/qmailanalog-multilog.patch
|
|
|
62 |
@@ -0,0 +1,885 @@
|
|
|
63 |
+diff -x .svn -Naur qmailanalog-0.70/error.h qmailanalog/error.h
|
|
|
64 |
+--- qmailanalog-0.70/error.h 1998-08-30 23:39:27.000000000 +0200
|
|
|
65 |
++++ qmailanalog/error.h 2007-04-30 20:57:24.000000000 +0200
|
|
|
66 |
+@@ -1,7 +1,8 @@
|
|
|
67 |
+ #ifndef ERROR_H
|
|
|
68 |
+ #define ERROR_H
|
|
|
69 |
+
|
|
|
70 |
+-extern int errno;
|
|
|
71 |
++/* extern int errno; */
|
|
|
72 |
++#include <errno.h>
|
|
|
73 |
+
|
|
|
74 |
+ extern int error_intr;
|
|
|
75 |
+ extern int error_nomem;
|
|
|
76 |
+diff -x .svn -Naur qmailanalog-0.70/FILES qmailanalog/FILES
|
|
|
77 |
+--- qmailanalog-0.70/FILES 1998-08-30 23:39:26.000000000 +0200
|
|
|
78 |
++++ qmailanalog/FILES 2007-04-30 20:57:24.000000000 +0200
|
|
|
79 |
+@@ -132,3 +132,6 @@
|
|
|
80 |
+ case.3
|
|
|
81 |
+ case.h
|
|
|
82 |
+ case_lowers.c
|
|
|
83 |
++mlmatchup.8
|
|
|
84 |
++mlmatchup.c
|
|
|
85 |
++mlmatchup
|
|
|
86 |
+diff -x .svn -Naur qmailanalog-0.70/hier.c qmailanalog/hier.c
|
|
|
87 |
+--- qmailanalog-0.70/hier.c 1998-08-30 23:39:27.000000000 +0200
|
|
|
88 |
++++ qmailanalog/hier.c 2007-06-13 11:09:42.000000000 +0200
|
|
|
89 |
+@@ -9,12 +9,16 @@
|
|
|
90 |
+ d(auto_home,"man",-1,-1,02755);
|
|
|
91 |
+ d(auto_home,"man/man1",-1,-1,02755);
|
|
|
92 |
+ d(auto_home,"man/cat1",-1,-1,02755);
|
|
|
93 |
++ d(auto_home,"man/man8",-1,-1,02755);
|
|
|
94 |
++ d(auto_home,"man/cat8",-1,-1,02755);
|
|
|
95 |
+
|
|
|
96 |
+ c(auto_home,"doc","MATCHUP",-1,-1,0644);
|
|
|
97 |
+ c(auto_home,"doc","ACCOUNTING",-1,-1,0644);
|
|
|
98 |
+
|
|
|
99 |
+ c(auto_home,"man/man1","matchup.1",-1,-1,0644);
|
|
|
100 |
+ c(auto_home,"man/cat1","matchup.0",-1,-1,0644);
|
|
|
101 |
++ c(auto_home,"man/man8","mlmatchup.8",-1,-1,0644);
|
|
|
102 |
++ c(auto_home,"man/cat8","mlmatchup.0",-1,-1,0644);
|
|
|
103 |
+ c(auto_home,"man/man1","xqp.1",-1,-1,0644);
|
|
|
104 |
+ c(auto_home,"man/cat1","xqp.0",-1,-1,0644);
|
|
|
105 |
+ c(auto_home,"man/man1","xsender.1",-1,-1,0644);
|
|
|
106 |
+@@ -25,6 +29,7 @@
|
|
|
107 |
+ c(auto_home,"man/cat1","columnt.0",-1,-1,0644);
|
|
|
108 |
+
|
|
|
109 |
+ c(auto_home,"bin","matchup",-1,-1,0755);
|
|
|
110 |
++ c(auto_home,"bin","mlmatchup",-1,-1,0755);
|
|
|
111 |
+ c(auto_home,"bin","columnt",-1,-1,0755);
|
|
|
112 |
+ c(auto_home,"bin","zoverall",-1,-1,0755);
|
|
|
113 |
+ c(auto_home,"bin","zsendmail",-1,-1,0755);
|
|
|
114 |
+diff -x .svn -Naur qmailanalog-0.70/Makefile qmailanalog/Makefile
|
|
|
115 |
+--- qmailanalog-0.70/Makefile 1998-08-30 23:39:26.000000000 +0200
|
|
|
116 |
++++ qmailanalog/Makefile 2007-05-03 00:15:12.000000000 +0200
|
|
|
117 |
+@@ -243,7 +243,7 @@
|
|
|
118 |
+ chmod 755 makelib
|
|
|
119 |
+
|
|
|
120 |
+ man: \
|
|
|
121 |
+-matchup.0 columnt.0 xqp.0 xsender.0 xrecipient.0 alloc.0 case.0 \
|
|
|
122 |
++matchup.0 mlmatchup.0 columnt.0 xqp.0 xsender.0 xrecipient.0 alloc.0 case.0 \
|
|
|
123 |
+ error.0 error_str.0 getln2.0 getln.0 stralloc.0
|
|
|
124 |
+
|
|
|
125 |
+ matchup: \
|
|
|
126 |
+@@ -275,7 +275,7 @@
|
|
|
127 |
+ ./compile open_trunc.c
|
|
|
128 |
+
|
|
|
129 |
+ prog: \
|
|
|
130 |
+-matchup columnt zoverall zsendmail xqp xsender xrecipient ddist \
|
|
|
131 |
++matchup mlmatchup columnt zoverall zsendmail xqp xsender xrecipient ddist \
|
|
|
132 |
+ deferrals failures successes rhosts recipients rxdelay senders suids \
|
|
|
133 |
+ zddist zdeferrals zfailures zsuccesses zrhosts zrecipients zrxdelay \
|
|
|
134 |
+ zsenders zsuids
|
|
|
135 |
+@@ -566,3 +566,22 @@
|
|
|
136 |
+ | sed s}HOME}"`head -1 conf-home`"}g \
|
|
|
137 |
+ > zsuids
|
|
|
138 |
+ chmod 755 zsuids
|
|
|
139 |
++
|
|
|
140 |
++mlmatchup: \
|
|
|
141 |
++load mlmatchup.o strerr.a getln.a substdio.a stralloc.a alloc.a error.a \
|
|
|
142 |
++str.a fs.a case.a
|
|
|
143 |
++ ./load mlmatchup strerr.a getln.a substdio.a stralloc.a \
|
|
|
144 |
++ alloc.a error.a str.a fs.a case.a
|
|
|
145 |
++
|
|
|
146 |
++mlmatchup.0: \
|
|
|
147 |
++mlmatchup.8
|
|
|
148 |
++ nroff -man mlmatchup.8 > mlmatchup.0
|
|
|
149 |
++
|
|
|
150 |
++mlmatchup.o: \
|
|
|
151 |
++compile mlmatchup.c stralloc.h gen_alloc.h gen_alloc.h gen_allocdefs.h \
|
|
|
152 |
++strerr.h getln.h substdio.h subfd.h substdio.h readwrite.h exit.h \
|
|
|
153 |
++str.h fmt.h scan.h case.h
|
|
|
154 |
++ ./compile mlmatchup.c
|
|
|
155 |
++
|
|
|
156 |
++clean:
|
|
|
157 |
++ rm -f `cat TARGETS`
|
|
|
158 |
+diff -x .svn -Naur qmailanalog-0.70/man.do qmailanalog/man.do
|
|
|
159 |
+--- qmailanalog-0.70/man.do 1998-08-30 23:39:27.000000000 +0200
|
|
|
160 |
++++ qmailanalog/man.do 2007-04-30 20:57:24.000000000 +0200
|
|
|
161 |
+@@ -1,4 +1,4 @@
|
|
|
162 |
+ dependon \
|
|
|
163 |
+-matchup.0 columnt.0 \
|
|
|
164 |
++matchup.0 mlmatchup.0 columnt.0 \
|
|
|
165 |
+ xqp.0 xsender.0 xrecipient.0 \
|
|
|
166 |
+ alloc.0 case.0 error.0 error_str.0 getln2.0 getln.0 stralloc.0
|
|
|
167 |
+diff -x .svn -Naur qmailanalog-0.70/matchup.1 qmailanalog/matchup.1
|
|
|
168 |
+--- qmailanalog-0.70/matchup.1 1998-08-30 23:39:27.000000000 +0200
|
|
|
169 |
++++ qmailanalog/matchup.1 2007-04-30 20:57:24.000000000 +0200
|
|
|
170 |
+@@ -7,7 +7,9 @@
|
|
|
171 |
+ .B matchup
|
|
|
172 |
+ reads a series of lines from
|
|
|
173 |
+ .BR qmail-send ,
|
|
|
174 |
+-with a numeric timestamp in front of each line.
|
|
|
175 |
++with a numeric timestamp in the format seconds.nanoseconds or a TAI64N timestamps
|
|
|
176 |
++in front of each line, allowing either splogger(8) or multilog(8) to produce the
|
|
|
177 |
++logfiles.
|
|
|
178 |
+ .B matchup
|
|
|
179 |
+ matches the end of each delivery attempt with the start of the delivery attempt
|
|
|
180 |
+ and with the relevant message information;
|
|
|
181 |
+@@ -108,4 +110,6 @@
|
|
|
182 |
+ xsender(1),
|
|
|
183 |
+ accustamp(1),
|
|
|
184 |
+ qmail-log(5),
|
|
|
185 |
+-splogger(8)
|
|
|
186 |
++splogger(8),
|
|
|
187 |
++multilog(8),
|
|
|
188 |
++mlmatchup(1)
|
|
|
189 |
+diff -x .svn -Naur qmailanalog-0.70/matchup.c qmailanalog/matchup.c
|
|
|
190 |
+--- qmailanalog-0.70/matchup.c 1998-08-30 23:39:27.000000000 +0200
|
|
|
191 |
++++ qmailanalog/matchup.c 2007-04-30 20:57:24.000000000 +0200
|
|
|
192 |
+@@ -183,6 +183,47 @@
|
|
|
193 |
+ poolbytes = pool.len; /* redundant, but doesn't hurt */
|
|
|
194 |
+ }
|
|
|
195 |
+
|
|
|
196 |
++/* turn TAI date into old fashioned date */
|
|
|
197 |
++/* dates without @ are left alone */
|
|
|
198 |
++
|
|
|
199 |
++static char datebuf[FMT_ULONG+FMT_ULONG+2]; /* ssssssssss.ffffffffff\n */
|
|
|
200 |
++
|
|
|
201 |
++char *
|
|
|
202 |
++datize(s)
|
|
|
203 |
++char *s;
|
|
|
204 |
++{
|
|
|
205 |
++ int c;
|
|
|
206 |
++ int len;
|
|
|
207 |
++ unsigned long u;
|
|
|
208 |
++ unsigned long seconds = 0;
|
|
|
209 |
++ unsigned long nanoseconds = 0;
|
|
|
210 |
++
|
|
|
211 |
++ if(*s != '@') return s;
|
|
|
212 |
++ s++;
|
|
|
213 |
++
|
|
|
214 |
++ while ((c = *s++)) {
|
|
|
215 |
++ u = c - '0';
|
|
|
216 |
++ if (u >= 10) {
|
|
|
217 |
++ u = c - 'a';
|
|
|
218 |
++ if (u >= 6) break;
|
|
|
219 |
++ u += 10;
|
|
|
220 |
++ }
|
|
|
221 |
++ seconds <<= 4;
|
|
|
222 |
++ seconds += nanoseconds >> 28;
|
|
|
223 |
++ nanoseconds &= 0xfffffff;
|
|
|
224 |
++ nanoseconds <<= 4;
|
|
|
225 |
++ nanoseconds += u;
|
|
|
226 |
++ }
|
|
|
227 |
++ seconds -= 4611686018427387914ULL;
|
|
|
228 |
++
|
|
|
229 |
++ len = fmt_ulong(datebuf, seconds);
|
|
|
230 |
++ datebuf[len++] = '.';
|
|
|
231 |
++ len += fmt_uint0(datebuf+len, nanoseconds, 9);
|
|
|
232 |
++ datebuf[len] = 0;
|
|
|
233 |
++
|
|
|
234 |
++ return datebuf;
|
|
|
235 |
++}
|
|
|
236 |
++
|
|
|
237 |
+ stralloc line = {0};
|
|
|
238 |
+ int match;
|
|
|
239 |
+
|
|
|
240 |
+@@ -209,7 +250,7 @@
|
|
|
241 |
+ dmsg.u[dpos] = m;
|
|
|
242 |
+
|
|
|
243 |
+ dstart.u[dpos] = pool.len;
|
|
|
244 |
+- if (!stralloc_cats(&pool,line.s + field[0])) nomem();
|
|
|
245 |
++ if (!stralloc_cats(&pool,datize(line.s + field[0]))) nomem();
|
|
|
246 |
+ if (!stralloc_0(&pool)) nomem();
|
|
|
247 |
+
|
|
|
248 |
+ dchan.u[dpos] = pool.len;
|
|
|
249 |
+@@ -267,7 +308,7 @@
|
|
|
250 |
+ if (mpos != -1) {
|
|
|
251 |
+ outs(pool.s + birth.u[mpos]);
|
|
|
252 |
+ outs(" "); outs(pool.s + dstart.u[dpos]);
|
|
|
253 |
+- outs(" "); outs(line.s + field[0]);
|
|
|
254 |
++ outs(" "); outs(datize(line.s + field[0]));
|
|
|
255 |
+ outs(" "); out(strnum,fmt_ulong(strnum,bytes.u[mpos]));
|
|
|
256 |
+ outs(" "); outs(pool.s + sender.u[mpos]);
|
|
|
257 |
+ outs(" "); outs(pool.s + dchan.u[dpos]);
|
|
|
258 |
+@@ -279,7 +320,7 @@
|
|
|
259 |
+ else {
|
|
|
260 |
+ outs(pool.s + dstart.u[dpos]);
|
|
|
261 |
+ outs(" "); outs(pool.s + dstart.u[dpos]);
|
|
|
262 |
+- outs(" "); outs(line.s + field[0]);
|
|
|
263 |
++ outs(" "); outs(datize(line.s + field[0]));
|
|
|
264 |
+ outs(" 0 ? "); outs(pool.s + dchan.u[dpos]);
|
|
|
265 |
+ outs("."); outs(pool.s + drecip.u[dpos]);
|
|
|
266 |
+ outs(" ? ? "); outs(reason);
|
|
|
267 |
+@@ -313,7 +354,7 @@
|
|
|
268 |
+ if (mpos == -1) return;
|
|
|
269 |
+
|
|
|
270 |
+ outs("m "); outs(pool.s + birth.u[mpos]);
|
|
|
271 |
+- outs(" "); outs(line.s + field[0]);
|
|
|
272 |
++ outs(" "); outs(datize(line.s + field[0]));
|
|
|
273 |
+ outs(" "); out(strnum,fmt_ulong(strnum,bytes.u[mpos]));
|
|
|
274 |
+ outs(" "); out(strnum,fmt_ulong(strnum,numk.u[mpos]));
|
|
|
275 |
+ outs(" "); out(strnum,fmt_ulong(strnum,numd.u[mpos]));
|
|
|
276 |
+@@ -344,7 +385,7 @@
|
|
|
277 |
+ numz.u[mpos] = 0;
|
|
|
278 |
+
|
|
|
279 |
+ birth.u[mpos] = pool.len;
|
|
|
280 |
+- if (!stralloc_cats(&pool,line.s + field[0])) nomem();
|
|
|
281 |
++ if (!stralloc_cats(&pool,datize(line.s + field[0]))) nomem();
|
|
|
282 |
+ if (!stralloc_0(&pool)) nomem();
|
|
|
283 |
+
|
|
|
284 |
+ sender.u[mpos] = pool.len;
|
|
|
285 |
+diff -x .svn -Naur qmailanalog-0.70/mlmatchup.8 qmailanalog/mlmatchup.8
|
|
|
286 |
+--- qmailanalog-0.70/mlmatchup.8 1970-01-01 01:00:00.000000000 +0100
|
|
|
287 |
++++ qmailanalog/mlmatchup.8 2007-04-30 20:57:24.000000000 +0200
|
|
|
288 |
+@@ -0,0 +1,33 @@
|
|
|
289 |
++.TH mlmatchup 8
|
|
|
290 |
++.SH NAME
|
|
|
291 |
++mlmatchup \- collect information on messages and deliveries through multilog
|
|
|
292 |
++.SH SYNTAX
|
|
|
293 |
++.B mlmatchup
|
|
|
294 |
++.SH DESCRIPTION
|
|
|
295 |
++.B mlmatchup
|
|
|
296 |
++behaves exactly like
|
|
|
297 |
++.BR matchup(1)
|
|
|
298 |
++with the difference, that it first reads (pending delivery) lines
|
|
|
299 |
++from file descriptor 4. This makes
|
|
|
300 |
++.B mlmatchup
|
|
|
301 |
++suitable as a procesor action for multilog.
|
|
|
302 |
++
|
|
|
303 |
++If you use multilog to process
|
|
|
304 |
++.B qmail-send
|
|
|
305 |
++logfiles expand the run file of qmail-send's log services like this:
|
|
|
306 |
++
|
|
|
307 |
++.EX
|
|
|
308 |
++ exec setuidgid qmaill multilog t ./main \\
|
|
|
309 |
++.br
|
|
|
310 |
++ !/usr/local/qmailanalog/bin/mlmatchup ./qmailanalog
|
|
|
311 |
++.EE
|
|
|
312 |
++
|
|
|
313 |
++.SH "SEE ALSO"
|
|
|
314 |
++multilog(8),
|
|
|
315 |
++matchup(1),
|
|
|
316 |
++xqp(1),
|
|
|
317 |
++xrecipient(1),
|
|
|
318 |
++xsender(1),
|
|
|
319 |
++accustamp(1),
|
|
|
320 |
++qmail-log(5),
|
|
|
321 |
++splogger(8)
|
|
|
322 |
+diff -x .svn -Naur qmailanalog-0.70/mlmatchup.c qmailanalog/mlmatchup.c
|
|
|
323 |
+--- qmailanalog-0.70/mlmatchup.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
324 |
++++ qmailanalog/mlmatchup.c 2007-04-30 20:57:24.000000000 +0200
|
|
|
325 |
+@@ -0,0 +1,536 @@
|
|
|
326 |
++#include "stralloc.h"
|
|
|
327 |
++#include "gen_alloc.h"
|
|
|
328 |
++#include "gen_allocdefs.h"
|
|
|
329 |
++#include "strerr.h"
|
|
|
330 |
++#include "getln.h"
|
|
|
331 |
++#include "substdio.h"
|
|
|
332 |
++#include "subfd.h"
|
|
|
333 |
++#include "readwrite.h"
|
|
|
334 |
++#include "exit.h"
|
|
|
335 |
++#include "str.h"
|
|
|
336 |
++#include "fmt.h"
|
|
|
337 |
++#include "scan.h"
|
|
|
338 |
++#include "case.h"
|
|
|
339 |
++
|
|
|
340 |
++#define FATAL "matchup: fatal: "
|
|
|
341 |
++
|
|
|
342 |
++void nomem() { strerr_die2x(111,FATAL,"out of memory"); }
|
|
|
343 |
++void die_read() { strerr_die2sys(111,FATAL,"unable to read input: "); }
|
|
|
344 |
++void die_write() { strerr_die2sys(111,FATAL,"unable to write output: "); }
|
|
|
345 |
++void die_write5() { strerr_die2sys(111,FATAL,"unable to write fd 5: "); }
|
|
|
346 |
++
|
|
|
347 |
++void out(buf,len) char *buf; int len;
|
|
|
348 |
++{ if (substdio_put(subfdout,buf,len) == -1) die_write(); }
|
|
|
349 |
++void outs(buf) char *buf;
|
|
|
350 |
++{ if (substdio_puts(subfdout,buf) == -1) die_write(); }
|
|
|
351 |
++
|
|
|
352 |
++char buf5[512];
|
|
|
353 |
++substdio ss5 = SUBSTDIO_FDBUF(write,5,buf5,sizeof buf5);
|
|
|
354 |
++
|
|
|
355 |
++void out5(buf,len) char *buf; int len;
|
|
|
356 |
++{ if (substdio_put(&ss5,buf,len) == -1) die_write5(); }
|
|
|
357 |
++void outs5(buf) char *buf;
|
|
|
358 |
++{ if (substdio_puts(&ss5,buf) == -1) die_write5(); }
|
|
|
359 |
++
|
|
|
360 |
++GEN_ALLOC_typedef(ulongalloc,unsigned long,u,len,a)
|
|
|
361 |
++GEN_ALLOC_ready(ulongalloc,unsigned long,u,len,a,i,n,x,30,ulongalloc_ready)
|
|
|
362 |
++GEN_ALLOC_readyplus(ulongalloc,unsigned long,u,len,a,i,n,x,30,ulongalloc_readyplus)
|
|
|
363 |
++
|
|
|
364 |
++char strnum[FMT_ULONG];
|
|
|
365 |
++
|
|
|
366 |
++stralloc pool = {0};
|
|
|
367 |
++unsigned int poolbytes = 0;
|
|
|
368 |
++
|
|
|
369 |
++int nummsg = 0;
|
|
|
370 |
++ulongalloc msg = {0};
|
|
|
371 |
++ulongalloc bytes = {0};
|
|
|
372 |
++ulongalloc qp = {0};
|
|
|
373 |
++ulongalloc uid = {0};
|
|
|
374 |
++ulongalloc numk = {0};
|
|
|
375 |
++ulongalloc numd = {0};
|
|
|
376 |
++ulongalloc numz = {0};
|
|
|
377 |
++ulongalloc sender = {0};
|
|
|
378 |
++ulongalloc birth = {0};
|
|
|
379 |
++
|
|
|
380 |
++int msg_find(m)
|
|
|
381 |
++unsigned long m;
|
|
|
382 |
++{
|
|
|
383 |
++ int i;
|
|
|
384 |
++ for (i = 0;i < nummsg;++i) if (msg.u[i] == m) return i;
|
|
|
385 |
++ return -1;
|
|
|
386 |
++}
|
|
|
387 |
++
|
|
|
388 |
++int msg_add(m)
|
|
|
389 |
++unsigned long m;
|
|
|
390 |
++{
|
|
|
391 |
++ int i;
|
|
|
392 |
++ for (i = 0;i < nummsg;++i) if (msg.u[i] == m) return i;
|
|
|
393 |
++ i = nummsg++;
|
|
|
394 |
++ if (!ulongalloc_ready(&msg,nummsg)) nomem();
|
|
|
395 |
++ if (!ulongalloc_ready(&bytes,nummsg)) nomem();
|
|
|
396 |
++ if (!ulongalloc_ready(&qp,nummsg)) nomem();
|
|
|
397 |
++ if (!ulongalloc_ready(&uid,nummsg)) nomem();
|
|
|
398 |
++ if (!ulongalloc_ready(&numk,nummsg)) nomem();
|
|
|
399 |
++ if (!ulongalloc_ready(&numd,nummsg)) nomem();
|
|
|
400 |
++ if (!ulongalloc_ready(&numz,nummsg)) nomem();
|
|
|
401 |
++ if (!ulongalloc_ready(&sender,nummsg)) nomem();
|
|
|
402 |
++ if (!ulongalloc_ready(&birth,nummsg)) nomem();
|
|
|
403 |
++ msg.u[i] = m;
|
|
|
404 |
++ return i;
|
|
|
405 |
++}
|
|
|
406 |
++
|
|
|
407 |
++int msg_kill(i)
|
|
|
408 |
++int i;
|
|
|
409 |
++{
|
|
|
410 |
++ poolbytes -= str_len(pool.s + sender.u[i]) + 1;
|
|
|
411 |
++ poolbytes -= str_len(pool.s + birth.u[i]) + 1;
|
|
|
412 |
++
|
|
|
413 |
++ --nummsg;
|
|
|
414 |
++ msg.u[i] = msg.u[nummsg];
|
|
|
415 |
++ bytes.u[i] = bytes.u[nummsg];
|
|
|
416 |
++ qp.u[i] = qp.u[nummsg];
|
|
|
417 |
++ uid.u[i] = uid.u[nummsg];
|
|
|
418 |
++ numk.u[i] = numk.u[nummsg];
|
|
|
419 |
++ numd.u[i] = numd.u[nummsg];
|
|
|
420 |
++ numz.u[i] = numz.u[nummsg];
|
|
|
421 |
++ sender.u[i] = sender.u[nummsg];
|
|
|
422 |
++ birth.u[i] = birth.u[nummsg];
|
|
|
423 |
++}
|
|
|
424 |
++
|
|
|
425 |
++int numdel = 0;
|
|
|
426 |
++ulongalloc del = {0};
|
|
|
427 |
++ulongalloc dmsg = {0};
|
|
|
428 |
++ulongalloc dchan = {0};
|
|
|
429 |
++ulongalloc drecip = {0};
|
|
|
430 |
++ulongalloc dstart = {0};
|
|
|
431 |
++
|
|
|
432 |
++int del_find(d)
|
|
|
433 |
++unsigned long d;
|
|
|
434 |
++{
|
|
|
435 |
++ int i;
|
|
|
436 |
++ for (i = 0;i < numdel;++i) if (del.u[i] == d) return i;
|
|
|
437 |
++ return -1;
|
|
|
438 |
++}
|
|
|
439 |
++
|
|
|
440 |
++int del_add(d)
|
|
|
441 |
++unsigned long d;
|
|
|
442 |
++{
|
|
|
443 |
++ int i;
|
|
|
444 |
++ for (i = 0;i < numdel;++i) if (del.u[i] == d) return i;
|
|
|
445 |
++ i = numdel++;
|
|
|
446 |
++ if (!ulongalloc_ready(&del,numdel)) nomem();
|
|
|
447 |
++ if (!ulongalloc_ready(&dmsg,numdel)) nomem();
|
|
|
448 |
++ if (!ulongalloc_ready(&dchan,numdel)) nomem();
|
|
|
449 |
++ if (!ulongalloc_ready(&drecip,numdel)) nomem();
|
|
|
450 |
++ if (!ulongalloc_ready(&dstart,numdel)) nomem();
|
|
|
451 |
++ del.u[i] = d;
|
|
|
452 |
++ return i;
|
|
|
453 |
++}
|
|
|
454 |
++
|
|
|
455 |
++void del_kill(i)
|
|
|
456 |
++int i;
|
|
|
457 |
++{
|
|
|
458 |
++ poolbytes -= str_len(pool.s + dchan.u[i]) + 1;
|
|
|
459 |
++ poolbytes -= str_len(pool.s + drecip.u[i]) + 1;
|
|
|
460 |
++ poolbytes -= str_len(pool.s + dstart.u[i]) + 1;
|
|
|
461 |
++ --numdel;
|
|
|
462 |
++ del.u[i] = del.u[numdel];
|
|
|
463 |
++ dmsg.u[i] = dmsg.u[numdel];
|
|
|
464 |
++ dchan.u[i] = dchan.u[numdel];
|
|
|
465 |
++ drecip.u[i] = drecip.u[numdel];
|
|
|
466 |
++ dstart.u[i] = dstart.u[numdel];
|
|
|
467 |
++}
|
|
|
468 |
++
|
|
|
469 |
++stralloc pool2 = {0};
|
|
|
470 |
++
|
|
|
471 |
++void garbage()
|
|
|
472 |
++{
|
|
|
473 |
++ int i;
|
|
|
474 |
++ char *x;
|
|
|
475 |
++
|
|
|
476 |
++ if (pool.len - poolbytes < poolbytes + 4096) return;
|
|
|
477 |
++
|
|
|
478 |
++ if (!stralloc_copys(&pool2,"")) nomem();
|
|
|
479 |
++
|
|
|
480 |
++ for (i = 0;i < nummsg;++i) {
|
|
|
481 |
++ x = pool.s + birth.u[i];
|
|
|
482 |
++ birth.u[i] = pool2.len;
|
|
|
483 |
++ if (!stralloc_cats(&pool2,x)) nomem();
|
|
|
484 |
++ if (!stralloc_0(&pool2)) nomem();
|
|
|
485 |
++ x = pool.s + sender.u[i];
|
|
|
486 |
++ sender.u[i] = pool2.len;
|
|
|
487 |
++ if (!stralloc_cats(&pool2,x)) nomem();
|
|
|
488 |
++ if (!stralloc_0(&pool2)) nomem();
|
|
|
489 |
++ }
|
|
|
490 |
++
|
|
|
491 |
++ for (i = 0;i < numdel;++i) {
|
|
|
492 |
++ x = pool.s + dstart.u[i];
|
|
|
493 |
++ dstart.u[i] = pool2.len;
|
|
|
494 |
++ if (!stralloc_cats(&pool2,x)) nomem();
|
|
|
495 |
++ if (!stralloc_0(&pool2)) nomem();
|
|
|
496 |
++ x = pool.s + dchan.u[i];
|
|
|
497 |
++ dchan.u[i] = pool2.len;
|
|
|
498 |
++ if (!stralloc_cats(&pool2,x)) nomem();
|
|
|
499 |
++ if (!stralloc_0(&pool2)) nomem();
|
|
|
500 |
++ x = pool.s + drecip.u[i];
|
|
|
501 |
++ drecip.u[i] = pool2.len;
|
|
|
502 |
++ if (!stralloc_cats(&pool2,x)) nomem();
|
|
|
503 |
++ if (!stralloc_0(&pool2)) nomem();
|
|
|
504 |
++ }
|
|
|
505 |
++
|
|
|
506 |
++ if (!stralloc_copy(&pool,&pool2)) nomem();
|
|
|
507 |
++
|
|
|
508 |
++ poolbytes = pool.len; /* redundant, but doesn't hurt */
|
|
|
509 |
++}
|
|
|
510 |
++
|
|
|
511 |
++/* turn TAI date into old fashioned date */
|
|
|
512 |
++/* dates without @ are left alone */
|
|
|
513 |
++
|
|
|
514 |
++static char datebuf[FMT_ULONG+FMT_ULONG+2]; /* ssssssssss.ffffffffff\n */
|
|
|
515 |
++
|
|
|
516 |
++char *
|
|
|
517 |
++datize(s)
|
|
|
518 |
++char *s;
|
|
|
519 |
++{
|
|
|
520 |
++ int c;
|
|
|
521 |
++ int len;
|
|
|
522 |
++ unsigned long u;
|
|
|
523 |
++ unsigned long seconds = 0;
|
|
|
524 |
++ unsigned long nanoseconds = 0;
|
|
|
525 |
++
|
|
|
526 |
++ if(*s != '@') return s;
|
|
|
527 |
++ s++;
|
|
|
528 |
++
|
|
|
529 |
++ while ((c = *s++)) {
|
|
|
530 |
++ u = c - '0';
|
|
|
531 |
++ if (u >= 10) {
|
|
|
532 |
++ u = c - 'a';
|
|
|
533 |
++ if (u >= 6) break;
|
|
|
534 |
++ u += 10;
|
|
|
535 |
++ }
|
|
|
536 |
++ seconds <<= 4;
|
|
|
537 |
++ seconds += nanoseconds >> 28;
|
|
|
538 |
++ nanoseconds &= 0xfffffff;
|
|
|
539 |
++ nanoseconds <<= 4;
|
|
|
540 |
++ nanoseconds += u;
|
|
|
541 |
++ }
|
|
|
542 |
++ seconds -= 4611686018427387914ULL;
|
|
|
543 |
++
|
|
|
544 |
++ len = fmt_ulong(datebuf, seconds);
|
|
|
545 |
++ datebuf[len++] = '.';
|
|
|
546 |
++ len += fmt_uint0(datebuf+len, nanoseconds, 9);
|
|
|
547 |
++ datebuf[len] = 0;
|
|
|
548 |
++
|
|
|
549 |
++ return datebuf;
|
|
|
550 |
++}
|
|
|
551 |
++
|
|
|
552 |
++stralloc line = {0};
|
|
|
553 |
++int match;
|
|
|
554 |
++
|
|
|
555 |
++#define FIELDS 20
|
|
|
556 |
++int field[FIELDS];
|
|
|
557 |
++
|
|
|
558 |
++void clear()
|
|
|
559 |
++{
|
|
|
560 |
++ while (numdel > 0) del_kill(0);
|
|
|
561 |
++ garbage();
|
|
|
562 |
++}
|
|
|
563 |
++
|
|
|
564 |
++void starting()
|
|
|
565 |
++{
|
|
|
566 |
++ unsigned long d;
|
|
|
567 |
++ unsigned long m;
|
|
|
568 |
++ int dpos;
|
|
|
569 |
++
|
|
|
570 |
++ scan_ulong(line.s + field[3],&d);
|
|
|
571 |
++ scan_ulong(line.s + field[5],&m);
|
|
|
572 |
++
|
|
|
573 |
++ dpos = del_add(d);
|
|
|
574 |
++
|
|
|
575 |
++ dmsg.u[dpos] = m;
|
|
|
576 |
++
|
|
|
577 |
++ dstart.u[dpos] = pool.len;
|
|
|
578 |
++ if (!stralloc_cats(&pool,datize(line.s + field[0]))) nomem();
|
|
|
579 |
++ if (!stralloc_0(&pool)) nomem();
|
|
|
580 |
++
|
|
|
581 |
++ dchan.u[dpos] = pool.len;
|
|
|
582 |
++ if (!stralloc_cats(&pool,line.s + field[7])) nomem();
|
|
|
583 |
++ if (!stralloc_0(&pool)) nomem();
|
|
|
584 |
++
|
|
|
585 |
++ drecip.u[dpos] = pool.len;
|
|
|
586 |
++ if (!stralloc_cats(&pool,line.s + field[8])) nomem();
|
|
|
587 |
++ if (!stralloc_0(&pool)) nomem();
|
|
|
588 |
++ case_lowers(pool.s + drecip.u[dpos]);
|
|
|
589 |
++
|
|
|
590 |
++ poolbytes += pool.len - dstart.u[dpos];
|
|
|
591 |
++}
|
|
|
592 |
++
|
|
|
593 |
++void delivery()
|
|
|
594 |
++{
|
|
|
595 |
++ unsigned long d;
|
|
|
596 |
++ unsigned long m;
|
|
|
597 |
++ int dpos;
|
|
|
598 |
++ int mpos;
|
|
|
599 |
++ char *result = "?";
|
|
|
600 |
++ char *reason = "";
|
|
|
601 |
++
|
|
|
602 |
++ scan_ulong(line.s + field[2],&d);
|
|
|
603 |
++
|
|
|
604 |
++ dpos = del_find(d);
|
|
|
605 |
++ if (dpos == -1) return;
|
|
|
606 |
++
|
|
|
607 |
++ m = dmsg.u[dpos];
|
|
|
608 |
++ mpos = msg_find(m);
|
|
|
609 |
++
|
|
|
610 |
++ if (str_start(line.s + field[3],"succ")) {
|
|
|
611 |
++ if (mpos != -1) ++numk.u[mpos];
|
|
|
612 |
++ result = "d k ";
|
|
|
613 |
++ reason = line.s + field[4];
|
|
|
614 |
++ }
|
|
|
615 |
++ else if (str_start(line.s + field[3],"fail")) {
|
|
|
616 |
++ if (mpos != -1) ++numd.u[mpos];
|
|
|
617 |
++ result = "d d ";
|
|
|
618 |
++ reason = line.s + field[4];
|
|
|
619 |
++ }
|
|
|
620 |
++ else if (str_start(line.s + field[3],"defer")) {
|
|
|
621 |
++ if (mpos != -1) ++numz.u[mpos];
|
|
|
622 |
++ result = "d z ";
|
|
|
623 |
++ reason = line.s + field[4];
|
|
|
624 |
++ }
|
|
|
625 |
++ else if (str_start(line.s + field[3],"report")) {
|
|
|
626 |
++ if (mpos != -1) ++numz.u[mpos];
|
|
|
627 |
++ result = "d z ";
|
|
|
628 |
++ reason = "report_mangled";
|
|
|
629 |
++ }
|
|
|
630 |
++
|
|
|
631 |
++ outs(result);
|
|
|
632 |
++
|
|
|
633 |
++ if (mpos != -1) {
|
|
|
634 |
++ outs(pool.s + birth.u[mpos]);
|
|
|
635 |
++ outs(" "); outs(pool.s + dstart.u[dpos]);
|
|
|
636 |
++ outs(" "); outs(datize(line.s + field[0]));
|
|
|
637 |
++ outs(" "); out(strnum,fmt_ulong(strnum,bytes.u[mpos]));
|
|
|
638 |
++ outs(" "); outs(pool.s + sender.u[mpos]);
|
|
|
639 |
++ outs(" "); outs(pool.s + dchan.u[dpos]);
|
|
|
640 |
++ outs("."); outs(pool.s + drecip.u[dpos]);
|
|
|
641 |
++ outs(" "); out(strnum,fmt_ulong(strnum,qp.u[mpos]));
|
|
|
642 |
++ outs(" "); out(strnum,fmt_ulong(strnum,uid.u[mpos]));
|
|
|
643 |
++ outs(" "); outs(reason);
|
|
|
644 |
++ }
|
|
|
645 |
++ else {
|
|
|
646 |
++ outs(pool.s + dstart.u[dpos]);
|
|
|
647 |
++ outs(" "); outs(pool.s + dstart.u[dpos]);
|
|
|
648 |
++ outs(" "); outs(datize(line.s + field[0]));
|
|
|
649 |
++ outs(" 0 ? "); outs(pool.s + dchan.u[dpos]);
|
|
|
650 |
++ outs("."); outs(pool.s + drecip.u[dpos]);
|
|
|
651 |
++ outs(" ? ? "); outs(reason);
|
|
|
652 |
++ }
|
|
|
653 |
++
|
|
|
654 |
++ outs("\n");
|
|
|
655 |
++
|
|
|
656 |
++ del_kill(dpos);
|
|
|
657 |
++ garbage();
|
|
|
658 |
++}
|
|
|
659 |
++
|
|
|
660 |
++void newmsg()
|
|
|
661 |
++{
|
|
|
662 |
++ unsigned long m;
|
|
|
663 |
++ int mpos;
|
|
|
664 |
++
|
|
|
665 |
++ scan_ulong(line.s + field[3],&m);
|
|
|
666 |
++ mpos = msg_find(m);
|
|
|
667 |
++ if (mpos == -1) return;
|
|
|
668 |
++ msg_kill(mpos);
|
|
|
669 |
++ garbage();
|
|
|
670 |
++}
|
|
|
671 |
++
|
|
|
672 |
++void endmsg()
|
|
|
673 |
++{
|
|
|
674 |
++ unsigned long m;
|
|
|
675 |
++ int mpos;
|
|
|
676 |
++
|
|
|
677 |
++ scan_ulong(line.s + field[3],&m);
|
|
|
678 |
++ mpos = msg_find(m);
|
|
|
679 |
++ if (mpos == -1) return;
|
|
|
680 |
++
|
|
|
681 |
++ outs("m "); outs(pool.s + birth.u[mpos]);
|
|
|
682 |
++ outs(" "); outs(datize(line.s + field[0]));
|
|
|
683 |
++ outs(" "); out(strnum,fmt_ulong(strnum,bytes.u[mpos]));
|
|
|
684 |
++ outs(" "); out(strnum,fmt_ulong(strnum,numk.u[mpos]));
|
|
|
685 |
++ outs(" "); out(strnum,fmt_ulong(strnum,numd.u[mpos]));
|
|
|
686 |
++ outs(" "); out(strnum,fmt_ulong(strnum,numz.u[mpos]));
|
|
|
687 |
++ outs(" "); outs(pool.s + sender.u[mpos]);
|
|
|
688 |
++ outs(" "); out(strnum,fmt_ulong(strnum,qp.u[mpos]));
|
|
|
689 |
++ outs(" "); out(strnum,fmt_ulong(strnum,uid.u[mpos]));
|
|
|
690 |
++ outs("\n");
|
|
|
691 |
++
|
|
|
692 |
++ msg_kill(mpos);
|
|
|
693 |
++ garbage();
|
|
|
694 |
++}
|
|
|
695 |
++
|
|
|
696 |
++void info()
|
|
|
697 |
++{
|
|
|
698 |
++ unsigned long m;
|
|
|
699 |
++ int mpos;
|
|
|
700 |
++
|
|
|
701 |
++ scan_ulong(line.s + field[3],&m);
|
|
|
702 |
++ mpos = msg_add(m);
|
|
|
703 |
++
|
|
|
704 |
++ scan_ulong(line.s + field[5],&bytes.u[mpos]);
|
|
|
705 |
++ scan_ulong(line.s + field[9],&qp.u[mpos]);
|
|
|
706 |
++ scan_ulong(line.s + field[11],&uid.u[mpos]);
|
|
|
707 |
++
|
|
|
708 |
++ numk.u[mpos] = 0;
|
|
|
709 |
++ numd.u[mpos] = 0;
|
|
|
710 |
++ numz.u[mpos] = 0;
|
|
|
711 |
++
|
|
|
712 |
++ birth.u[mpos] = pool.len;
|
|
|
713 |
++ if (!stralloc_cats(&pool,datize(line.s + field[0]))) nomem();
|
|
|
714 |
++ if (!stralloc_0(&pool)) nomem();
|
|
|
715 |
++
|
|
|
716 |
++ sender.u[mpos] = pool.len;
|
|
|
717 |
++ if (!stralloc_cats(&pool,line.s + field[7])) nomem();
|
|
|
718 |
++ if (!stralloc_0(&pool)) nomem();
|
|
|
719 |
++ case_lowers(pool.s + sender.u[mpos]);
|
|
|
720 |
++
|
|
|
721 |
++ poolbytes += pool.len - birth.u[mpos];
|
|
|
722 |
++}
|
|
|
723 |
++
|
|
|
724 |
++void extra()
|
|
|
725 |
++{
|
|
|
726 |
++ unsigned long m;
|
|
|
727 |
++ int mpos;
|
|
|
728 |
++
|
|
|
729 |
++ scan_ulong(line.s + field[2],&m);
|
|
|
730 |
++ mpos = msg_find(m);
|
|
|
731 |
++ if (mpos == -1) return;
|
|
|
732 |
++
|
|
|
733 |
++ scan_ulong(line.s + field[3],&numk.u[mpos]);
|
|
|
734 |
++ scan_ulong(line.s + field[4],&numz.u[mpos]);
|
|
|
735 |
++ scan_ulong(line.s + field[5],&numd.u[mpos]);
|
|
|
736 |
++}
|
|
|
737 |
++
|
|
|
738 |
++void pending()
|
|
|
739 |
++{
|
|
|
740 |
++ int i;
|
|
|
741 |
++
|
|
|
742 |
++ for (i = 0;i < nummsg;++i) {
|
|
|
743 |
++ outs5(pool.s + birth.u[i]);
|
|
|
744 |
++ outs5(" info msg ");
|
|
|
745 |
++ out5(strnum,fmt_ulong(strnum,msg.u[i]));
|
|
|
746 |
++ outs5(": bytes ");
|
|
|
747 |
++ out5(strnum,fmt_ulong(strnum,bytes.u[i]));
|
|
|
748 |
++ outs5(" from ");
|
|
|
749 |
++ outs5(pool.s + sender.u[i]);
|
|
|
750 |
++ outs5(" qp ");
|
|
|
751 |
++ out5(strnum,fmt_ulong(strnum,qp.u[i]));
|
|
|
752 |
++ outs5(" uid ");
|
|
|
753 |
++ out5(strnum,fmt_ulong(strnum,uid.u[i]));
|
|
|
754 |
++ outs5("\n");
|
|
|
755 |
++ outs5(pool.s + birth.u[i]);
|
|
|
756 |
++ outs5(" extra ");
|
|
|
757 |
++ out5(strnum,fmt_ulong(strnum,msg.u[i]));
|
|
|
758 |
++ outs5(" ");
|
|
|
759 |
++ out5(strnum,fmt_ulong(strnum,numk.u[i]));
|
|
|
760 |
++ outs5(" ");
|
|
|
761 |
++ out5(strnum,fmt_ulong(strnum,numz.u[i]));
|
|
|
762 |
++ outs5(" ");
|
|
|
763 |
++ out5(strnum,fmt_ulong(strnum,numd.u[i]));
|
|
|
764 |
++ outs5("\n");
|
|
|
765 |
++ }
|
|
|
766 |
++
|
|
|
767 |
++ for (i = 0;i < numdel;++i) {
|
|
|
768 |
++ outs5(pool.s + dstart.u[i]);
|
|
|
769 |
++ outs5(" starting delivery ");
|
|
|
770 |
++ out5(strnum,fmt_ulong(strnum,del.u[i]));
|
|
|
771 |
++ outs5(": msg ");
|
|
|
772 |
++ out5(strnum,fmt_ulong(strnum,dmsg.u[i]));
|
|
|
773 |
++ outs5(" to ");
|
|
|
774 |
++ outs5(pool.s + dchan.u[i]);
|
|
|
775 |
++ outs5(" ");
|
|
|
776 |
++ outs5(pool.s + drecip.u[i]);
|
|
|
777 |
++ outs5("\n");
|
|
|
778 |
++ }
|
|
|
779 |
++
|
|
|
780 |
++ out5(line.s,line.len);
|
|
|
781 |
++ if (substdio_flush(&ss5) == -1) die_write5();
|
|
|
782 |
++}
|
|
|
783 |
++
|
|
|
784 |
++stralloc outline = {0};
|
|
|
785 |
++
|
|
|
786 |
++void matchup(substdio *ssin)
|
|
|
787 |
++{
|
|
|
788 |
++ int i;
|
|
|
789 |
++ int j;
|
|
|
790 |
++ char ch;
|
|
|
791 |
++
|
|
|
792 |
++ for (;;) {
|
|
|
793 |
++ if (getln(ssin,&line,&match,'\n') == -1) die_read();
|
|
|
794 |
++ if (!match) break;
|
|
|
795 |
++
|
|
|
796 |
++ if (!stralloc_copy(&outline,&line)) nomem();
|
|
|
797 |
++
|
|
|
798 |
++ for (i = 0;i < line.len;++i) {
|
|
|
799 |
++ ch = line.s[i];
|
|
|
800 |
++ if ((ch == '\n') || (ch == ' ') || (ch == '\t')) line.s[i] = 0;
|
|
|
801 |
++ }
|
|
|
802 |
++ j = 0;
|
|
|
803 |
++ for (i = 0;i < FIELDS;++i) {
|
|
|
804 |
++ while (j < line.len) if (line.s[j]) break; else ++j;
|
|
|
805 |
++ field[i] = j;
|
|
|
806 |
++ while (j < line.len) if (!line.s[j]) break; else ++j;
|
|
|
807 |
++ }
|
|
|
808 |
++ if (!stralloc_0(&line)) nomem();
|
|
|
809 |
++
|
|
|
810 |
++ if (str_equal(line.s + field[1],"status:")) ;
|
|
|
811 |
++ else if (str_equal(line.s + field[1],"starting")) starting();
|
|
|
812 |
++ else if (str_equal(line.s + field[1],"delivery")) delivery();
|
|
|
813 |
++ else if (str_equal(line.s + field[1],"new")) newmsg();
|
|
|
814 |
++ else if (str_equal(line.s + field[1],"end")) endmsg();
|
|
|
815 |
++ else if (str_equal(line.s + field[1],"info")) info();
|
|
|
816 |
++ else if (str_equal(line.s + field[1],"extra")) extra();
|
|
|
817 |
++ else if (str_equal(line.s + field[1],"running")) clear();
|
|
|
818 |
++ else if (str_equal(line.s + field[1],"exiting")) clear();
|
|
|
819 |
++ else if (str_equal(line.s + field[1],"number")) ;
|
|
|
820 |
++ else if (str_equal(line.s + field[1],"local")) ;
|
|
|
821 |
++ else if (str_equal(line.s + field[1],"remote")) ;
|
|
|
822 |
++ else if (str_equal(line.s + field[1],"warning:")) out(outline.s,outline.len);
|
|
|
823 |
++ else if (str_equal(line.s + field[1],"alert:")) out(outline.s,outline.len);
|
|
|
824 |
++ else {
|
|
|
825 |
++ outs("? ");
|
|
|
826 |
++ out(outline.s,outline.len);
|
|
|
827 |
++ }
|
|
|
828 |
++ }
|
|
|
829 |
++}
|
|
|
830 |
++
|
|
|
831 |
++char subfd4_input[SUBSTDIO_INSIZE];
|
|
|
832 |
++static substdio i4t = SUBSTDIO_FDBUF(subfd_read,4,subfd4_input,sizeof subfd4_input);
|
|
|
833 |
++substdio *subfd4in = &i4t;
|
|
|
834 |
++
|
|
|
835 |
++void main()
|
|
|
836 |
++{
|
|
|
837 |
++ int i;
|
|
|
838 |
++ int j;
|
|
|
839 |
++ char ch;
|
|
|
840 |
++
|
|
|
841 |
++ if (!stralloc_copys(&pool,"")) nomem();
|
|
|
842 |
++
|
|
|
843 |
++ if (!ulongalloc_ready(&msg,1)) nomem();
|
|
|
844 |
++ if (!ulongalloc_ready(&bytes,1)) nomem();
|
|
|
845 |
++ if (!ulongalloc_ready(&qp,1)) nomem();
|
|
|
846 |
++ if (!ulongalloc_ready(&uid,1)) nomem();
|
|
|
847 |
++ if (!ulongalloc_ready(&numk,1)) nomem();
|
|
|
848 |
++ if (!ulongalloc_ready(&numd,1)) nomem();
|
|
|
849 |
++ if (!ulongalloc_ready(&numz,1)) nomem();
|
|
|
850 |
++ if (!ulongalloc_ready(&del,1)) nomem();
|
|
|
851 |
++ if (!ulongalloc_ready(&dmsg,1)) nomem();
|
|
|
852 |
++
|
|
|
853 |
++ matchup(subfd4in);
|
|
|
854 |
++ matchup(subfdin);
|
|
|
855 |
++
|
|
|
856 |
++ if (substdio_flush(subfdout) == -1) die_write();
|
|
|
857 |
++
|
|
|
858 |
++ pending();
|
|
|
859 |
++
|
|
|
860 |
++ _exit(0);
|
|
|
861 |
++}
|
|
|
862 |
+diff -x .svn -Naur qmailanalog-0.70/prog.do qmailanalog/prog.do
|
|
|
863 |
+--- qmailanalog-0.70/prog.do 1998-08-30 23:39:27.000000000 +0200
|
|
|
864 |
++++ qmailanalog/prog.do 2007-04-30 20:57:24.000000000 +0200
|
|
|
865 |
+@@ -1,5 +1,6 @@
|
|
|
866 |
+ dependon \
|
|
|
867 |
+ matchup \
|
|
|
868 |
++mlmatchup \
|
|
|
869 |
+ columnt \
|
|
|
870 |
+ zoverall \
|
|
|
871 |
+ zsendmail \
|
|
|
872 |
+diff -x .svn -Naur qmailanalog-0.70/TARGETS qmailanalog/TARGETS
|
|
|
873 |
+--- qmailanalog-0.70/TARGETS 1998-08-30 23:39:26.000000000 +0200
|
|
|
874 |
++++ qmailanalog/TARGETS 2007-05-03 00:14:59.000000000 +0200
|
|
|
875 |
+@@ -70,6 +70,9 @@
|
|
|
876 |
+ case_lowers.o
|
|
|
877 |
+ case.a
|
|
|
878 |
+ matchup
|
|
|
879 |
++mlmatchup
|
|
|
880 |
++mlmatchup.o
|
|
|
881 |
++mlmatchup.0
|
|
|
882 |
+ columnt.o
|
|
|
883 |
+ slurpclose.o
|
|
|
884 |
+ columnt
|
|
|
885 |
+diff -x .svn -Naur qmailanalog-0.70/zdeferrals.sh qmailanalog/zdeferrals.sh
|
|
|
886 |
+--- qmailanalog-0.70/zdeferrals.sh 1998-08-30 23:39:27.000000000 +0200
|
|
|
887 |
++++ qmailanalog/zdeferrals.sh 2007-04-30 20:57:24.000000000 +0200
|
|
|
888 |
+@@ -5,4 +5,4 @@
|
|
|
889 |
+ * xdelay is the total xdelay on those deliveries.
|
|
|
890 |
+ '
|
|
|
891 |
+ ( echo del xdelay reason
|
|
|
892 |
+-HOME/bin/deferrals | sort +2 ) | HOME/bin/columnt | tr _ ' '
|
|
|
893 |
++HOME/bin/deferrals | sort -k2 ) | HOME/bin/columnt | tr _ ' '
|
|
|
894 |
+diff -x .svn -Naur qmailanalog-0.70/zfailures.sh qmailanalog/zfailures.sh
|
|
|
895 |
+--- qmailanalog-0.70/zfailures.sh 1998-08-30 23:39:27.000000000 +0200
|
|
|
896 |
++++ qmailanalog/zfailures.sh 2007-04-30 20:57:24.000000000 +0200
|
|
|
897 |
+@@ -5,4 +5,4 @@
|
|
|
898 |
+ * xdelay is the total xdelay on those deliveries.
|
|
|
899 |
+ '
|
|
|
900 |
+ ( echo del xdelay reason
|
|
|
901 |
+-HOME/bin/failures | sort +2 ) | HOME/bin/columnt | tr _ ' '
|
|
|
902 |
++HOME/bin/failures | sort -k2 ) | HOME/bin/columnt | tr _ ' '
|
|
|
903 |
+diff -x .svn -Naur qmailanalog-0.70/zrecipients.sh qmailanalog/zrecipients.sh
|
|
|
904 |
+--- qmailanalog-0.70/zrecipients.sh 1998-08-30 23:39:27.000000000 +0200
|
|
|
905 |
++++ qmailanalog/zrecipients.sh 2007-04-30 20:57:24.000000000 +0200
|
|
|
906 |
+@@ -7,4 +7,4 @@
|
|
|
907 |
+ * xdelay is the total xdelay incurred by this recipient.
|
|
|
908 |
+ '
|
|
|
909 |
+ ( echo sbytes mess tries xdelay recipient
|
|
|
910 |
+-HOME/bin/recipients | sort +4 ) | HOME/bin/columnt
|
|
|
911 |
++HOME/bin/recipients | sort -k4 ) | HOME/bin/columnt
|
|
|
912 |
+diff -x .svn -Naur qmailanalog-0.70/zrhosts.sh qmailanalog/zrhosts.sh
|
|
|
913 |
+--- qmailanalog-0.70/zrhosts.sh 1998-08-30 23:39:27.000000000 +0200
|
|
|
914 |
++++ qmailanalog/zrhosts.sh 2007-04-30 20:57:24.000000000 +0200
|
|
|
915 |
+@@ -7,4 +7,4 @@
|
|
|
916 |
+ * xdelay is the total xdelay incurred by this host.
|
|
|
917 |
+ '
|
|
|
918 |
+ ( echo sbytes mess tries xdelay host
|
|
|
919 |
+-HOME/bin/rhosts | sort +4 ) | HOME/bin/columnt
|
|
|
920 |
++HOME/bin/rhosts | sort -k4 ) | HOME/bin/columnt
|
|
|
921 |
+diff -x .svn -Naur qmailanalog-0.70/zsenders.sh qmailanalog/zsenders.sh
|
|
|
922 |
+--- qmailanalog-0.70/zsenders.sh 1998-08-30 23:39:27.000000000 +0200
|
|
|
923 |
++++ qmailanalog/zsenders.sh 2007-04-30 20:57:24.000000000 +0200
|
|
|
924 |
+@@ -10,4 +10,4 @@
|
|
|
925 |
+ * xdelay is the total xdelay incurred by this sender.
|
|
|
926 |
+ '
|
|
|
927 |
+ ( echo mess bytes sbytes rbytes recips tries xdelay sender
|
|
|
928 |
+-HOME/bin/senders | sort -n +7 ) | HOME/bin/columnt
|
|
|
929 |
++HOME/bin/senders | sort -k7,7n ) | HOME/bin/columnt
|
|
|
930 |
+diff -x .svn -Naur qmailanalog-0.70/zsuccesses.sh qmailanalog/zsuccesses.sh
|
|
|
931 |
+--- qmailanalog-0.70/zsuccesses.sh 1998-08-30 23:39:27.000000000 +0200
|
|
|
932 |
++++ qmailanalog/zsuccesses.sh 2007-04-30 20:57:24.000000000 +0200
|
|
|
933 |
+@@ -5,4 +5,4 @@
|
|
|
934 |
+ * xdelay is the total xdelay on those deliveries.
|
|
|
935 |
+ '
|
|
|
936 |
+ ( echo del xdelay reason
|
|
|
937 |
+-HOME/bin/successes | sort +2 ) | HOME/bin/columnt | tr _ ' '
|
|
|
938 |
++HOME/bin/successes | sort -k2 ) | HOME/bin/columnt | tr _ ' '
|
|
|
939 |
+diff -x .svn -Naur qmailanalog-0.70/zsuids.sh qmailanalog/zsuids.sh
|
|
|
940 |
+--- qmailanalog-0.70/zsuids.sh 1998-08-30 23:39:27.000000000 +0200
|
|
|
941 |
++++ qmailanalog/zsuids.sh 2007-04-30 20:57:24.000000000 +0200
|
|
|
942 |
+@@ -10,4 +10,4 @@
|
|
|
943 |
+ * xdelay is the total xdelay incurred by this uid.
|
|
|
944 |
+ '
|
|
|
945 |
+ ( echo mess bytes sbytes rbytes recips tries xdelay uid
|
|
|
946 |
+-HOME/bin/suids | sort -n +7 ) | HOME/bin/columnt
|
|
|
947 |
++HOME/bin/suids | sort -k7,7n ) | HOME/bin/columnt
|
|
|
948 |
--
|
|
|
949 |
1.5.3.4
|
|
|
950 |
|