|
1 http://www.morettoni.net/qmail/matchup.c-taia.patch |
|
2 |
|
3 *** qmailanalog-0.70.orig/matchup.c Fri Jul 1 12:28:28 2005 |
|
4 --- qmailanalog-0.70/matchup.c Fri Jul 1 14:06:04 2005 |
|
5 *************** |
|
6 *** 417,422 **** |
|
7 --- 417,463 ---- |
|
8 |
|
9 stralloc outline = {0}; |
|
10 |
|
11 + void fix_taia() |
|
12 + { |
|
13 + stralloc tai = {0}; |
|
14 + stralloc tmp = {0}; |
|
15 + char *p = line.s+field[0]+1; |
|
16 + unsigned long secs; |
|
17 + unsigned long nanosecs; |
|
18 + unsigned long u; |
|
19 + char ch; |
|
20 + |
|
21 + secs = 0; |
|
22 + nanosecs = 0; |
|
23 + for (;;) { |
|
24 + ch = *p++; |
|
25 + u = ch - '0'; |
|
26 + if (u >= 10) { |
|
27 + u = ch - 'a'; |
|
28 + if (u >= 6) break; |
|
29 + u += 10; |
|
30 + } |
|
31 + secs <<= 4; |
|
32 + secs += nanosecs >> 28; |
|
33 + nanosecs &= 0xfffffff; |
|
34 + nanosecs <<= 4; |
|
35 + nanosecs += u; |
|
36 + } |
|
37 + secs -= 4611686018427387914ULL; |
|
38 + |
|
39 + if (!stralloc_copyb(&tai, strnum,fmt_ulong(strnum,secs))) nomem(); |
|
40 + if (!stralloc_cats(&tai,".")) nomem(); |
|
41 + if (!stralloc_catb(&tai, strnum,fmt_ulong(strnum,nanosecs))) nomem(); |
|
42 + if (!stralloc_0(&tai)) nomem(); |
|
43 + |
|
44 + if (!stralloc_copy(&tmp,&tai)) nomem(); |
|
45 + while (tmp.len < field[1]) |
|
46 + if (!stralloc_cats(&tmp," ")) nomem(); |
|
47 + if (!stralloc_cats(&tmp,line.s + field[1])) nomem(); |
|
48 + if (!stralloc_copy(&line,&tmp)) nomem(); |
|
49 + if (!stralloc_0(&line)) nomem(); |
|
50 + } |
|
51 + |
|
52 void main() |
|
53 { |
|
54 int i; |
|
55 *************** |
|
56 *** 452,457 **** |
|
57 --- 493,500 ---- |
|
58 while (j < line.len) if (!line.s[j]) break; else ++j; |
|
59 } |
|
60 if (!stralloc_0(&line)) nomem(); |
|
61 + |
|
62 + if ((line.s[field[0]]) == '@') fix_taia(); |
|
63 |
|
64 if (str_equal(line.s + field[1],"status:")) ; |
|
65 else if (str_equal(line.s + field[1],"starting")) starting(); |