diff -ru src.old/daemon/bguard.c src/daemon/bguard.c
--- src.old/daemon/bguard.c	2010-04-01 00:36:46.000000000 +0800
+++ src/daemon/bguard.c	2012-10-06 07:27:05.000000000 +0800
@@ -129,7 +129,7 @@
 
   umask(077);
 
-  if (fp = fopen(GUARD_PIDFILE, "w"))
+  if ((fp = fopen(GUARD_PIDFILE, "w")) != NULL)
   {
     fprintf(fp, "%d\n", getpid());
     fclose(fp);
@@ -281,7 +281,7 @@
   do
   {
     flop++;
-    if (pid = uentp->pid)
+    if ((pid = uentp->pid))
     {
 #ifdef DETAIL_IDLETIME
       idle = (now - uentp->idle_time) / 60;
@@ -658,7 +658,7 @@
 
   cmd = str = ap->pool;
 
-  while (ch = *str)
+  while ((ch = *str) != '\0')
   {
     str++;
     if (ch != ' ' && ch != '\t')
@@ -768,7 +768,7 @@
 
   str[len] = '\0';
 
-  while (cc = *str)
+  while ((cc = *str) != '\0')
   {
     if (cc == '\r' || cc == '\n')
     {
@@ -899,16 +899,16 @@
     "system time: %.6f\n"
     "maximum resident set size: %lu P\n"
     "integral resident set size: %lu\n"
-    "page faults not requiring physical I/O: %d\n"
-    "page faults requiring physical I/O: %d\n"
-    "swaps: %d\n"
-    "block input operations: %d\n"
-    "block output operations: %d\n"
-    "messages sent: %d\n"
-    "messages received: %d\n"
-    "signals received: %d\n"
-    "voluntary context switches: %d\n"
-    "involuntary context switches: %d\n"
+    "page faults not requiring physical I/O: %ld\n"
+    "page faults requiring physical I/O: %ld\n"
+    "swaps: %ld\n"
+    "block input operations: %ld\n"
+    "block output operations: %ld\n"
+    "messages sent: %ld\n"
+    "messages received: %ld\n"
+    "signals received: %ld\n"
+    "voluntary context switches: %ld\n"
+    "involuntary context switches: %ld\n"
     "gline: %d\n\n",
 
     (double) ru.ru_utime.tv_sec + (double) ru.ru_utime.tv_usec / 1000000.0,
@@ -1062,7 +1062,7 @@
       {
 	tagent = uptime - FINGER_TIMEOUT;
 
-	for (FBI = &Scully; agent = *FBI;)
+	for (FBI = &Scully; (agent = *FBI);)
 	{
 	  if (agent->uptime < tagent)
 	  {
@@ -1136,7 +1136,7 @@
 
     uptime = time(0);
 
-    for (FBI = &Scully; agent = *FBI;)
+    for (FBI = &Scully; (agent = *FBI);)
     {
       csock = agent->sock;
 
@@ -1188,7 +1188,7 @@
 
 	if (csock > 0)
 	{
-	  if (agent = Mulder)
+	  if ((agent = Mulder))
 	  {
 	    Mulder = agent->next;
 	  }
diff -ru src.old/daemon/bmtad.c src/daemon/bmtad.c
--- src.old/daemon/bmtad.c	2011-04-21 21:43:31.000000000 +0800
+++ src/daemon/bmtad.c	2012-10-26 16:27:33.000000000 +0800
@@ -20,6 +20,8 @@
 
 
 #include "bbs.h"
+#include "dns.h"
+#include "../lib/dns.p"
 
 
 /* Thor.990221: ¾¨¶q fflush ¥X log */
@@ -249,7 +251,7 @@
 
   umask(077);
 
-  if (fp = fopen(BMTA_PIDFILE, "w"))
+  if ((fp = fopen(BMTA_PIDFILE, "w")) != NULL)
   {
     fprintf(fp, "%d\n", getpid());
     fclose(fp);
@@ -283,7 +285,7 @@
   char *base, *head;
 
   head = base = ap->data;
-  while (cc = *msg++)
+  while ((cc = *msg++))
   {
     *head++ = cc;
   }
@@ -393,7 +395,7 @@
 {
   BRD *brd;
 
-  if (brd = brd_get(brdname))
+  if ((brd = brd_get(brdname)) != NULL)
   {
     strcpy(brdname, brd->brdname);	/* ´«¦¨¥¿½Tªº¤j¤p¼g */
     return 1;
@@ -408,7 +410,7 @@
 {
   BRD *brd;
 
-  if (brd = brd_get(brdname))
+  if ((brd = brd_get(brdname)) != NULL)
     brd->btime = -1;
 }
 
@@ -504,7 +506,7 @@
   }
   else
   {
-    while (len = *key)
+    while ((len = *key))
     {
       key++;
       seed += len << shft;
@@ -528,7 +530,7 @@
     size = HASH_TABLE_SIZE;
 
   he_len = size * sizeof(HashEntry *);
-  if (ht = (HashTable *) malloc(sizeof(HashTable) + he_len))
+  if ((ht = (HashTable *) malloc(sizeof(HashTable) + he_len)) != NULL)
   {
     ht->mask = size - 1;
     ht->keylen = keylen;
@@ -656,7 +658,7 @@
     {
       if (len == 0)
 	len = strlen(key) + 1;
-      if (he = (HashEntry *) malloc(sizeof(HashEntry) + len))
+      if ((he = (HashEntry *) malloc(sizeof(HashEntry) + len)) != NULL)
       {
 	*hp = he;
 	he->hv = hv;
@@ -698,7 +700,7 @@
   for (i = ht->mask; i >= 0; i--)
   {
     hp = &(ht->bucket[i]);
-    while (he = *hp)
+    while ((he = *hp) != NULL)
     {
       if (he->uptime < expire)
       {
@@ -776,7 +778,7 @@
     {
       int hflag, len;
 
-      hflag = dns_name((char *)addr, host);
+      hflag = dns_name((unsigned char *)addr, host);
       len = strlen(host) + 1;
       he = (HostHashEntry *) malloc(sizeof(HostHashEntry) + len);
       he->hostaddr = addr->addr;
@@ -817,7 +819,7 @@
   {
     hp = &HostHashTable[i];
 
-    while (he = *hp)
+    while ((he = *hp) != NULL)
     {
       if (he->uptime < now)
       {
@@ -917,7 +919,7 @@
 {
   FILE *fp;
 
-  if (fp = fopen(UNMAIL_ACLFILE, "a"))
+  if ((fp = fopen(UNMAIL_ACLFILE, "a")) != NULL)
   {
     struct tm *p;
 
@@ -986,10 +988,10 @@
   if (top == NULL)
     return;
 
-  if (node = top->left)
+  if ((node = top->left) != NULL)
     splay_free(node);
 
-  if (node = top->right)
+  if ((node = top->right) != NULL)
     splay_free(node);
 
   MYDOG;
@@ -1443,7 +1445,7 @@
   char *str;
   ACL_t *ax;
 
-  str = filter;
+  str = (char*)filter;
   at = len = 0;
   for (;;)
   {
@@ -1470,13 +1472,13 @@
   ax->nacl = root;
   ax->locus = at ? at : len;
 
-  str = ax->filter;
+  str = (char*)ax->filter;
   do
   {
     cc = *filter++;
     if (cc >= 'A' && cc <= 'Z')
       cc |= 0x20;
-  } while (*str++ = cc);
+  } while ((*str++ = cc));
 
   return ax;
 }
@@ -1492,18 +1494,18 @@
   ACL_t *ax, *nacl;
 
   /* ¥ý²MªÅ */
-  if (ax = root)
+  if ((ax = root) != NULL)
   {
     do
     {
       nacl = ax->nacl;
       free(ax);
-    } while (ax = nacl);
+    } while ((ax = nacl) != NULL);
 
     ax = NULL;
   }
 
-  if (fp = fopen(fpath, "r"))
+  if ((fp = fopen(fpath, "r")) != NULL)
   {
     fpath = buf;
     while (fgets(fpath, sizeof(buf), fp))
@@ -1514,7 +1516,7 @@
       if (*fpath == '#')
 	continue;
 
-      ax = acl_add(ax, fpath);
+      ax = acl_add(ax, (unsigned char*)fpath);
     }
     fclose(fp);
   }
@@ -1559,7 +1561,7 @@
       filter -= locus;
       if (*filter == '\0')	/* majordomo@ */
 	return 1;
-      locus = strlen(filter);
+      locus = strlen((char*)filter);
     }
 
     /* match remote host name */
@@ -1588,10 +1590,10 @@
     /* subnet ¬Û¦P¤]ºâ match */
     if (locus <= lhost)
     {
-      if (!strcmp(rhost + lhost - locus, filter))
+      if (!strcmp((char*)(rhost + lhost - locus), (char*)filter))
 	return 1;
     }
-  } while (ax = ax->nacl);
+  } while ((ax = ax->nacl) != NULL);
 
   return 0;
 }
@@ -1651,7 +1653,7 @@
 	*head = '\0';
 	sprintf(head, "%s %s", pool, ap->addr);
 	agent_log(ap, "From:", head);
-	return str;
+	return (char*)str;
       }
 
       str++;
@@ -1661,7 +1663,7 @@
       *head++ = cc;
 
       if (head >= tail)
-	return str;
+	return (char*)str;
     }
 
     /* if (*str != ' ') */
@@ -1681,7 +1683,7 @@
 
   if (str_cmp(head, ap->from))
   {	/* Thor.000911.µù¸Ñ: ¦pªG¤£¤@¼Ëªº¸Ü, ­ncheck; ¤@¼Ëªº¤§«echeck¹L¤F */
-    if (tail = strchr(head, '@'))	/* Thor.000911.µù¸Ñ: ¥¿±`ªºaddrªº¸Ü */
+    if ((tail = strchr(head, '@')) != NULL)	/* Thor.000911.µù¸Ñ: ¥¿±`ªºaddrªº¸Ü */
     {
       *tail++ = '\0';
       
@@ -1689,7 +1691,7 @@
 	return NULL;
 
       /* ÀË¬d From: ¬O§_¦b¶Â¥Õ¦W³æ¤W */
-      if (!(ap->mode & (AM_VALID | AM_BBSADM)) && acl_spam(head, tail))
+      if (!(ap->mode & (AM_VALID | AM_BBSADM)) && acl_spam((unsigned char*)head, (unsigned char*)tail))
       {
 	tail[-1] = '@';
 	agent_log(ap, "SPAM-M", head);
@@ -1704,7 +1706,7 @@
     }
   }
 
-  return str;
+  return (char*)str;
 }
 
 
@@ -1737,7 +1739,7 @@
     {
       sprintf(head, "%s %s", ap->from, ap->addr);
       agent_log(ap, "Subj:", pool /* head */ );	/* Thor.980904:·Q¬Ýsubj¥þ»ª */
-      return str;
+      return (char*)str;
     }
 
     str++;
@@ -1757,15 +1759,15 @@
     if (head >= tail)		/* line too long */
     {
       agent_log(ap, "Subj:", pool);	/* Xshadow.980906: really line too long? */
-      return str;
+      return (char*)str;
     }
   }
 
   *head = 0;
 
-  str_decode(pool);
+  str_decode((unsigned char*)pool);
   str_ansi(ap->title, pool, sizeof(ap->title));
-  return str;
+  return (char*)str;
 }
 
 
@@ -1779,7 +1781,7 @@
 
   /* check the aliases */
 
-  for (i = 0; str = alias[i]; i++)
+  for (i = 0; (str = alias[i]) != NULL; i++)
   {
     if (!str_cmp(addr, str))
       return 1;
@@ -1796,13 +1798,13 @@
   unsigned char *str;
   char *code;
 {
-  str = mm_getencode(str, code);
+  str = (unsigned char*)mm_getencode(str, code);
 
   /* skip whole line */
   while (*str && *str++ != '\n')
     ;
 
-  return str;
+  return (char*)str;
 }
 
 
@@ -1820,11 +1822,11 @@
   while (*str == ' ')
     str++;
 
-  if (!str_ncmp(str, "multipart", 9))
+  if (!str_ncmp((char*)str, "multipart", 9))
   {
     char *tmp;
 
-    if (tmp = str_str(str, "boundary="))
+    if ((tmp = str_str((char*)str, "boundary=")) != NULL)
     {
       /* Thor.990221: ©~µM¦³ªº¤H¤£¥Î " */
       tmp += 9;
@@ -1839,14 +1841,14 @@
     logit("MULTI", base);
   }
 
-  while (cc = *str)
+  while ((cc = *str) != '\0')
   {
     str++;
     if (cc == '\n' && (!*str || *str > ' ' || *str == '\n'))
       break;
   }
 
-  return str;
+  return (char*)str;
 }
 
 
@@ -1870,20 +1872,20 @@
   int cc;
   int boundlen;
 
-  boundlen = strlen(boundary);
+  boundlen = strlen((char*)boundary);
   if (boundlen < 6)
     return 0;			/* Thor: boundary too small, "\n>  <\n" */
 
   while (*src)
   {
-    bound = strstr(src, boundary);
+    bound = strstr((char*)src, (char*)boundary);
 
     if (bound)
       *bound = 0;
 
     if (buf[2])			/* Thor: multipart & encoded can't be happened simutaneously */
     {
-      cc = multipart(src, dst, buf);
+      cc = multipart(src, dst, (unsigned char*)buf);
       if (cc > 0)
 	dst += cc;
       else
@@ -1903,7 +1905,7 @@
     if (!bound)
       break;
 
-    src = bound + boundlen;	/* Thor: src over boundary */
+    src = (unsigned char*)(bound + boundlen);	/* Thor: src over boundary */
 
     tmp = dst + boundlen - 3 /* " <\n" */ ;
 
@@ -1920,17 +1922,17 @@
 
     for (;;)			/* Thor: processing sub-header */
     {
-      if (!str_ncmp(src, "Content-Transfer-Encoding:", 26))
+      if (!str_ncmp((char*)src, "Content-Transfer-Encoding:", 26))
       {				/* Thor.980901: ¸Ñ rfc1522 body code */
-	src = mta_decode(NULL, src + 26, &decode);
+	src = (unsigned char*)mta_decode(NULL, src + 26, &decode);
       }
-      else if (!str_ncmp(src, "Content-Type:", 13))
+      else if (!str_ncmp((char*)src, "Content-Type:", 13))
       {
-	src = mta_boundary(NULL, src + 13, buf + 2);
+	src = (unsigned char*)mta_boundary(NULL, src + 13, buf + 2);
       }
       else
       {
-	while (cc = *src)
+	while ((cc = *src) != '\n')
 	  /* Thor.980907: ­è¦n¸õ¤Fboundary«áªº \n,¤£¬O¬G·Nªº :p */
 	{
 	  src++;
@@ -1973,7 +1975,7 @@
     if (!str_ncmp(data, "From:", 5))
     {
       data += 5;
-      data = mta_from(ap, data);
+      data = mta_from(ap, (unsigned char*)data);
       if (!data)
       {
 	agent_reply(ap, "550 you are not in my access list");
@@ -1982,11 +1984,11 @@
     }
     else if (!str_ncmp(data, "Subject:", 8))
     {
-      data = mta_subject(ap, data + 8);
+      data = mta_subject(ap, (unsigned char*)(data + 8));
     }
     else if (!str_ncmp(data, "Content-Transfer-Encoding:", 26))
     {				/* Thor.980901: ¸Ñ rfc1522 body code */
-      data = mta_decode(ap, data + 26, &decode);
+      data = mta_decode(ap, (unsigned char*)(data + 26), &decode);
     }
     else if (!str_ncmp(data, "Content-Type:", 13))
     {				/* Thor.980907: ¸Ñ multi-part */
@@ -2014,7 +2016,7 @@
       }
 #endif
 
-      data = mta_boundary(ap, data + 13, boundary + 2);
+      data = mta_boundary(ap, (unsigned char*)(data + 13), boundary + 2);
     }
     else
     {
@@ -2105,7 +2107,8 @@
   if (boundary[2])
   {
     /* logit("MULTIDATA",data); */
-    cc = multipart(data, data, boundary);
+    cc = multipart((unsigned char*)data, (unsigned char*)data, 
+			(unsigned char*)boundary);
     if (cc > 0)
       ap->used = (data - ap->data) + cc;	/* (data - ap->data) ¬O header ªø«×¡Acc ¬O«H¤º®eªºªø«× */
   }
@@ -2120,7 +2123,7 @@
      * write(fd, data, ap->data + ap->used - data);          *
      * ¬G­×§ï ap->used, ¥HºI±¼¹Lªø data                      */
 
-    cc = mmdecode(data, decode, data);
+    cc = mmdecode((unsigned char*)data, decode, (unsigned char*)data);
     if (cc > 0)
       ap->used = (data - ap->data) + cc;	/* (data - ap->data) ¬O header ªø«×¡Acc ¬O«H¤º®eªºªø«× */
 
@@ -2151,7 +2154,7 @@
 
     if (he->score >= SPAM_MHOST_LIMIT)
     {
-      unmail_root = acl_add(unmail_root, str);
+      unmail_root = acl_add(unmail_root, (unsigned char*)str);
       spam_add(he);
       fprintf(flog, "SPAM-H\t[%d] %s\n", ap->sno, str);
 
@@ -2207,7 +2210,7 @@
 
     if (he->score >= SPAM_MFROM_LIMIT)
     {
-      unmail_root = acl_add(unmail_root, addr);
+      unmail_root = acl_add(unmail_root, (unsigned char*)addr);
       spam_add(he);
       fprintf(flog, "SPAM-F\t[%d] %s\n", ap->sno, addr);
 
@@ -2235,7 +2238,7 @@
     char *dot;
 
     addr = ap->addr;
-    if (dot = strchr(addr, '.'))
+    if ((dot = strchr(addr, '.')) != NULL)
     {
       if (!str_cmp(dot, ".bbs@" MYHOSTNAME))	/* itoc.020125.µù¸Ñ: ­Y±H«HªÌ¬°¥»¯¸µo«H¡A¥u¯d ID */
 	*dot = '\0';
@@ -2250,7 +2253,7 @@
 	bbs_mail(ap, data, str);
       else
 	bbs_brd(ap, data, str);
-    } while (rcpt = rcpt->rnext);
+    } while ((rcpt = rcpt->rnext) != NULL);
 
     if (dot)
       *dot = '.';
@@ -2273,14 +2276,14 @@
 
   ap->nrcpt = 0;
 
-  if (rcpt = ap->rcpt)
+  if ((rcpt = ap->rcpt) != NULL)
   {
     ap->rcpt = NULL;
     do
     {
       next = rcpt->rnext;
       free(rcpt);
-    } while (rcpt = next);
+    } while ((rcpt = next) != NULL);
   }
 }
 
@@ -2298,9 +2301,9 @@
   if (cc == ' ' || cc == '\0')
     return;
 
-  unmail_root = acl_add(unmail_root, from);
+  unmail_root = acl_add(unmail_root, (unsigned char*)from);
 
-  if (fp = fopen(UNMAIL_ACLFILE, "a"))
+  if ((fp = fopen(UNMAIL_ACLFILE, "a")) != NULL)
   {
     struct tm *p;
 
@@ -2408,7 +2411,7 @@
     return -2;			/* <> null domain */
 
   *ptr = '\0';
-  if (ptr = strrchr(addr, ':'))
+  if ((ptr = strrchr(addr, ':')))
   {
     relay = 1;
     addr = ptr + 1;
@@ -2426,7 +2429,7 @@
   if (**user == '"')
     (*user)++;
 
-  for (ptr = NULL; ch = *addr; addr++)
+  for (ptr = NULL; (ch = *addr) != '\0'; addr++)
   {
     if (ch == '@')
     {
@@ -2534,7 +2537,7 @@
 
   MYDOG;
   /* ÀË¬d MAIL FROM: ¬O§_¦b¶Â¥Õ¦W³æ¤W */
-  if (acl_spam(user, domain))
+  if (acl_spam((unsigned char*)user, (unsigned char*)domain))
   {
     ap->xspam++;
     ap->mode |= AM_SPAM;
@@ -2567,7 +2570,7 @@
 
   /* check the aliases */
 
-  for (len = 0; str = alias[len]; len++)
+  for (len = 0; (str = alias[len]); len++)
   {
     if (!str_cmp(rcpt, str))
       return AM_BBSADM;
@@ -2689,15 +2692,15 @@
     /* format: sprintf(servo_ident, "[%d] %s ip:%08x", ++servo_sno, rhost, csin.sin_addr.s_addr); */
     char rhost[256], *s;
 
-    if (s = strchr(ap->ident, ' '))
+    if ((s = strchr(ap->ident, ' ')))
     {
       strcpy(rhost, s + 1);
-      if (s = strchr(rhost, ' '))
+      if ((s = strchr(rhost, ' ')))
       {
 	*s = '\0';
 
 	/* ÀË¬d µo«Hªº¾÷¾¹ ¬O§_¦b¶Â¥Õ¦W³æ¤W */
-	if (acl_spam("*", rhost))
+	if (acl_spam((unsigned char*)"*", (unsigned char*)rhost))
 	{
 	  ap->mode |= AM_SPAM;
 	  agent_log(ap, "SPAM-M", rhost);
@@ -2949,7 +2952,7 @@
 	{
 	  size += TCP_RCVSIZ + (size >> 2);
 
-	  if (data = (char *) realloc(data, size))
+	  if ((data = (char *) realloc(data, size)) != NULL)
 	  {
 	    ap->data = data;
 	    ap->size = size;
@@ -3173,7 +3176,7 @@
     used = 32;
   }
 
-  while (cc = *head)
+  while ((cc = *head) != '\0')
   {
     if (cc == '\r' || cc == '\n')
     {
@@ -3189,7 +3192,7 @@
 	return -1;
       }
 
-      for (cmd = cmd_table; head = cmd->cmd; cmd++)
+      for (cmd = cmd_table; (head = cmd->cmd); cmd++)
       {
 	if (!str_ncmp(data, head, 4))
 	  break;
@@ -3198,7 +3201,7 @@
       MYDOG;
       ap->used = 0;
 
-      sprintf(gtext, "ip:%08x ", ap->ip_addr);
+      sprintf(gtext, "ip:%08lx ", ap->ip_addr);
       str_ncpy(gtext + 3 + 8 + 1, data, 50);
 
       (*cmd->func) (ap);
@@ -3299,7 +3302,7 @@
   {
     value = sizeof(csin);
     MYDOG;
-    csock = accept(0, (struct sockaddr *) & csin, &value);
+    csock = accept(0, (struct sockaddr *) & csin, (unsigned int*) &value);
     MYDOG;
     /* if (csock > 0) */
     if (csock >= 0)		/* Thor.000126: more proper */
@@ -3366,16 +3369,16 @@
     " system time: %.6f\n"
     " maximum resident set size: %lu P\n"
     " integral resident set size: %lu\n"
-    " page faults not requiring physical I/O: %d\n"
-    " page faults requiring physical I/O: %d\n"
-    " swaps: %d\n"
-    " block input operations: %d\n"
-    " block output operations: %d\n"
-    " messages sent: %d\n"
-    " messages received: %d\n"
-    " signals received: %d\n"
-    " voluntary context switches: %d\n"
-    " involuntary context switches: %d\ngline: %d\ngtext: %s\n",
+    " page faults not requiring physical I/O: %ld\n"
+    " page faults requiring physical I/O: %ld\n"
+    " swaps: %ld\n"
+    " block input operations: %ld\n"
+    " block output operations: %ld\n"
+    " messages sent: %ld\n"
+    " messages received: %ld\n"
+    " signals received: %ld\n"
+    " voluntary context switches: %ld\n"
+    " involuntary context switches: %ld\ngline: %d\ngtext: %s\n",
 
     (double) ru.ru_utime.tv_sec + (double) ru.ru_utime.tv_usec / 1000000.0,
     (double) ru.ru_stime.tv_sec + (double) ru.ru_stime.tv_usec / 1000000.0,
@@ -3691,7 +3694,7 @@
 
       tcheck = uptime - BMTA_TIMEOUT;
 
-      for (FBI = &Scully; agent = *FBI;)
+      for (FBI = &Scully; (agent = *FBI);)
       {
 	if ((agent->uptime < tcheck) || (agent->xerro > BMTA_FAULT))
 	{
@@ -3730,7 +3733,7 @@
 
 	hht_expire(uptime - 3 * 60 * 60);
 
-	/* ht_expire(forge_ht, tcheck); /* never expire */
+	/* ht_expire(forge_ht, tcheck); */ /* never expire */
 
 #ifdef FORGE_CHECK
 	/* Thor.990811: expire±¼¨S¥Îªºforge host */
@@ -3765,7 +3768,7 @@
 
     n = 0;
 
-    if (state = servo_state)
+    if ((state = servo_state))
     {
       if (state & SS_CONFIG)
       {
@@ -3850,7 +3853,7 @@
     uptime = time(0);
 
     MYDOG;
-    for (FBI = &Scully; agent = *FBI;)
+    for (FBI = &Scully; (agent = *FBI);)
     {
       sock = agent->sock;
 
@@ -3919,7 +3922,7 @@
 	/* Thor.990319: check maximum connection number */
 	int num = 0;
 
-	sscanf(strstr(servo_ident, "ip:") + 3, "%x", &ip_addr);
+	sscanf(strstr(servo_ident, "ip:") + 3, "%lx", &ip_addr);
 	for (agent = Scully; agent; agent = agent->anext)
 	{
 	  if (agent->ip_addr == ip_addr)
@@ -3946,7 +3949,7 @@
 	}
 #endif
 
-	if (agent = Mulder)
+	if ((agent = Mulder))
 	{
 	  Mulder = agent->anext;
 	}
diff -ru src.old/daemon/bnntpd.c src/daemon/bnntpd.c
--- src.old/daemon/bnntpd.c	2010-04-01 00:36:46.000000000 +0800
+++ src/daemon/bnntpd.c	2012-10-26 16:34:22.000000000 +0800
@@ -9,6 +9,8 @@
 
 
 #include "bbs.h"
+#include "dns.h"
+#include "../lib/dns.p"
 
 
 #include <sys/wait.h>
@@ -167,7 +169,7 @@
 
   umask(077);
 
-  if (fp = fopen(BNNTP_PIDFILE, "w"))
+  if ((fp = fopen(BNNTP_PIDFILE, "w")) != NULL)
   {
     fprintf(fp, "%d\n", getpid());
     fclose(fp);
@@ -197,7 +199,7 @@
   char *base, *head;
 
   head = base = ap->data;
-  while (cc = *msg++)
+  while ((cc = *msg++))
   {
     *head++ = cc;
   }
@@ -673,7 +675,7 @@
       {
 #endif
 	hdr_fpath(fpath, folder, &hdr);
-	if (fpr = fopen(fpath, "r"))
+	if ((fpr = fopen(fpath, "r")) != NULL)
 	{
 	  while (fgets(buf, ANSILINELEN, fpr))
 	  {
@@ -840,7 +842,7 @@
     used = 32;
   }
 
-  while (cc = *head)
+  while ((cc = *head))
   {
     if (cc == '\r' || cc == '\n')
     {
@@ -855,7 +857,7 @@
 	return -1;
       }
 
-      for (cmd = cmd_table; head = cmd->cmd; cmd++)
+      for (cmd = cmd_table; (head = cmd->cmd); cmd++)
       {
 	if (!str_ncmp(data, head, cmd->len))
 	  break;
@@ -935,7 +937,7 @@
   for (;;)
   {
     value = sizeof(csin);
-    csock = accept(0, (struct sockaddr *) & csin, &value);
+    csock = accept(0, (struct sockaddr *) & csin, (unsigned int *) &value);
     /* if (csock > 0) */
     if (csock >= 0)		/* Thor.000126: more proper */
       break;
@@ -983,16 +985,16 @@
     " system time: %.6f\n"
     " maximum resident set size: %lu P\n"
     " integral resident set size: %lu\n"
-    " page faults not requiring physical I/O: %d\n"
-    " page faults requiring physical I/O: %d\n"
-    " swaps: %d\n"
-    " block input operations: %d\n"
-    " block output operations: %d\n"
-    " messages sent: %d\n"
-    " messages received: %d\n"
-    " signals received: %d\n"
-    " voluntary context switches: %d\n"
-    " involuntary context switches: %d\n",
+    " page faults not requiring physical I/O: %ld\n"
+    " page faults requiring physical I/O: %ld\n"
+    " swaps: %ld\n"
+    " block input operations: %ld\n"
+    " block output operations: %ld\n"
+    " messages sent: %ld\n"
+    " messages received: %ld\n"
+    " signals received: %ld\n"
+    " voluntary context switches: %ld\n"
+    " involuntary context switches: %ld\n",
 
     (double) ru.ru_utime.tv_sec + (double) ru.ru_utime.tv_usec / 1000000.0,
     (double) ru.ru_stime.tv_sec + (double) ru.ru_stime.tv_usec / 1000000.0,
@@ -1276,7 +1278,7 @@
 
       tcheck = uptime - BNNTP_TIMEOUT;
 
-      for (FBI = &Scully; agent = *FBI;)
+      for (FBI = &Scully; (agent = *FBI);)
       {
 	if (agent->uptime < tcheck)
 	{
@@ -1319,7 +1321,7 @@
 
     n = 0;
 
-    if (state = servo_state)
+    if ((state = servo_state))
     {
       if (state & SS_CONFIG)
       {
@@ -1400,7 +1402,7 @@
 
     uptime = time(0);
 
-    for (FBI = &Scully; agent = *FBI;)
+    for (FBI = &Scully; (agent = *FBI);)
     {
       sock = agent->sock;
 
@@ -1454,7 +1456,7 @@
 
       if (sock > 0)
       {
-	if (agent = Mulder)
+	if ((agent = Mulder))
 	{
 	  Mulder = agent->anext;
 	}
diff -ru src.old/daemon/bpop3d.c src/daemon/bpop3d.c
--- src.old/daemon/bpop3d.c	2010-04-01 00:36:46.000000000 +0800
+++ src/daemon/bpop3d.c	2012-10-26 16:38:21.000000000 +0800
@@ -178,7 +178,7 @@
 {
   FILE *fp;
 
-  if (fp = fopen(POP3_PIDFILE, "w"))
+  if ((fp = fopen(POP3_PIDFILE, "w")) != NULL)
   {
     fprintf(fp, "%d\n", getpid());
     fclose(fp);
@@ -216,7 +216,7 @@
   }
 
   token = NULL;
-  while (ch = *str)
+  while ((ch = *str) != '\0')
   {
     if (ch == ' ' /* || ch == '\t' || ch == '\r' || ch == '\n' */ )
     {
@@ -352,7 +352,7 @@
   cn->locus = head - pool;
   cn->state = CS_FILE;
 
-  if (body = cn->body)
+  if ((body = cn->body))
   {
     /* Thor.990522: ¦³°õ¦æªº¾÷·|¶Ü? */
     free(body);
@@ -368,7 +368,7 @@
 
     if (!fstat(fd, &st) && ((size = st.st_size) > 0))
     {
-      if (body = (char *) malloc(size + 1))
+      if ((body = (char *) malloc(size + 1)) != NULL)
       {
 	size = read(fd, body, size);
 	if (size > 0)
@@ -565,7 +565,7 @@
   lmax = cn->lmax;
   cx = '\n'; cc = 0;
 
-  while (ch = *bptr)
+  while ((ch = *bptr) != '\0')
   {
     /* Thor.990522: ±±¨î³æ¦æ³Ì¤j¶Ç°e¶q, Char Count. ¼g±oÁà¤FÂI, ·|¶]´N¦n:p */
     if (cc++ >= SNDLINSIZ)
@@ -740,7 +740,7 @@
 
   /* userid is "userid.bbs" or "userid" */
 
-  if (ptr = strchr(userid, '.'))
+  if ((ptr = strchr(userid, '.')))
   {
     if (strcmp(ptr, ".bbs"))
     {
@@ -1148,7 +1148,7 @@
   while (*head++ = *msg++)
     ; 
 #endif
-  while (*head = *msg++)
+  while ((*head = *msg++))
     head++;
   
   
@@ -1256,7 +1256,7 @@
   if (!cmd || !*cmd)
     return;
 
-  for (pc = cmdlist; str = pc->cmd; pc++)
+  for (pc = cmdlist; (str = pc->cmd); pc++)
   {
     if (!strcmp(cmd, str))
       break;
@@ -1327,7 +1327,7 @@
   }
 #endif
 
-  while (cc = *str)
+  while ((cc = *str) != '\0')
   {
     switch (cc)
     {
@@ -1370,10 +1370,10 @@
 
   if (cn->mode >= CM_LOGIN)
   {
-    if (ptr = (char *) cn->cache)
+    if ((ptr = (char *) cn->cache))
       free(ptr);
 
-    if (ptr = cn->body)
+    if ((ptr = cn->body))
       free(ptr);
   }
 
@@ -1514,16 +1514,16 @@
     "system time: %.6f\n"
     "maximum resident set size: %lu P\n"
     "integral resident set size: %lu\n"
-    "page faults not requiring physical I/O: %d\n"
-    "page faults requiring physical I/O: %d\n"
-    "swaps: %d\n"
-    "block input operations: %d\n"
-    "block output operations: %d\n"
-    "messages sent: %d\n"
-    "messages received: %d\n"
-    "signals received: %d\n"
-    "voluntary context switches: %d\n"
-    "involuntary context switches: %d\ngline: %d\n\n",
+    "page faults not requiring physical I/O: %ld\n"
+    "page faults requiring physical I/O: %ld\n"
+    "swaps: %ld\n"
+    "block input operations: %ld\n"
+    "block output operations: %ld\n"
+    "messages sent: %ld\n"
+    "messages received: %ld\n"
+    "signals received: %ld\n"
+    "voluntary context switches: %ld\n"
+    "involuntary context switches: %ld\ngline: %d\n\n",
 
     (double) ru.ru_utime.tv_sec + (double) ru.ru_utime.tv_usec / 1000000.0,
     (double) ru.ru_stime.tv_sec + (double) ru.ru_stime.tv_usec / 1000000.0,
@@ -1651,7 +1651,7 @@
     {
       tcheck = uptime - POP3_TIMEOUT;
 
-      for (FBI = &Scully; cn = *FBI;)
+      for (FBI = &Scully; (cn = *FBI);)
       {
 	if (cn->uptime < tcheck)
 	{
@@ -1742,7 +1742,7 @@
 
     uptime = time(0);
 
-    for (FBI = &Scully; cn = *FBI;)
+    for (FBI = &Scully; (cn = *FBI);)
     {
       csock = cn->sock;
 
@@ -1808,7 +1808,7 @@
       {
 	/* csock = accept(0, NULL, NULL); */
         /* Thor.990222: ¬d¥X¹ï¤è ip */
-	csock = accept(0, (struct sockaddr *)&csin, &len);
+	csock = accept(0, (struct sockaddr *)&csin, (unsigned int *)&len);
  
 	if (csock > 0)
 	  break;
@@ -1826,7 +1826,7 @@
       if (csock <= 0)
 	continue;
 
-      if (cn = Mulder)
+      if ((cn = Mulder))
       {
 	Mulder = cn->next;
       }
diff -ru src.old/daemon/gemd.c src/daemon/gemd.c
--- src.old/daemon/gemd.c	2010-04-01 00:36:46.000000000 +0800
+++ src/daemon/gemd.c	2012-10-26 16:41:31.000000000 +0800
@@ -118,7 +118,7 @@
 
   umask(077);
 
-  if (fp = fopen(GEMD_PIDFILE, "w"))
+  if ((fp = fopen(GEMD_PIDFILE, "w")) != NULL)
   {
     fprintf(fp, "%d\n", getpid());
     fclose(fp);
@@ -185,7 +185,7 @@
   if (!strncmp(fpath, "brd/", 4))
   {
     brdname = fpath + 4;
-    if (str = strchr(brdname, '/'))
+    if ((str = strchr(brdname, '/')))
     {
       *str = '\0';
       ret = allow_brdname(brdname);
@@ -210,7 +210,7 @@
 {
   int ch;
 
-  while (ch = *src++)
+  while ((ch = *src++))
     *dst++ = ch;
   return dst;
 }
@@ -272,7 +272,7 @@
       break;
     }
 
-    while (cc = *head)
+    while ((cc = *head))
     {
       if (cc == '\n')
       {
@@ -435,7 +435,7 @@
   if (cc != CS_FILE)
   {
     ap_log("DIR", ap->sno, data);
-    if (str = strrchr(data, '/'))
+    if ((str = strrchr(data, '/')))
     {
       if (str[1] != '.')
 	str--;
@@ -540,7 +540,7 @@
 
   data[cc] = '\0';
 
-  while (cc = *data)
+  while ((cc = *data) != '\0')
   {
     if (cc == '\r' || cc == '\n')
     {
@@ -599,7 +599,7 @@
   shutdown(sock, 2);
   close(sock);
 
-  if (fp = ap->stream)
+  if ((fp = ap->stream))
     fclose(fp);
 
   fprintf(flog, "%s\t[%d] T%d D%d\n",
@@ -751,16 +751,16 @@
     "system time: %.6f\n"
     "maximum resident set size: %lu P\n"
     "integral resident set size: %lu\n"
-    "page faults not requiring physical I/O: %d\n"
-    "page faults requiring physical I/O: %d\n"
-    "swaps: %d\n"
-    "block input operations: %d\n"
-    "block output operations: %d\n"
-    "messages sent: %d\n"
-    "messages received: %d\n"
-    "signals received: %d\n"
-    "voluntary context switches: %d\n"
-    "involuntary context switches: %d\n"
+    "page faults not requiring physical I/O: %ld\n"
+    "page faults requiring physical I/O: %ld\n"
+    "swaps: %ld\n"
+    "block input operations: %ld\n"
+    "block output operations: %ld\n"
+    "messages sent: %ld\n"
+    "messages received: %ld\n"
+    "signals received: %ld\n"
+    "voluntary context switches: %ld\n"
+    "involuntary context switches: %ld\n"
     "gline: %d\n\n",
 
     (double) ru.ru_utime.tv_sec + (double) ru.ru_utime.tv_usec / 1000000.0,
@@ -900,7 +900,7 @@
     {
       tcheck = uptime - GEMD_TIMEOUT;
 
-      for (FBI = &Scully; agent = *FBI;)
+      for (FBI = &Scully; (agent = *FBI);)
       {
 	if (agent->uptime < tcheck)
 	{
@@ -982,7 +982,7 @@
 
     uptime = time(0);
 
-    for (FBI = &Scully; agent = *FBI;)
+    for (FBI = &Scully; (agent = *FBI);)
     {
       sock = agent->sock;
 
@@ -1033,7 +1033,7 @@
       if (sock <= 0)
 	continue;
 
-      if (agent = Mulder)
+      if ((agent = Mulder))
       {
 	Mulder = agent->anext;
       }
diff -ru src.old/daemon/xchatd.c src/daemon/xchatd.c
--- src.old/daemon/xchatd.c	2011-01-27 10:41:34.000000000 +0800
+++ src/daemon/xchatd.c	2012-10-26 16:52:40.000000000 +0800
@@ -9,6 +9,8 @@
 
 #include "bbs.h"
 #include "xchat.h"
+#include "dns.h"
+#include "../lib/dns.p"
 
 
 #include <sys/wait.h>
@@ -191,7 +193,7 @@
   /* log daemon's PID					 */
   /* --------------------------------------------------- */
 
-  if (fp = fopen(CHAT_PIDFILE, "w"))
+  if ((fp = fopen(CHAT_PIDFILE, "w")) != NULL)
   {
     fprintf(fp, "%d\n", getpid());
     fclose(fp);
@@ -305,7 +307,7 @@
 {
   int ch, len;
 
-  for (len = 0; ch = *id; id++)
+  for (len = 0; (ch = *id) != '\0'; id++)
   { /* Thor.980921: ªÅ¥Õ¬°¤£¦X²zchatid, ©Ègetnext§PÂ_¿ù»~µ¥µ¥ */
     if (ch == '/' || ch == '*' || ch == ':' || ch ==' ')
       return 0;
@@ -451,7 +453,7 @@
     if (!cu->userno)
       continue;
 
-    mode = str_match(buf, cu->chatid);
+    mode = str_match((unsigned char*)buf, (unsigned char*)cu->chatid);
     if (mode == 0)
       return cu;
 
@@ -480,7 +482,7 @@
   {
     if (!str_cmp(buf, room->name))
       break;
-  } while (room = room->next);
+  } while ((room = room->next));
   return room;
 }
 
@@ -514,7 +516,7 @@
   int len;
 
   len = strlen(userid = user->userid) + 1;
-  if (node = (UserList *) malloc(sizeof(UserList) + len))
+  if ((node = (UserList *) malloc(sizeof(UserList) + len)) != NULL)
   {
     node->next = *list;
     node->userno = user->userno;
@@ -534,7 +536,7 @@
 
   str_lower(buf, userid);
 
-  while (node = *list)
+  while ((node = *list))
   {
     if (!str_cmp(buf, node->userid))
     {
@@ -856,7 +858,7 @@
     send_to_user(cu, buf, 0, MSG_MESSAGE);
 
     usr_fpath(buf, acct.userid, FN_PLANS);
-    if (fp = fopen(buf, "r"))
+    if ((fp = fopen(buf, "r")) != NULL)
     {
       int i;
 
@@ -1064,7 +1066,7 @@
 	send_to_user(cuser, buf, 0, MSG_MESSAGE);
       }
     }
-  } while (cr = cr->next);
+  } while ((cr = cr->next));
 
   if (mode)
     send_to_user(cuser, "", 0, MSG_ROOMLISTEND);
@@ -1419,7 +1421,7 @@
     table = chat_msg;
   }
 
-  while (str = *table++)
+  while ((str = *table++))
   {
     sprintf(buf, "  %-20s- %s", str, *table++);
     send_to_user(cu, buf, 0, MSG_MESSAGE);
@@ -1567,7 +1569,7 @@
     debug_room();
 #endif
 
-    if (room = roompool)
+    if ((room = roompool))
     {
       roompool = room->next;
     }
@@ -1681,7 +1683,7 @@
       userc += num;
       roomc++;
     }
-  } while (room = room->next);
+  } while ((room = room->next));
 
   number = (cuser->clitype) ? MSG_MOTD : MSG_MESSAGE;
 
@@ -1958,7 +1960,7 @@
     {
       UserList *list;
 
-      if (list = cu->ignore)
+      if ((list = cu->ignore))
       {
 	int len;
 	char userid[16];
@@ -1975,7 +1977,7 @@
 	    send_to_user(cu, str, 0, MSG_MESSAGE);
 	    len = 0;
 	  }
-	} while (list = list->next);
+	} while ((list = list->next));
 
 	if (len == 0)
 	  return;
@@ -2316,7 +2318,7 @@
 
     mid = locus + ((pos - locus) >> 1);
 
-    if (!(cmp = str_belong(mid->verb, cmd)))	/* itoc.010321: MUD-like match */
+    if (!(cmp = str_belong((unsigned char*)mid->verb, (unsigned char*)cmd)))	/* itoc.010321: MUD-like match */
       return mid;
     else if (cmp < 0)
       locus = mid;
@@ -2327,7 +2329,7 @@
   /* ¯S¨Ò: ¦pªG¥k«ü¼Ð°±¯d¦b 1¡A­nÀË¬d²Ä 0 ­Ó */
   if (pos == action + 1)
   {
-    if (!str_belong(action->verb, cmd))		/* itoc.010321: MUD-like match */
+    if (!str_belong((unsigned char*)action->verb, (unsigned char*)cmd))		/* itoc.010321: MUD-like match */
       return action;
   }
 
@@ -3184,7 +3186,7 @@
 
   if (cmd < '1' || cmd > '3')
   {				/* Thor.980726: ¼g±o¤£¦n, ·Q¿ìªk§ï¶i... */
-    for (i = 0; p = dscrb[i]; i++)
+    for (i = 0; (p = dscrb[i]); i++)
     {
       sprintf(data, "  [//]help %d          - MUD-like ªÀ¥æ°Êµü   ²Ä %d Ãþ", i + 1, i + 1);
       send_to_user(cu, data, 0, MSG_MESSAGE);
@@ -3205,7 +3207,7 @@
 
     cap = catbl[i];
 
-    for (i = 0; p = cap[i].verb; i++)
+    for (i = 0; (p = cap[i].verb); i++)
     {
       q = cap[i].chinese;
 
@@ -3342,7 +3344,7 @@
   {
     cmd++;
     /* if (!*cmd || !str_cmp("help", cmd)) */
-    if (!*cmd || str_match(cmd, "help") >= 0)	/* itoc.010321: ³¡¤À match ´Nºâ */
+    if (!*cmd || str_match((unsigned char*)cmd, (unsigned char*)"help") >= 0)	/* itoc.010321: ³¡¤À match ´Nºâ */
     {
       cmd = nextword(&msg);	/* Thor.980726: °Êµü¤ÀÃþ */
       view_action_verb(cu, *cmd);
@@ -3375,7 +3377,7 @@
 
     str_lower(buf, cmd);
 
-    for (cmdrec = chatcmdlist; str = cmdrec->cmdstr; cmdrec++)
+    for (cmdrec = chatcmdlist; (str = cmdrec->cmdstr); cmdrec++)
     {
       switch (cmdrec->exact)
       {
@@ -3389,7 +3391,7 @@
 	break;
 
       default:			/* not necessary equal */
-	match = str_match(buf, str) >= 0;
+	match = str_match((unsigned char*)buf, (unsigned char*)str) >= 0;
 	break;
       }
 
@@ -3633,16 +3635,16 @@
     "system time: %.6f\n"
     "maximum resident set size: %lu P\n"
     "integral resident set size: %lu\n"
-    "page faults not requiring physical I/O: %d\n"
-    "page faults requiring physical I/O: %d\n"
-    "swaps: %d\n"
-    "block input operations: %d\n"
-    "block output operations: %d\n"
-    "messages sent: %d\n"
-    "messages received: %d\n"
-    "signals received: %d\n"
-    "voluntary context switches: %d\n"
-    "involuntary context switches: %d\n"
+    "page faults not requiring physical I/O: %ld\n"
+    "page faults requiring physical I/O: %ld\n"
+    "swaps: %ld\n"
+    "block input operations: %ld\n"
+    "block output operations: %ld\n"
+    "messages sent: %ld\n"
+    "messages received: %ld\n"
+    "signals received: %ld\n"
+    "voluntary context switches: %ld\n"
+    "involuntary context switches: %ld\n"
     "gline: %d\n\n",
 
     (double) ru.ru_utime.tv_sec + (double) ru.ru_utime.tv_usec / 1000000.0,
@@ -3812,7 +3814,7 @@
 
       tcheck = uptime - CHAT_INTERVAL;
 
-      for (FBI = &mainuser; cu = *FBI;)
+      for (FBI = &mainuser; (cu = *FBI);)
       {
 	if (cu->uptime < tcheck)
 	{
@@ -3887,7 +3889,7 @@
 
     uptime = time(0);
 
-    for (FBI = &mainuser; cu = *FBI;)
+    for (FBI = &mainuser; (cu = *FBI);)
     {
       sock = cu->sock;
 
@@ -3958,10 +3960,10 @@
 	struct sockaddr_in sin;
 
 	value = sizeof(sin);
-	sock = accept(0, (struct sockaddr *) &sin, &value);
+	sock = accept(0, (struct sockaddr *) &sin, (unsigned int *)&value);
 	if (sock > 0)
 	{
-	  if (cu = userpool)
+	  if ((cu = userpool))
 	  {
 	    userpool = cu->unext;
 	  }
diff -ru src.old/game/fantan.c src/game/fantan.c
--- src.old/game/fantan.c	2010-04-01 00:36:46.000000000 +0800
+++ src/game/fantan.c	2012-10-26 18:12:34.000000000 +0800
@@ -203,7 +203,7 @@
       {
       case 'q':
 	vmsg(MSG_QUITGAME);
-	return;
+	return XEASY;
 
       case 'r':
 	goto game_start;
@@ -261,7 +261,7 @@
 	    difftime(time(0), init_time), level);
 	  vmsg(buf);
 	  addmoney(level * 100);
-	  return;	  
+	  return XEASY;	  
 	}
 	break;
 
@@ -334,7 +334,7 @@
       {
       case 'q':
 	vmsg(MSG_QUITGAME);
-	return;
+	return XEASY;
 
       case 'r':
 	goto game_start;
diff -ru src.old/innbbsd/bbslib.c src/innbbsd/bbslib.c
--- src.old/innbbsd/bbslib.c	2010-04-01 00:36:47.000000000 +0800
+++ src/innbbsd/bbslib.c	2012-10-26 17:01:47.000000000 +0800
@@ -268,7 +268,7 @@
   time_t now;
   FILE *fp;
 
-  if (fp = fopen(LOGFILE, "a"))
+  if ((fp = fopen(LOGFILE, "a")) != NULL)
   {
     time(&now);
     strftime(datebuf, sizeof(datebuf), "%b %d %X ", localtime(&now));
diff -ru src.old/innbbsd/bbslib.h src/innbbsd/bbslib.h
--- src.old/innbbsd/bbslib.h	2010-04-01 00:36:47.000000000 +0800
+++ src/innbbsd/bbslib.h	2012-10-26 17:09:22.000000000 +0800
@@ -22,6 +22,9 @@
 extern int initial_bbs();
 extern void bbslog(char *fmt, ...);
 
+/* bbslib.c */
+int read_ncmperm();
+
 /* rec_article.c */
 extern void init_bshm();
 extern int cancel_article();
diff -ru src.old/innbbsd/bbslink.c src/innbbsd/bbslink.c
--- src.old/innbbsd/bbslink.c	2010-04-01 00:36:47.000000000 +0800
+++ src/innbbsd/bbslink.c	2012-10-26 17:13:19.000000000 +0800
@@ -15,6 +15,9 @@
 #include "nntp.h"
 #include <stdarg.h>
 
+/* lantw44: §Û¦Û convcode.c ªº«Å§i */
+void b52gb(char*);
+
 
 #if 0	/* itoc.030122.µù¸Ñ: µ{¦¡¬yµ{ */
 
@@ -314,9 +317,9 @@
   if (!fgets(SERVERbuffer, sizeof(SERVERbuffer), SERVERrfp))
     return 0;
 
-  if (ptr = strchr(SERVERbuffer, '\r'))
+  if ((ptr = strchr(SERVERbuffer, '\r')))
     *ptr = '\0';
-  if (ptr = strchr(SERVERbuffer, '\n'))
+  if ((ptr = strchr(SERVERbuffer, '\n')))
     *ptr = '\0';
 
   return atoi(SERVERbuffer);
@@ -533,7 +536,7 @@
   fputs("\r\n", SERVERwfp);	/* ÀÉÀY©M¤º¤åªÅ¤@¦æ */
 
   /* ¼g¤J¤å³¹ªº¤º®e */
-  for (str = BODY; cc = *str; str++)
+  for (str = BODY; (cc = *str); str++)
   {
     if (cc == '\n')
     {
@@ -612,9 +615,9 @@
 
   while (fgets(SERVERbuffer, sizeof(SERVERbuffer), SERVERrfp))
   {
-    if (ptr = strchr(SERVERbuffer, '\r'))
+    if ((ptr = strchr(SERVERbuffer, '\r')))
       *ptr = '\0';
-    if (ptr = strchr(SERVERbuffer, '\n'))
+    if ((ptr = strchr(SERVERbuffer, '\n')))
       *ptr = '\0';
 
     if (!strcmp(SERVERbuffer, "."))	/* ¤å³¹µ²§ô */
@@ -662,7 +665,7 @@
 
     if (rel > 0)
     {
-      if (ptr = CONTROL)
+      if ((ptr = CONTROL))
       {
 	if (!str_ncmp(ptr, "cancel ", 7))
 	  rel = cancel_article(ptr + 7);
diff -ru src.old/innbbsd/channel.c src/innbbsd/channel.c
--- src.old/innbbsd/channel.c	2010-04-01 00:36:47.000000000 +0800
+++ src/innbbsd/channel.c	2012-10-26 17:01:01.000000000 +0800
@@ -94,7 +94,7 @@
   if (rel > 0)
   {
     rel = 0;
-    if (ptr = CONTROL)
+    if ((ptr = CONTROL))
     {
       if (!str_ncmp(ptr, "cancel ", 7))
       {
@@ -146,7 +146,7 @@
   daemoncmd_t *p;
   char *name;
 
-  for (p = cmds; name = p->name; p++)
+  for (p = cmds; (name = p->name); p++)
   {
     if (!str_cmp(name, cmd))
       return p;
@@ -267,7 +267,7 @@
 
   do
   {
-    ns = accept(s, &sockaddr, &fromlen);
+    ns = accept(s, &sockaddr, (unsigned int*)&fromlen);
     errno = 0;
   } while (ns < 0 && errno == EINTR);
   return ns;
@@ -451,14 +451,14 @@
       }
       else if ((dp->mode == 0 || dp->mode == 1) && (client->mode != dp->mode))	/* ÀË¬d data/command mode ¬O§_º¡¨¬­n¨D */
       {
-	fprintf(out, "%d %s error\r\n", dp->name, dp->errorcode);
+	fprintf(out, "%s %d error\r\n", dp->name, dp->errorcode);
 	fflush(out);
       }
       else		/* ³q¹L¥H¤W¤T¹DÀË¬d */
       {
 	void (*Main) ();
 
-	if (Main = dp->main)
+	if ((Main = dp->main))
 	  (*Main) (client);
       }
     }
@@ -477,12 +477,12 @@
 
     left = in->left + in->used;
 
-    if (used = *head)
+    if ((used = *head))
     {
       char *str;
 
       str = data;
-      while (*str++ = *head++)
+      while ((*str++ = *head++))
 	;
 
       used = str - data;
@@ -619,7 +619,7 @@
   for (i = 0; i < NLCOUNT; i++)
   {
     find = NODELIST + i;
-    if (he = gethostbyname(find->host))
+    if ((he = gethostbyname(find->host)))
     {
       str_ncpy(client, inet_ntoa(*(struct in_addr *) he->h_addr_list[0]), sizeof(client));
       if (!strcmp(hostname, client))
@@ -742,7 +742,7 @@
 
       /* ÀË¬d¦³¨S¦³¦b nodelist.bbs ¸Ì­± */
       i = sizeof(sin);		/* ­É¥Î i */
-      if (getpeername(fd, (struct sockaddr *) &sin, &i) < 0)
+      if (getpeername(fd, (struct sockaddr *) &sin, (unsigned int *)&i) < 0)
       {
 	close(fd);
 	continue;
@@ -826,7 +826,7 @@
   for (s = 3; s < ndescriptors; s++)
     close(s);
 
-  if (fp = fopen(INNBBSD_PIDFILE, "w"))
+  if ((fp = fopen(INNBBSD_PIDFILE, "w")) != NULL)
   {
     fprintf(fp, "%d\n", getpid());
     fclose(fp);
@@ -862,7 +862,7 @@
     {
     case 'i':
       c = sizeof(sin);
-      if (getsockname(0, (struct sockaddr *) &sin, &c) < 0)
+      if (getsockname(0, (struct sockaddr *) &sin, (unsigned int *)&c) < 0)
       {
 	printf("±z¤£¬O±q inetd ±Ò°Ê¡AµL»Ý¨Ï¥Î -i\n");
 	exit(0);
diff -ru src.old/innbbsd/convcode.c src/innbbsd/convcode.c
--- src.old/innbbsd/convcode.c	2010-04-01 00:36:47.000000000 +0800
+++ src/innbbsd/convcode.c	2012-10-26 17:02:14.000000000 +0800
@@ -9,7 +9,10 @@
 
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
diff -ru src.old/innbbsd/nocem.c src/innbbsd/nocem.c
--- src.old/innbbsd/nocem.c	2010-04-01 00:36:47.000000000 +0800
+++ src/innbbsd/nocem.c	2012-10-26 17:10:23.000000000 +0800
@@ -355,6 +355,9 @@
 
   if (search_newsfeeds_bygroup(group))
     strcpy(SPAMMID[num_spammid++], SPAMMID_NOW);
+
+  /* lantw44: ³o­n return ¤°»ò¡H¶Ã¼g¦n¤F */
+  return 0;
 }
 
 
diff -ru src.old/innbbsd/rec_article.c src/innbbsd/rec_article.c
--- src.old/innbbsd/rec_article.c	2010-04-01 00:36:47.000000000 +0800
+++ src/innbbsd/rec_article.c	2012-10-26 17:07:16.000000000 +0800
@@ -19,6 +19,10 @@
 #include "innbbsconf.h"
 #include "bbslib.h"
 #include "inntobbs.h"
+#include "nocem.h"
+
+/* lantw44: §Û¦Û convcode.c ªº«Å§i */
+void gb2b5(char*);
 
 
 /* ----------------------------------------------------- */
@@ -75,7 +79,7 @@
   str = buf + 2;
   for (i = 0; i < 12; i++)
   {
-    if (ptr = strstr(str, months[i]))
+    if ((ptr = strstr(str, months[i])))
       break;
   }
 
@@ -97,12 +101,12 @@
 
     datevalue = mktime(&ptime);
     str = ptr + 18;
-    if (ptr = strchr(str, '+'))
+    if ((ptr = strchr(str, '+')))
     {
       /* ¦pªG¦³ +0100 (MET) µ¥µù©ú®É°Ï¡A¥ý½Õ¦^ GMT ®É°Ï */
       datevalue -= ((ptr[1] - '0') * 10 + (ptr[2] - '0')) * 3600 + ((ptr[3] - '0') * 10 + (ptr[4] - '0')) * 60;
     }
-    else if (ptr = strchr(str, '-'))
+    else if ((ptr = strchr(str, '-')))
     {
       /* ¦pªG¦³ -1000 (HST) µ¥µù©ú®É°Ï¡A¥ý½Õ¦^ GMT ®É°Ï */
       datevalue += ((ptr[1] - '0') * 10 + (ptr[2] - '0')) * 3600 + ((ptr[3] - '0') * 10 + (ptr[4] - '0')) * 60;
@@ -156,7 +160,7 @@
 
   brd_fpath(folder, board, FN_DIR);
 
-  if (fp = fdopen(hdr_stamp(folder, 'A', &hdr, fpath), "w"))
+  if ((fp = fdopen(hdr_stamp(folder, 'A', &hdr, fpath), "w")) != NULL)
   {
     fprintf(fp, "µo«H¤H: %.50s ¬ÝªO: %s\n", FROM, board);
     fprintf(fp, "¼Ð  ÃD: %.70s\n", SUBJECT);
@@ -169,7 +173,7 @@
 
     /* fprintf(fp, "%s", BODY); */
 
-    for (str = BODY; cc = *str; str++)
+    for (str = BODY; (cc = *str) != '\0'; str++)
     {
       if (cc == '.')
       {
@@ -357,7 +361,7 @@
       char *xfrom, *str;
 
       xfrom = buffer + 8;
-      if (str = strchr(xfrom, ' '))
+      if ((str = strchr(xfrom, ' ')))
       {
 	*str = '\0';
 
@@ -478,12 +482,12 @@
       /* Thor.980825: gc patch: lib/str_decode ¥u¯à±µ¨ü decode §¹ strlen < 256 */ 
 
       str_ncpy(poolx, SUBJECT, 255);
-      str_decode(poolx);
+      str_decode((unsigned char*)poolx);
       str_ansi(mysubject, poolx, 70);	/* 70 ¬O bbspost_add() ¼ÐÃD©Ò»Ýªºªø«× */
       SUBJECT = mysubject;
 
       str_ncpy(poolx, FROM, 255);
-      str_decode(poolx);
+      str_decode((unsigned char*)poolx);
       str_ansi(myfrom, poolx, 128);	/* ÁöµM bbspost_add() µo«H¤H©Ò»Ýªºªø«×¥u»Ý­n 50¡A¦ý¬O str_from() »Ý­nªø¤@¨Ç */
       FROM = myfrom;
 
diff -ru src.old/lib/acl_has.c src/lib/acl_has.c
--- src.old/lib/acl_has.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/acl_has.c	2012-10-06 07:15:12.000000000 +0800
@@ -8,6 +8,8 @@
 
 
 #include <stdio.h>
+#include <string.h>
+#include "dao.h"
 
 
 /* ----------------------------------------------------- */
diff -ru src.old/lib/chrono32.c src/lib/chrono32.c
--- src.old/lib/chrono32.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/chrono32.c	2012-10-06 06:48:44.000000000 +0800
@@ -9,7 +9,7 @@
   int ch;
 
   chrono = 0;
-  while (ch = *++str)
+  while ((ch = *++str))
   {
     ch -= (ch > '9') ? 'A' - 10 : '0';
     chrono = (chrono << 5) + ch;
diff -ru src.old/lib/dao.p src/lib/dao.p
--- src.old/lib/dao.p	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/dao.p	2012-10-26 17:51:14.000000000 +0800
@@ -149,3 +149,4 @@
 
 /* dl_lib.c */
 void *DL_get(char *name);
+int DL_func(char *name, ...);
diff -ru src.old/lib/dl_lib.c src/lib/dl_lib.c
--- src.old/lib/dl_lib.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/dl_lib.c	2012-10-03 01:13:39.000000000 +0800
@@ -8,6 +8,7 @@
 
 #include <dlfcn.h>
 #include <strings.h>
+#include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
diff -ru src.old/lib/dns.c src/lib/dns.c
--- src.old/lib/dns.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/dns.c	2012-10-03 01:34:19.000000000 +0800
@@ -28,12 +28,12 @@
 {
   querybuf buf;
 
-  qtype = res_mkquery(QUERY, name, C_IN, qtype, (char *) NULL, 0, NULL,
-    (char *) &buf, sizeof(buf));
+  qtype = res_mkquery(QUERY, name, C_IN, qtype, (unsigned char *) NULL, 0, NULL,
+    (unsigned char *) &buf, sizeof(buf));
 
   if (qtype >= 0)
   {
-    qtype = res_send((char *) &buf, qtype, (char *) ans, sizeof(querybuf));
+    qtype = res_send((unsigned char *) &buf, qtype, (unsigned char *) ans, sizeof(querybuf));
 
     /* avoid problems after truncation in tcp packets */
 
diff -ru src.old/lib/dns.p src/lib/dns.p
--- src.old/lib/dns.p	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/dns.p	2012-10-06 08:08:38.000000000 +0800
@@ -9,6 +9,7 @@
 int dns_name(unsigned char *addr, char *name);
 /* dns_open.c */
 int dns_open(char *host, int port);
+unsigned long dns_a(char *host);
 /* dns_smtp.c */
-int dns_mx(char *domain, char *mxlist);
+void dns_mx(char *domain, char *mxlist);
 int dns_smtp(char *host);
diff -ru src.old/lib/dns_aton.c src/lib/dns_aton.c
--- src.old/lib/dns_aton.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/dns_aton.c	2012-10-03 05:56:07.000000000 +0800
@@ -8,7 +8,7 @@
 
 
 #include "dns.h"
-
+#include "dns.p"
 
 /* ----------------------------------------------------- */
 /* get IP address by address string 			 */
@@ -31,7 +31,7 @@
   { 
     addr.addr = 0; cd = 0; 
 
-    for (cp = name;; ++cp) 
+    for (cp = (u_char*)name;; ++cp) 
     { 
       cc = *cp; 
       if (!cc) 
diff -ru src.old/lib/dns_name.c src/lib/dns_name.c
--- src.old/lib/dns_name.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/dns_name.c	2012-10-03 05:56:33.000000000 +0800
@@ -8,6 +8,8 @@
 
 
 #include "dns.h"
+#include "dns.p"
+#include <string.h>
 
 
 /* ----------------------------------------------------- */
diff -ru src.old/lib/dns_open.c src/lib/dns_open.c
--- src.old/lib/dns_open.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/dns_open.c	2012-10-03 05:56:49.000000000 +0800
@@ -8,6 +8,10 @@
 
 
 #include "dns.h"
+#include "dns.p"
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
 
 /* Thor.990811: find out A record */
 
diff -ru src.old/lib/dns_smtp.c src/lib/dns_smtp.c
--- src.old/lib/dns_smtp.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/dns_smtp.c	2012-10-03 06:00:33.000000000 +0800
@@ -8,6 +8,7 @@
 
 
 #include "dns.h"
+#include "dns.p"
 
 
 /* static inline */ void /* Thor. 990811: for bmtad use to check from */
@@ -107,7 +108,7 @@
   for (;;)
   { /* Thor.980820: µù¸Ñ: ¸U¤@host®æ¦¡¬° xxx:yyy:zzz, «h¥ý¸Õ xxx,¤£¦æ¦A¸Õ yyy */
     ptr = str;
-    while (sock = *ptr)
+    while ((sock = *ptr) != '\0')
     {
       if (sock == ':')
       {
diff -ru src.old/lib/f_cat.c src/lib/f_cat.c
--- src.old/lib/f_cat.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_cat.c	2012-10-06 06:49:27.000000000 +0800
@@ -1,4 +1,6 @@
 #include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
 
 
 void
diff -ru src.old/lib/f_cp.c src/lib/f_cp.c
--- src.old/lib/f_cp.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_cp.c	2012-10-06 06:56:33.000000000 +0800
@@ -1,6 +1,7 @@
 #include "dao.h"
 #include <sys/types.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 
 int
diff -ru src.old/lib/f_img.c src/lib/f_img.c
--- src.old/lib/f_img.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_img.c	2012-10-06 06:58:11.000000000 +0800
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 
 char *
diff -ru src.old/lib/f_ln.c src/lib/f_ln.c
--- src.old/lib/f_ln.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_ln.c	2012-10-06 07:02:31.000000000 +0800
@@ -2,9 +2,10 @@
 /* f_ln() : link() cross partition / disk		 */
 /* ----------------------------------------------------- */
 
-
+#include "dao.h"
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 
 
 int
@@ -13,7 +14,7 @@
 {
   int ret;
 
-  if (ret = link(src, dst))
+  if ((ret = link(src, dst)) < 0)
   {
     if (errno != EEXIST)
       ret = f_cp(src, dst, O_EXCL);
diff -ru src.old/lib/f_lock.c src/lib/f_lock.c
--- src.old/lib/f_lock.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_lock.c	2012-10-06 07:08:31.000000000 +0800
@@ -3,9 +3,9 @@
 
 static struct flock fl = 
 {
-  l_whence: SEEK_SET,
-  l_start: 0,
-  l_len: 0,
+  .l_whence = SEEK_SET,
+  .l_start = 0,
+  .l_len = 0
 };
 
 
diff -ru src.old/lib/f_map.c src/lib/f_map.c
--- src.old/lib/f_map.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_map.c	2012-10-06 07:09:25.000000000 +0800
@@ -2,7 +2,7 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
-
+#include <unistd.h>
 
 #ifdef MAP_FILE         /* 44BSD defines this & requires it to mmap files */
 #  define DAO_MAP       (MAP_SHARED | MAP_FILE)
diff -ru src.old/lib/f_mv.c src/lib/f_mv.c
--- src.old/lib/f_mv.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_mv.c	2012-10-06 07:10:27.000000000 +0800
@@ -1,5 +1,6 @@
 #include <fcntl.h>
-
+#include <unistd.h>
+#include "dao.h"
 
 int
 f_mv(src, dst)
@@ -7,7 +8,7 @@
 {
   int ret;
 
-  if (ret = rename(src, dst))
+  if ((ret = rename(src, dst)) < 0)
   {
     ret = f_cp(src, dst, O_TRUNC);
     if (!ret)
diff -ru src.old/lib/f_new.c src/lib/f_new.c
--- src.old/lib/f_new.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_new.c	2012-10-06 07:14:25.000000000 +0800
@@ -7,6 +7,8 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <errno.h>
+#include <unistd.h>
+#include "dao.h"
 
 
 FILE *
diff -ru src.old/lib/f_path.c src/lib/f_path.c
--- src.old/lib/f_path.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_path.c	2012-10-06 07:14:41.000000000 +0800
@@ -2,6 +2,8 @@
 /* file structure : set file path for boards/user home	 */
 /* ----------------------------------------------------- */
 
+#include <string.h>
+#include "dao.h"
 
 static void
 mak_fpath(str, key, name)
diff -ru src.old/lib/f_rm.c src/lib/f_rm.c
--- src.old/lib/f_rm.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_rm.c	2012-10-06 07:04:21.000000000 +0800
@@ -1,6 +1,7 @@
+#include <string.h>
 #include <sys/stat.h>
 #include <dirent.h>
-
+#include <unistd.h>
 
 static int
 rm_dir(fpath)
@@ -14,12 +15,12 @@
   if (!(dirp = opendir(fpath)))
     return -1;
 
-  for (fname = buf; *fname = *fpath; fname++, fpath++)
+  for (fname = buf; (*fname = *fpath) != '\0'; fname++, fpath++)
     ;
 
   *fname++ = '/';
 
-  while (de = readdir(dirp))
+  while ((de = readdir(dirp)) != NULL)
   {
     fpath = de->d_name;
 
diff -ru src.old/lib/f_suck.c src/lib/f_suck.c
--- src.old/lib/f_suck.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/f_suck.c	2012-10-06 07:14:04.000000000 +0800
@@ -2,6 +2,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 
 void
diff -ru src.old/lib/hash32.c src/lib/hash32.c
--- src.old/lib/hash32.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/hash32.c	2012-10-06 06:49:06.000000000 +0800
@@ -5,7 +5,7 @@
   int xo, cc;
 
   xo = 1048583;			/* a big prime number */
-  while (cc = *str++)
+  while ((cc = *str++))
   {
     xo = (xo << 5) - xo + cc;	/* 31 * xo + cc */
   }
diff -ru src.old/lib/hdr_fpath.c src/lib/hdr_fpath.c
--- src.old/lib/hdr_fpath.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/hdr_fpath.c	2012-10-06 07:16:29.000000000 +0800
@@ -1,4 +1,5 @@
 #include "dao.h"
+#include <string.h>
 
 
 void
@@ -10,7 +11,7 @@
   char *str;
   int cc, chrono;
 
-  while (cc = *folder++)
+  while ((cc = *folder++))
   {
     *fpath++ = cc;
     if (cc == '/')
diff -ru src.old/lib/hdr_stamp.c src/lib/hdr_stamp.c
--- src.old/lib/hdr_stamp.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/hdr_stamp.c	2012-10-06 07:17:32.000000000 +0800
@@ -9,8 +9,10 @@
 
 
 #include "dao.h"
+#include <string.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <time.h>
 
 #if 0	/* itoc.030303.µù¸Ñ: Â²©ö»¡©ú */
 
@@ -66,7 +68,7 @@
   }
 
   fname = fpath;
-  while (rc = *folder++)
+  while ((rc = *folder++))
   {
     *fname++ = rc;
     if (rc == '/')
@@ -83,7 +85,7 @@
     *fname++ = '/';
   }
 
-  if (rc = token & 0xdf)	/* ÅÜ¤j¼g */
+  if ((rc = token & 0xdf))	/* ÅÜ¤j¼g */
   {
     *fname++ = rc;
   }
diff -ru src.old/lib/mak_dirs.c src/lib/mak_dirs.c
--- src.old/lib/mak_dirs.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/mak_dirs.c	2012-10-06 06:59:04.000000000 +0800
@@ -4,7 +4,7 @@
 
 
 #include <sys/stat.h>
-
+#include <unistd.h>
 
 void
 mak_dirs(fpath)
diff -ru src.old/lib/not_addr.c src/lib/not_addr.c
--- src.old/lib/not_addr.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/not_addr.c	2012-10-03 05:48:01.000000000 +0800
@@ -1,5 +1,7 @@
 #define	STRICT_FQDN_EMAIL
 
+/* §Û¦Û dao.p ªº«Å§i */
+int is_alnum(int ch);
 
 int
 not_addr(addr)
@@ -9,7 +11,7 @@
 
   mode = -1;
 
-  while (ch = *addr)
+  while ((ch = *addr) != '\0')
   {
     if (ch == '@')
     {
diff -ru src.old/lib/rec_add.c src/lib/rec_add.c
--- src.old/lib/rec_add.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/rec_add.c	2012-10-06 06:59:16.000000000 +0800
@@ -1,4 +1,5 @@
 #include <fcntl.h>
+#include <unistd.h>
 
 
 int
diff -ru src.old/lib/rec_bot.c src/lib/rec_bot.c
--- src.old/lib/rec_bot.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/rec_bot.c	2012-10-06 06:59:52.000000000 +0800
@@ -1,4 +1,5 @@
 #include "dao.h"
+#include <stdlib.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/file.h>
@@ -36,7 +37,7 @@
   count = 0;
   set = (void *) set_pool;
 
-  if (fsize = st.st_size)
+  if ((fsize = st.st_size) != 0)
   {
     while ((fsize -= size) >= 0)
     {
diff -ru src.old/lib/rec_del.c src/lib/rec_del.c
--- src.old/lib/rec_del.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/rec_del.c	2012-10-06 07:04:52.000000000 +0800
@@ -1,4 +1,6 @@
 #include "dao.h"
+#include <stdlib.h>
+#include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/file.h>
@@ -52,7 +54,7 @@
     lseek(fd, off, SEEK_SET);
     while (read(fd, fpath, size) == size)
     {
-      if (pos = (*fchk) (fpath))
+      if ((pos = (*fchk) (fpath)))
 	break;
 
       off += size;
diff -ru src.old/lib/rec_ins.c src/lib/rec_ins.c
--- src.old/lib/rec_ins.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/rec_ins.c	2012-10-06 07:05:29.000000000 +0800
@@ -1,8 +1,10 @@
+#include <stdlib.h>
+#include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/file.h>
 #include <sys/stat.h>
-
+#include "dao.h"
 
 int
 rec_ins(fpath, data, size, pos, num)
diff -ru src.old/lib/rec_put.c src/lib/rec_put.c
--- src.old/lib/rec_put.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/rec_put.c	2012-10-06 07:17:58.000000000 +0800
@@ -67,7 +67,7 @@
     lseek(fd, off, SEEK_SET);
     while (read(fd, fpath, size) == size)
     {
-      if (pos = (*fchk) (fpath))
+      if ((pos = (*fchk) (fpath)))
 	break;
 
       off += size;
diff -ru src.old/lib/rec_ref.c src/lib/rec_ref.c
--- src.old/lib/rec_ref.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/rec_ref.c	2012-10-06 07:00:44.000000000 +0800
@@ -62,7 +62,7 @@
     lseek(fd, off, SEEK_SET);
     while (read(fd, fpath, size) == size)
     {
-      if (pos = (*fchk) (fpath))
+      if ((pos = (*fchk) (fpath)))
 	break;
 
       off += size;
diff -ru src.old/lib/rec_sync.c src/lib/rec_sync.c
--- src.old/lib/rec_sync.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/rec_sync.c	2012-10-03 01:10:07.000000000 +0800
@@ -1,4 +1,6 @@
 #include "dao.h"
+#include <stdlib.h>
+#include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/stat.h>
diff -ru src.old/lib/rfc2047.c src/lib/rfc2047.c
--- src.old/lib/rfc2047.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/rfc2047.c	2012-10-06 07:15:52.000000000 +0800
@@ -45,7 +45,7 @@
   fputs(prefix, fp);
 
   /* ¦pªG¦r¦ê¶}ÀY¦³ US_ASCII printable characters¡A¥i¥ý¦æ¿é¥X¡A³o¼Ë¤ñ¸û¦n¬Ý¡A¤]¤ñ¸û¬Û®e */
-  for (i = 0; ch = str[i]; i++)
+  for (i = 0; (ch = str[i]) != '\0'; i++)
   {
     if (ch != '=' && ch != '?' && ch != '_' && ch > '\x1f' && ch < '\x7f')
     {
@@ -66,7 +66,7 @@
   {
     /* ¶}©l encode */
     fprintf(fp, "=?%s?Q?", charset);	/* «ü©w¦r¶° */
-    for (; ch = str[i]; i++)
+    for (; (ch = str[i]) != '\0'; i++)
     {
       /* ¦pªG¬O non-printable ¦r¤¸´N­nÂà½X */
       /* ½d³ò: '\x20' ~ '\x7e' ¬° printable, ¨ä¤¤ =, ?, _, ªÅ¥Õ, ¬°¯S®í²Å¸¹¤]­nÂà½X */
diff -ru src.old/lib/shm.c src/lib/shm.c
--- src.old/lib/shm.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/shm.c	2012-10-03 01:11:33.000000000 +0800
@@ -1,4 +1,6 @@
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
diff -ru src.old/lib/splay.c src/lib/splay.c
--- src.old/lib/splay.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/splay.c	2012-10-03 01:13:48.000000000 +0800
@@ -9,6 +9,8 @@
 
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include "splay.h"
 
 
diff -ru src.old/lib/str_ansi.c src/lib/str_ansi.c
--- src.old/lib/str_ansi.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_ansi.c	2012-10-03 06:01:31.000000000 +0800
@@ -11,7 +11,7 @@
   int ch, ansi;
   char *tail;
 
-  for (ansi = 0, tail = dst + max - 1; ch = *str; str++)
+  for (ansi = 0, tail = dst + max - 1; (ch = *str) != '\0'; str++)
   {
     if (ch == '\n')
     {
diff -ru src.old/lib/str_cat.c src/lib/str_cat.c
--- src.old/lib/str_cat.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_cat.c	2012-10-03 06:02:38.000000000 +0800
@@ -4,12 +4,12 @@
   char *s1;
   char *s2;
 {
-  while (*dst = *s1)
+  while ((*dst = *s1))
   {
     s1++;
     dst++;
   }
 
-  while (*dst++ = *s2++)
+  while ((*dst++ = *s2++))
     ;
 }
diff -ru src.old/lib/str_cmp.c src/lib/str_cmp.c
--- src.old/lib/str_cmp.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_cmp.c	2012-10-03 06:03:55.000000000 +0800
@@ -12,7 +12,7 @@
       c1 |= 0x20;
     if (c2 >= 'A' && c2 <= 'Z')
       c2 |= 0x20;
-    if (diff = c1 - c2)
+    if ((diff = c1 - c2))
       return (diff);
   } while (c1);
   return 0;
diff -ru src.old/lib/str_decode.c src/lib/str_decode.c
--- src.old/lib/str_decode.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_decode.c	2012-10-06 06:40:08.000000000 +0800
@@ -11,6 +11,12 @@
 /* QP code : "0123456789ABCDEF"				 */
 /* ----------------------------------------------------- */
 
+#include <string.h>
+
+/* lantw44: Á×§K©M ctype.h ¼²¨ì¡A©Ò¥Hª½±µ±q dao.p §â«Å§i¶W§Û¹L¨Ó */
+int str_cmp(char *s1, char *s2);
+int str_ncmp(char *s1, char *s2, int n);
+/* lantw44: END */
 
 static int
 qp_code(x)
@@ -83,20 +89,20 @@
     while (isspace(*str))
       str++;
 
-    if (!str_ncmp(str, "quoted-printable", 16))
+    if (!str_ncmp((char*)str, "quoted-printable", 16))
     {
       *code = 'q';
-      return str + 16;
+      return (char*)str + 16;
     }
-    if (!str_ncmp(str, "base64", 6))
+    if (!str_ncmp((char*)str, "base64", 6))
     {
       *code = 'b';
-      return str + 6;
+      return (char*)str + 6;
     }
   }
 
   *code = 0;
-  return str;
+  return (char*)str;
 }
 
 
@@ -244,7 +250,7 @@
   {
   case 'q':			/* Thor: quoted-printable */
 
-    while (ch = *src)		/* Thor: 0 ¬O delimiter */
+    while ((ch = *src) != '\0')		/* Thor: 0 ¬O delimiter */
     {
       if (ch == '=')
       {
@@ -274,7 +280,7 @@
     pattern = 0;
     bits = 0;
 
-    while (ch = *src)		/* Thor: 0 ¬O delimiter */
+    while ((ch = *src) != '\0')		/* Thor: 0 ¬O delimiter */
     {
       int x;
 
@@ -355,7 +361,7 @@
     }
   }
   *dst = 0;
-  strcpy(str, buf);
+  strcpy((char*)str, (char*)buf);
 }
 
 
diff -ru src.old/lib/str_folder.c src/lib/str_folder.c
--- src.old/lib/str_folder.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_folder.c	2012-10-06 06:40:42.000000000 +0800
@@ -1,3 +1,5 @@
+#include <string.h>
+
 void
 str_folder(fpath, folder, fname)
   char *fpath;
@@ -7,7 +9,7 @@
   int ch;
   char *token;
 
-  while (ch = *folder++)
+  while ((ch = *folder++))
   {
     *fpath++ = ch;
     if (ch == '/')
diff -ru src.old/lib/str_fpath.c src/lib/str_fpath.c
--- src.old/lib/str_fpath.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_fpath.c	2012-10-06 06:41:07.000000000 +0800
@@ -1,3 +1,5 @@
+#include <string.h>
+
 void
 setdirpath(fpath, direct, fname)
   char *fpath, *direct, *fname;
@@ -5,7 +7,7 @@
   int ch;
   char *target;
 
-  while (ch = *direct)
+  while ((ch = *direct) != '\0')
   {
     *fpath++ = ch;
     if (ch == '/')
diff -ru src.old/lib/str_from.c src/lib/str_from.c
--- src.old/lib/str_from.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_from.c	2012-10-06 06:44:02.000000000 +0800
@@ -11,6 +11,7 @@
 
 
 #include "dao.h"
+#include <string.h>
 
 
 int
@@ -24,7 +25,7 @@
 
   langle = ptr = NULL;
 
-  for (str = from; cc = *str; str++)
+  for (str = from; (cc = *str) != '\0'; str++)
   {
     if (cc == '<')
       langle = str;
@@ -60,7 +61,7 @@
       }
       ptr[1] = '\0';
       strcpy(nick, from);
-      str_decode(nick);
+      str_decode((unsigned char*)nick);
     }
 
     from = langle + 1;
@@ -75,14 +76,14 @@
 	str--;
       *str = 0;
 
-      if (ptr = (char *) strchr(from, '('))
+      if ((ptr = (char *) strchr(from, '(')) != NULL)
       {
 	ptr[-1] = 0;
 	if (*++ptr == '"')
 	  ptr++;
 
 	strcpy(nick, ptr);
-	str_decode(nick);
+	str_decode((unsigned char*)nick);
       }
     }
   }
diff -ru src.old/lib/str_has.c src/lib/str_has.c
--- src.old/lib/str_has.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_has.c	2012-10-06 06:45:38.000000000 +0800
@@ -1,3 +1,5 @@
+#include "dao.h"
+
 int			/* >=1:¦b¦W³æªº­þ¤@­Ó 0:¤£¦b¦W³æ¤º */
 str_has(list, tag, len)
   char *list;
@@ -16,7 +18,7 @@
     {
       return priority;
     }
-    while (cc = *list++)
+    while ((cc = *list++))
     {
       if (cc == '/')
       {
diff -ru src.old/lib/str_hash.c src/lib/str_hash.c
--- src.old/lib/str_hash.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_hash.c	2012-10-06 06:46:04.000000000 +0800
@@ -5,7 +5,7 @@
 {
   int cc;
 
-  while (cc = *str++)
+  while ((cc = *str++))
   {
     seed = (seed << 5) - seed + cc;	/* 31 * seed + cc */
   }
diff -ru src.old/lib/str_passwd.c src/lib/str_passwd.c
--- src.old/lib/str_passwd.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_passwd.c	2012-10-06 06:46:51.000000000 +0800
@@ -1,3 +1,6 @@
+#include <string.h>
+#include <unistd.h>
+#include "dao.h"
 #define	PASSLEN	13
 
 
diff -ru src.old/lib/str_stamp.c src/lib/str_stamp.c
--- src.old/lib/str_stamp.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_stamp.c	2012-10-03 01:05:39.000000000 +0800
@@ -7,6 +7,7 @@
 
 
 #include <time.h>
+#include <stdio.h>
 
 
 void
diff -ru src.old/lib/str_str.c src/lib/str_str.c
--- src.old/lib/str_str.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_str.c	2012-10-06 06:47:44.000000000 +0800
@@ -11,7 +11,7 @@
 
   cc = *tag++;
  
-  while (c1 = *str)
+  while ((c1 = *str))
   {
     if (c1 >= 'A' && c1 <= 'Z')
       c1 |= 0x20;
diff -ru src.old/lib/str_sub.c src/lib/str_sub.c
--- src.old/lib/str_sub.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_sub.c	2012-10-06 06:48:22.000000000 +0800
@@ -13,7 +13,7 @@
 
   cc = *tag++;
  
-  while (c1 = *str)
+  while ((c1 = *str) != '\0')
   {
     if (in_chi)
     {
diff -ru src.old/lib/str_time.c src/lib/str_time.c
--- src.old/lib/str_time.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/str_time.c	2012-10-06 06:51:01.000000000 +0800
@@ -1,4 +1,5 @@
 #include <time.h>
+#include <stdio.h>
 
 
 static char datemsg[40];
diff -ru src.old/lib/xwrite.c src/lib/xwrite.c
--- src.old/lib/xwrite.c	2010-04-01 00:36:48.000000000 +0800
+++ src/lib/xwrite.c	2012-10-06 07:01:08.000000000 +0800
@@ -1,3 +1,4 @@
+#include <unistd.h>
 int
 xwrite(fd, data, size)
   int fd;
Only in src.old/maple: .menu.c.swp
Only in src.old/maple: .talk.c.swp
diff -ru src.old/maple/Makefile src/maple/Makefile
--- src.old/maple/Makefile	2010-04-01 00:36:45.000000000 +0800
+++ src/maple/Makefile	2012-10-26 17:57:09.000000000 +0800
@@ -46,7 +46,7 @@
 	@$(MAKE) CC=gcc CFLAGS="-DSOLARIS -DSYSV -O2 -fomit-frame-pointer -Wunused -I../include" LDFLAGS="-s -L../lib -ldao -ltermcap -lsocket -lnsl -lresolv -lelf -ldl" $(EXE)
 
 freebsd:
-	@$(MAKE) CC=gcc CFLAGS="-DBSD44 -O2 -pipe -fomit-frame-pointer -Wunused -I../include" LDFLAGS="-s -L../lib -ldao -lcrypt -export-dynamic" $(EXE)
+	@$(MAKE) CC=gcc CFLAGS="-DBSD44 -O2 -pipe -fomit-frame-pointer -Wunused -I../include" LDFLAGS="-s -L../lib -ldao -lcrypt -Wl,-export-dynamic" $(EXE)
 
 bsd:
 	@$(MAKE) CC=gcc CFLAGS="-DBSD44 -O2 -pipe -fomit-frame-pointer -Wunused -I../include" LDFLAGS="-s -L../lib -ldao" $(EXE)
diff -ru src.old/maple/acct.c src/maple/acct.c
--- src.old/maple/acct.c	2012-10-02 14:58:05.000000000 +0800
+++ src/maple/acct.c	2012-10-26 17:23:29.000000000 +0800
@@ -127,7 +127,7 @@
   int cc;
 
   outs(msg);
-  while (cc = *str)
+  while ((cc = *str))
   {
     outc((level & 1) ? cc : '-');
     level >>= 1;
@@ -166,7 +166,7 @@
     j <<= 1;
   }
 
-  while (i = vans("½Ð«öÁä¤Á´«³]©w¡A©Î«ö [Return] µ²§ô¡G"))
+  while ((i = vans("½Ð«öÁä¤Á´«³]©w¡A©Î«ö [Return] µ²§ô¡G")))
   {
     i -= '0';
     if (i >= 10)
@@ -350,7 +350,7 @@
   {
     mgets(-1);
 
-    while (rform = mread(fd, sizeof(RFORM)))
+    while ((rform = mread(fd, sizeof(RFORM))))
     {
 //      if (userno == rform->userno && !strcmp(userid, rform->userid))
 			if (!strcmp(userid, rform->userid))
@@ -809,7 +809,7 @@
   if (!is_alnum(*brd))
     return 0;
 
-  while (ch = *++brd)
+  while ((ch = *++brd))
   {
     if (!is_alnum(ch) && ch != '.' && ch != '-' && ch != '_')
       return 0;
diff -ru src.old/maple/bbsd.c src/maple/bbsd.c
--- src.old/maple/bbsd.c	2011-06-01 13:01:03.000000000 +0800
+++ src/maple/bbsd.c	2012-10-26 17:32:58.000000000 +0800
@@ -13,6 +13,7 @@
 
 #include "bbs.h"
 #include "dns.h"
+#include "../lib/dns.p"
 
 
 #include <sys/wait.h>
@@ -23,6 +24,9 @@
 #include <arpa/telnet.h>
 #include <sys/resource.h>
 
+/* lantw44: §Û¦Û cache.c ªº«Å§i¡Aª`·N³o©M semaphore.h ªº¤£¬Û®e */
+void sem_init();
+
 
 #define	QLEN		3
 #define	PID_FILE	"run/bbs.pid"
@@ -211,7 +215,7 @@
 	{
 		mgets(-1);
 
-		while (flist = mgets(fd))
+		while ((flist = mgets(fd)))
 		{
 			str_lower(flist, flist);
 			if (str_str(key, flist))
@@ -244,7 +248,7 @@
 		return 1;
 
 	str = userid;
-	while (ch = *(++str))
+	while ((ch = *(++str)))
 	{
 		if (!is_alnum(ch))
 			return 1;
@@ -491,14 +495,14 @@
 	int rc;
 
 	rc = 0;
-	if (fp = fopen(filelist, "r"))
+	if ((fp = fopen(filelist, "r")) != NULL)
 	{
 		while (fgets(buf, sizeof(buf), fp))
 		{
 			if (buf[0] == '#')
 				continue;
 
-			if (str = (char *) strchr(buf, ' '))
+			if ((str = (char *) strchr(buf, ' ')))
 			{
 				*str = '\0';
 				if (strstr(key, buf))
@@ -1005,7 +1009,7 @@
 	/* --------------------------------------------------- */
 
 	/* Thor.990415: °O¿ýip, ©È¥¿¬d¤£¨ì */
-	sprintf(buf, "%s ip:%08x (%d)", fromhost, tn_addr, currpid);
+	sprintf(buf, "%s ip:%08lx (%d)", fromhost, tn_addr, currpid);
 
 	multi = login_user(buf);
 
diff -ru src.old/maple/board.c src/maple/board.c
--- src.old/maple/board.c	2012-10-02 14:58:19.000000000 +0800
+++ src/maple/board.c	2012-10-26 17:34:31.000000000 +0800
@@ -269,8 +269,7 @@
   *++list = 0;	/* itoc.010207: ±j©w¬° 0, for ³¡¤À visit */
 }
 
-
-int
+void
 brh_add(prev, chrono, next)
   time_t prev, chrono, next;
 {
diff -ru src.old/maple/edit.c src/maple/edit.c
--- src.old/maple/edit.c	2011-05-29 00:45:17.000000000 +0800
+++ src/maple/edit.c	2012-10-26 17:46:34.000000000 +0800
@@ -8,6 +8,8 @@
 
 
 #include "bbs.h"
+#include "dns.h"
+#include "../lib/dns.p"
 
 
 /* #define	VE_WIDTH	(ANSILINELEN - 1) */
@@ -195,6 +197,7 @@
 
   ve_abort(13);			/* °O¾ÐÅé¥Î¥ú¤F */
   abort_bbs();
+  return NULL;
 }
 
 
diff -ru src.old/maple/mail.c src/maple/mail.c
--- src.old/maple/mail.c	2011-01-26 21:14:09.000000000 +0800
+++ src/maple/mail.c	2012-10-26 17:52:47.000000000 +0800
@@ -8,6 +8,8 @@
 
 
 #include "bbs.h"
+#include "dns.h"
+#include "../lib/dns.p"
 
 
 extern XZ xz[];
@@ -239,7 +241,9 @@
 	goto smtp_error;
     } while (buf[3] == '-');
 
-    fprintf(fw, "DATA\r\n", rcpt);
+    /* lantw44: ¦h¥X¨Óªº°Ñ¼Æ¬O¡H */
+/*    fprintf(fw, "DATA\r\n", rcpt); */
+    fprintf(fw, "DATA\r\n");
     fflush(fw);
     do
     {
diff -ru src.old/maple/maple.p src/maple/maple.p
--- src.old/maple/maple.p	2012-10-02 14:58:05.000000000 +0800
+++ src/maple/maple.p	2012-10-26 18:07:12.000000000 +0800
@@ -15,10 +15,14 @@
 void brd_title(int bno);
 void x_file(int mode, char *xlist[], char *flist[]);
 int m_trace(void);
+#ifdef HAVE_COSIGN
+int valid_brdname(char *brd);
+#endif
 
 /* bbsd.c */
 void alog(char *mode, char *msg);
 void blog(char *mode, char *msg);
+void cclog(char *mode, char *msg);
 void u_exit(char *mode);
 void abort_bbs(void);
 int belong_list(char *filelist, char *key, char *desc);
@@ -40,7 +44,7 @@
 void brh_get(time_t bstamp, int bhno);
 int brh_unread(time_t chrono);
 void brh_visit(int mode);
-int brh_add(time_t prev, time_t chrono, time_t next);
+void brh_add(time_t prev, time_t chrono, time_t next);
 int bstamp2bno(time_t stamp);
 void brh_save(void);
 void brd_force(void);
diff -ru src.old/maple/menu.c src/maple/menu.c
--- src.old/maple/menu.c	2010-04-01 01:11:58.000000000 +0800
+++ src/maple/menu.c	2012-10-26 17:48:05.000000000 +0800
@@ -1123,7 +1123,7 @@
 	menu = (MENU *) mptr->func;
 
 	mode = MENU_LOAD | MENU_DRAW;
-	/* mode = MENU_LOAD | MENU_DRAW | MENU_FILM;	/* itoc.010304: ¶i¤J¤l¿ï³æ­«¼· movie */
+	/* mode = MENU_LOAD | MENU_DRAW | MENU_FILM;*/	/* itoc.010304: ¶i¤J¤l¿ï³æ­«¼· movie */
 
 	depth++;
 	continue;
@@ -1210,7 +1210,7 @@
 	menu->level = PERM_MENU + table[cc]->desc[0];
 	menu = (MENU *) menu->func;
 	mode = MENU_LOAD | MENU_DRAW;
-	/* mode = MENU_LOAD | MENU_DRAW | MENU_FILM;	/* itoc.010304: °h¥X¤l¿ï³æ­«¼· movie */
+	/* mode = MENU_LOAD | MENU_DRAW | MENU_FILM;*/	/* itoc.010304: °h¥X¤l¿ï³æ­«¼· movie */
 	depth--;
 	continue;
       }
diff -ru src.old/maple/post.c src/maple/post.c
--- src.old/maple/post.c	2012-10-02 14:58:05.000000000 +0800
+++ src/maple/post.c	2012-10-26 17:35:51.000000000 +0800
@@ -2412,7 +2412,7 @@
 			    if (is_bm(blist, cuser.userid) != 1)  /* ¥u¦³¥¿ªO¥D¥i¥H */
 						    {
 									      vmsg("¥u¦³¥¿ª©¥D¥i¥H²¾°Ê¤å³¹");
-												      return;
+												      return XO_NONE;
 								}
 			}
 	HDR *hdr;				
diff -ru src.old/maple/window.c src/maple/window.c
--- src.old/maple/window.c	2010-04-01 00:36:45.000000000 +0800
+++ src/maple/window.c	2012-10-26 17:53:43.000000000 +0800
@@ -217,7 +217,7 @@
 /* ----------------------------------------------------- */
 
 
-static int
+static void
 draw_item(x, y, desc, hotkey, mode)
   int x, y;
   char *desc;
diff -ru src.old/maple/xover.c src/maple/xover.c
--- src.old/maple/xover.c	2010-04-01 00:36:46.000000000 +0800
+++ src/maple/xover.c	2012-10-03 01:22:28.000000000 +0800
@@ -843,7 +843,8 @@
 
   /* end of keymap */
 
-  (char) NULL, -1
+/*  (char) NULL, -1 */
+  '\0', -1 
 };
 
 
diff -ru src.old/pip/pip_menu.c src/pip/pip_menu.c
--- src.old/pip/pip_menu.c	2010-04-01 00:36:53.000000000 +0800
+++ src/pip/pip_menu.c	2012-10-26 18:13:30.000000000 +0800
@@ -804,6 +804,6 @@
 pip_system_menu()
 {
   pip_do_menu(7, 0, pipsystemlist);
-  return;
+  return 0;
 }
 #endif		/* HAVE_GAME */
diff -ru src.old/so/admutil.c src/so/admutil.c
--- src.old/so/admutil.c	2012-10-02 14:57:59.000000000 +0800
+++ src/so/admutil.c	2012-10-26 18:03:33.000000000 +0800
@@ -429,7 +429,7 @@
 /* ----------------------------------------------------- */
 
 
-static int
+static void
 scan_register_form(fd)
   int fd;
 {
diff -ru src.old/util/acl-sort.c src/util/acl-sort.c
--- src.old/util/acl-sort.c	2010-04-01 00:36:49.000000000 +0800
+++ src/util/acl-sort.c	2012-10-03 01:17:05.000000000 +0800
@@ -10,6 +10,8 @@
 
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include "splay.h"
 
 
diff -ru src.old/util/uno/fix_uno.c src/util/uno/fix_uno.c
--- src.old/util/uno/fix_uno.c	2010-04-01 00:36:49.000000000 +0800
+++ src/util/uno/fix_uno.c	2012-10-26 18:15:56.000000000 +0800
@@ -35,7 +35,7 @@
 /*-------------------------------------------------------*/
 
 
-static int
+static void
 new_acct(userid)
   char *userid;
 {
