[uim-commit] r2155 - in trunk: . uim

omote at freedesktop.org omote at freedesktop.org
Fri Nov 18 15:39:55 PST 2005


Author: omote
Date: 2005-11-18 15:39:50 -0800 (Fri, 18 Nov 2005)
New Revision: 2155

Modified:
   trunk/
   trunk/uim/skk.c
Log:
 r2175 at minamo:  omote | 2005-11-19 08:17:47 +0900
 * uim/skk.c: Use inet_aton. hostname can starts with 0-9 (not numeric IP
   address, for example 192.168.0.1.isp.example.jp). inet_aton functions appeared  in 4.3BSD. Thus portability problem does not exist.



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 2f05256a-0800-0410-85e3-84fe06922419:/local/uim/trunk:1514
   + 2f05256a-0800-0410-85e3-84fe06922419:/local/uim/trunk:2175

Modified: trunk/uim/skk.c
===================================================================
--- trunk/uim/skk.c	2005-11-18 23:14:32 UTC (rev 2154)
+++ trunk/uim/skk.c	2005-11-18 23:39:50 UTC (rev 2155)
@@ -3297,7 +3297,6 @@
   struct hostent *entry;
   /* struct servent *serv; */
   struct protoent *proto;
-  int a1, a2, a3, a4;
   char *hostname;
 
   signal(SIGPIPE, SIG_IGN);
@@ -3321,13 +3320,7 @@
     return 0;
 #endif
   }
-  if ('0' <= *hostname && *hostname <= '9') {
-    if (sscanf(hostname,"%d.%d.%d.%d", &a1, &a2, &a3, &a4) != 4) {
-      return 0;
-    }
-    a1 = (a1 << 24) | (a2 << 16) | (a3 << 8) | a4;
-    hostaddr.sin_addr.s_addr = htonl(a1);
-  } else {
+  if (!inet_aton(hostname, (struct in_addr *)&hostaddr.sin_addr.s_addr)) {
     if ((entry = gethostbyname(hostname)) == NULL) {
       return 0;
     }



More information about the uim-commit mailing list