[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdebase/kcontrol/ebrowsing/plugins/localdomain
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2008-02-07 15:52:01
Message-ID: 1202399521.926353.26669.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 772036 by lunakl:

Extend the given local name to the same fully qualified name,
even if the name is an alias (bnc#359563).



 M  +19 -1     klocaldomainurifilterhelper.c  


--- branches/KDE/3.5/kdebase/kcontrol/ebrowsing/plugins/localdomain/klocaldomainurifilterhelper.c \
#772035:772036 @@ -26,6 +26,7 @@
 
 #include <netdb.h>
 #include <stdio.h>
+#include <string.h>
 
 int main( int argc, char* argv[] )
 {
@@ -36,7 +37,24 @@
 
     ent = gethostbyname( argv[ 1 ] );
     if (ent)
-      fputs( ent->h_name, stdout );
+    {
+        int i;
+        int found = 0;
+        /* try to find the same fully qualified name first */
+        for( i = 0;
+             ent->h_aliases[ i ] != NULL;
+             ++i )
+        {
+            if( strncmp( argv[ 1 ], ent->h_aliases[ i ], strlen( argv[ 1 ] )) == 0 )
+            {
+                found = 1;
+                fputs( ent->h_aliases[ i ], stdout );
+                break;
+            }
+        }
+        if( !found )
+            fputs( ent->h_name, stdout );
+    }
 
     return (ent != NULL || h_errno == NO_ADDRESS) ? 0 : 1;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic