Index: EcnlProtoTool/trunk/asp3_dcre/sample/sample1n.c
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/sample/sample1n.c	(revision 321)
+++ EcnlProtoTool/trunk/asp3_dcre/sample/sample1n.c	(revision 331)
@@ -2,5 +2,5 @@
  *  TINET (TCP/IP Protocol Stack)
  * 
- *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
+ *  Copyright (C) 2001-2012 by Dep. of Computer Science and Engineering
  *                   Tomakomai National College of Technology, JAPAN
  *
@@ -39,5 +39,5 @@
 
 #include <kernel.h>
-#include <t_syslog.h>
+#include "syssvc/syslog.h"
 #include "syssvc/serial.h"
 #include "kernel_cfg.h"
@@ -92,4 +92,10 @@
 bool_t		wait_accept	= false;	/* 接続要求待ち中	*/
 
+#ifdef SUPPORT_INET6
+
+T_IPV6EP	dst;
+
+#else	/* of #ifdef SUPPORT_INET6 */
+
 #ifdef SUPPORT_INET4
 
@@ -97,8 +103,4 @@
 
 #endif	/* of #ifdef SUPPORT_INET4 */
-
-#ifdef SUPPORT_INET6
-
-T_IPV6EP	dst;
 
 #endif	/* of #ifdef SUPPORT_INET6 */
@@ -117,4 +119,11 @@
  */
 
+#ifdef SUPPORT_INET6
+
+#define TCP_ACP_CEP(c,r,d,t)	tcp6_acp_cep(c,r,d,t)
+#define IP2STR(s,a)		ipv62str(s,a)
+
+#else	/* of #ifdef SUPPORT_INET6 */
+
 #ifdef SUPPORT_INET4
 
@@ -124,9 +133,4 @@
 #endif	/* of #ifdef SUPPORT_INET4 */
 
-#ifdef SUPPORT_INET6
-
-#define TCP_ACP_CEP(c,r,d,t)	tcp6_acp_cep(c,r,d,t)
-#define IP2STR(s,a)		ipv62str(s,a)
-
 #endif	/* of #ifdef SUPPORT_INET6 */
 
@@ -143,5 +147,5 @@
 
 	case TFN_TCP_ACP_CEP:
-		IP2STR(addr, &dst.ipaddr);
+		IP2STR((char *)addr, &dst.ipaddr);
 		syslog(LOG_NOTICE, "connected:    %s.%d", addr, dst.portno);
 		if (*(ER*)p_parblk == E_OK)
@@ -182,5 +186,5 @@
 		connected = false;
 		syscall(sig_sem(SEM_NET_SEND));
-		IP2STR(addr, &dst.ipaddr);
+		IP2STR((char *)addr, &dst.ipaddr);
 		syslog(LOG_NOTICE, "disconnected: %s.%d", addr, dst.portno);
 		}
@@ -326,5 +330,5 @@
 			return serial_rea_dat(portid, buf, len);
 			}
-		dly_tsk(500);
+		dly_tsk(500000);
 		}
 	return off;
@@ -423,5 +427,51 @@
 	}
 
-#ifdef SUPPORT_INET4
+/*
+ *  ipv6addr -- IPv6 アドレス出力
+ */
+
+int_t
+put_ipv6addr (ID cepid, const T_IN6_ADDR *addr, int_t width)
+{
+	int_t	len = 0, ix;
+	bool_t	omit = false, zero = false;
+
+	if (addr == NULL) {
+		put_char(cepid, '0');
+		put_char(cepid, ':');
+		put_char(cepid, ':');
+		put_char(cepid, '0');
+		len = 4;
+		}
+	else {
+		for (ix = 0; ix < sizeof(T_IN6_ADDR) / 2; ix ++) {
+			if (omit) {
+				len += put_num(cepid, addr->s6_addr16[ix], 16, radhex, 0, false, ' '); 
+				if (ix < 7) {
+					put_char(cepid, ':');
+					len ++;
+					}
+				}
+			else if (ix > 0 && ix < 7 && addr->s6_addr16[ix] == 0)
+				zero = true;
+			else {
+				if (zero) {
+					omit = true;
+					put_char(cepid, ':');
+					len ++;
+					}
+				len += put_num(cepid, addr->s6_addr16[ix], 16, radhex, 0, false, ' '); 
+				if (ix < 7) {
+					put_char(cepid, ':');
+					len ++;
+					}
+				}
+			}
+
+		for ( ; len < width; len ++)
+			put_char(cepid, ' ');
+		}
+	return len;
+	}
 
 /*
@@ -429,5 +479,5 @@
  */
 
-static int_t
+int_t
 put_ipv4addr (ID cepid, ULONGEST *addr, int_t width)
 {
@@ -462,62 +512,4 @@
 	}
 
-#define PUT_IPADDR(p,a,w)	put_ipv4addr(p,a,w)
-
-#endif	/* of #ifdef SUPPORT_INET4 */
-
-#ifdef SUPPORT_INET6
-
-/*
- *  ipv6addr -- IPv6 アドレス出力
- */
-
-static int_t
-put_ipv6addr (ID cepid, const T_IN6_ADDR *addr, int_t width)
-{
-	int_t	len = 0, ix;
-	bool_t	omit = false, zero = false;
-
-	if (addr == NULL) {
-		put_char(cepid, '0');
-		put_char(cepid, ':');
-		put_char(cepid, ':');
-		put_char(cepid, '0');
-		len = 4;
-		}
-	else {
-		for (ix = 0; ix < sizeof(T_IN6_ADDR) / 2; ix ++) {
-			if (omit) {
-				len += put_num(cepid, addr->s6_addr16[ix], 16, radhex, 0, false, ' '); 
-				if (ix < 7) {
-					put_char(cepid, ':');
-					len ++;
-					}
-				}
-			else if (ix > 0 && ix < 7 && addr->s6_addr16[ix] == 0)
-				zero = true;
-			else {
-				if (zero) {
-					omit = true;
-					put_char(cepid, ':');
-					len ++;
-					}
-				len += put_num(cepid, addr->s6_addr16[ix], 16, radhex, 0, false, ' '); 
-				if (ix < 7) {
-					put_char(cepid, ':');
-					len ++;
-					}
-				}
-			}
-
-		for ( ; len < width; len ++)
-			put_char(cepid, ' ');
-		}
-	return len;
-	}
-
-#define PUT_IPADDR(p,a,w)	put_ipv6addr(p,a,w)
-
-#endif	/* of #ifdef SUPPORT_INET6 */
-
 /*
  *  put_macaddr -- MAC アドレス出力
@@ -586,5 +578,5 @@
 	va_list	ap;
 	char	padchar, *str;
-	int_t	ch, width, longflag, left, i, c;
+	int_t	ch, width, longflag, shortflag, left, i, c;
 
 	if (connected) {
@@ -597,5 +589,5 @@
 				}
 
-			width = longflag = 0;
+			width = longflag = shortflag = 0;
 			padchar = ' ';
 
@@ -619,4 +611,9 @@
 			while (ch == 'l') {		/* long (long) の指定 */
 				longflag ++;
+				ch = *format ++;
+				}
+
+			while (ch == 'h') {		/* short の指定 */
+				shortflag ++;
 				ch = *format ++;
 				}
@@ -663,17 +660,31 @@
 			case 'I':
 
+				if (longflag) {
+					str = va_arg(ap, char*);
+					put_ipv6addr(TCP_CEPID, (T_IN6_ADDR *)str, width);
+					}
+				else if (shortflag) {
+					val = GET_ARG(ap, longflag);
+					put_ipv4addr(TCP_CEPID, (ULONGEST *)val, width);
+					}
+				else {
+
+#ifdef SUPPORT_INET6
+
+					str = va_arg(ap, char*);
+					put_ipv6addr(TCP_CEPID, (T_IN6_ADDR *)str, width);
+
+#else	/* of #ifdef SUPPORT_INET6 */
+
 #ifdef SUPPORT_INET4
 
-				val = GET_ARG(ap, longflag);
-				put_ipv4addr(TCP_CEPID, (ULONGEST *)val, width);
+					val = GET_ARG(ap, longflag);
+					put_ipv4addr(TCP_CEPID, (ULONGEST *)val, width);
 
 #endif	/* of #ifdef SUPPORT_INET4 */
 
-#ifdef SUPPORT_INET6
-
-				str = va_arg(ap, char*);
-				put_ipv6addr(TCP_CEPID, (T_IN6_ADDR *)str, width);
-
 #endif	/* of #ifdef SUPPORT_INET6 */
+
+					}
 
 				break;
@@ -701,5 +712,5 @@
 		flush_snd_buff(TCP_CEPID);
 		syscall(sig_sem(SEM_TCP_SYSLOG));
-		return E_OK;
+		return;
 		}
 	else {
@@ -714,11 +725,23 @@
 				}
 
+			longflag = 0;
 			c = *format++;
 			while ('0' <= c && c <= '9') {
 				c = *format++;
 				}
+
+			while (c == 'l') {
+				longflag = 1;
+				c = *format++;
+			}
+
 			switch (c) {
 			case 'd':
-				log.logpar[i++] = (intptr_t)va_arg(ap, int_t);
+				if(longflag == 1) {
+					log.logpar[i++] = (intptr_t)va_arg(ap, long_t);
+				}
+				else {
+					log.logpar[i++] = (intptr_t)va_arg(ap, int_t);
+				}
 				break;
 			case 'u':
