QMail ;-)

Wiktor R. Braun Wiktor.R.Braun at LocalHost.CONVECTOR.com.pl
Thu Sep 27 14:31:49 CEST 2001


Proponowany patch dodatkowy do qmail'a. Należy jeszcze uwzględnić zmianę
link'a symbolicznego do /usr/sbin/sendmail i /usr/lib/sendmail jak poniżej:
ln -sf /var/qmail/bin/datemail /usr/sbin/sendmail
ln -sf /var/qmail/bin/datemail /usr/lib/sendmail
Powyższe nie jest konieczne, ale zalecane.

To na razie tyle, jak sprawdzę do końca różnice w zainstalowanych patch'ach
dystrybucji PLD, a tym co sam znalazłem i będzie to godne uwagi, to dam znać.

-- 
Z pozdrowieniami, Wiktor.
_________________________________________________   o~o
Wiktor R. Braun <Wiktor.R.Braun at Convector.COM.pl>   /V\
Administrator Sieci Komputerowej. Tel:012/6451008  // \\
   L   I   N   U   X     Registered User: #132004 /( . )\
>Don't fear the penguin<  GG# 13845  ICQ# 5930951  ^^-^^
-------------- next part --------------
This patch causes the various qmail programs to generate date stamps in
the local timezone. I find GMT too annoying to convert from/to. I make
no warranties that it will work in your timezone, however it works for me.

Works with qmail 1.01 to 1.03.

To apply this patch, cd into the qmail source directory and type...
	patch -s -p1 < patch-to-patch-file

--- qmail-1.03.orig/date822fmt.c	Tue Apr 15 15:05:23 1997
+++ qmail-1.03/date822fmt.c	Fri Apr 18 00:39:41 1997
@@ -1,3 +1,4 @@
+#include <time.h>
 #include "datetime.h"
 #include "fmt.h"
 #include "date822fmt.h"
@@ -12,18 +13,51 @@
 {
   unsigned int i;
   unsigned int len;
+  time_t now;
+  datetime_sec utc;
+  datetime_sec local;
+  struct tm *tm;
+  struct datetime new_dt;
+  int minutes;
+
+  utc = datetime_untai(dt);
+  now = (time_t)utc;
+  tm = localtime(&now);
+  new_dt.year = tm->tm_year;
+  new_dt.mon = tm->tm_mon;
+  new_dt.mday = tm->tm_mday;
+  new_dt.hour = tm->tm_hour;
+  new_dt.min = tm->tm_min;
+  new_dt.sec = tm->tm_sec;
+  local = datetime_untai(&new_dt);
+
   len = 0;
-  i = fmt_uint(s,dt->mday); len += i; if (s) s += i;
+  i = fmt_uint(s,new_dt.mday); len += i; if (s) s += i;
   i = fmt_str(s," "); len += i; if (s) s += i;
-  i = fmt_str(s,montab[dt->mon]); len += i; if (s) s += i;
+  i = fmt_str(s,montab[new_dt.mon]); len += i; if (s) s += i;
   i = fmt_str(s," "); len += i; if (s) s += i;
-  i = fmt_uint(s,dt->year + 1900); len += i; if (s) s += i;
+  i = fmt_uint(s,new_dt.year + 1900); len += i; if (s) s += i;
   i = fmt_str(s," "); len += i; if (s) s += i;
-  i = fmt_uint0(s,dt->hour,2); len += i; if (s) s += i;
+  i = fmt_uint0(s,new_dt.hour,2); len += i; if (s) s += i;
   i = fmt_str(s,":"); len += i; if (s) s += i;
-  i = fmt_uint0(s,dt->min,2); len += i; if (s) s += i;
+  i = fmt_uint0(s,new_dt.min,2); len += i; if (s) s += i;
   i = fmt_str(s,":"); len += i; if (s) s += i;
-  i = fmt_uint0(s,dt->sec,2); len += i; if (s) s += i;
-  i = fmt_str(s," -0000\n"); len += i; if (s) s += i;
+  i = fmt_uint0(s,new_dt.sec,2); len += i; if (s) s += i;
+
+  if (local < utc) {
+    minutes = (utc - local + 30) / 60;
+    i = fmt_str(s," -"); len += i; if (s) s += i;
+    i = fmt_uint0(s,minutes / 60,2); len += i; if (s) s += i;
+    i = fmt_uint0(s,minutes % 60,2); len += i; if (s) s += i;
+  }
+  else {
+    minutes = (local - utc + 30) / 60;
+    i = fmt_str(s," +"); len += i; if (s) s += i;
+    i = fmt_uint0(s,minutes / 60,2); len += i; if (s) s += i;
+    i = fmt_uint0(s,minutes % 60,2); len += i; if (s) s += i;
+  }
+
+  i = fmt_str(s,"\n"); len += i; if (s) s += i;
+
   return len;
 }


More information about the feedback mailing list