only display host info once when more than one adapter is present.
[reactos.git] / reactos / apps / utils / net / ipconfig / ipconfig.c
index 715bb2c..1eaa5b9 100644 (file)
@@ -149,23 +149,25 @@ INT ShowInfo(BOOL bAll)
 
     _tprintf(_T("\nReactOS IP Configuration\n\n"));
 
+
+    if (bAll)
+    {
+        _tprintf(_T("\tHost Name . . . . . . . . . . . . : %s\n"), pFixedInfo->HostName);
+        _tprintf(_T("\tPrimary DNS Suffix. . . . . . . . : \n"));
+        _tprintf(_T("\tNode Type . . . . . . . . . . . . : %s\n"), GetNodeTypeName(pFixedInfo->NodeType));
+        if (pFixedInfo->EnableRouting)
+            _tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n"));
+        else
+            _tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n"));
+        if (pAdapter->HaveWins)
+            _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n"));
+        else
+            _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n"));
+        _tprintf(_T("\tDNS Suffix Search List. . . . . . : %s\n"), pFixedInfo->DomainName);
+    }
+
        while (pAdapter)
        {
-        if (bAll)
-        {
-            _tprintf(_T("\tHost Name . . . . . . . . . . . . : %s\n"), pFixedInfo->HostName);
-            _tprintf(_T("\tPrimary DNS Suffix. . . . . . . . : \n"));
-            _tprintf(_T("\tNode Type . . . . . . . . . . . . : %s\n"), GetNodeTypeName(pFixedInfo->NodeType));
-            if (pFixedInfo->EnableRouting)
-                _tprintf(_T("\tIP Routing Enabled. . . . . . . . : Yes\n"));
-            else
-                _tprintf(_T("\tIP Routing Enabled. . . . . . . . : No\n"));
-            if (pAdapter->HaveWins)
-                _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : Yes\n"));
-            else
-                _tprintf(_T("\tWINS Proxy enabled. . . . . . . . : No\n"));
-            _tprintf(_T("\tDNS Suffix Search List. . . . . . : %s\n"), pFixedInfo->DomainName);
-        }
 
         _tprintf(_T("\n%s ...... : \n\n"), GetInterfaceTypeName(pAdapter->Type));
         
@@ -236,8 +238,9 @@ INT Release(TCHAR Index)
     if (Index == (TCHAR)NULL)
     {
         PIP_INTERFACE_INFO pInfo;
+        ULONG ulOutBufLen;
         pInfo = (IP_INTERFACE_INFO *) malloc(sizeof(IP_INTERFACE_INFO));
-        ULONG ulOutBufLen = 0;
+        ulOutBufLen = 0;
 
         /* Make an initial call to GetInterfaceInfo to get
          * the necessary size into the ulOutBufLen variable */
@@ -290,8 +293,9 @@ INT Renew(TCHAR Index)
     if (Index == (TCHAR)NULL)
     {
         PIP_INTERFACE_INFO pInfo;
+        ULONG ulOutBufLen;
         pInfo = (IP_INTERFACE_INFO *) malloc(sizeof(IP_INTERFACE_INFO));
-        ULONG ulOutBufLen = 0;
+        ulOutBufLen = 0;
 
         /* Make an initial call to GetInterfaceInfo to get
          * the necessary size into the ulOutBufLen variable */
@@ -335,9 +339,12 @@ VOID Info()
 {
      // Declare and initialize variables
     PIP_INTERFACE_INFO pInfo;
+    ULONG ulOutBufLen;
+    DWORD dwRetVal;
+
     pInfo = (IP_INTERFACE_INFO *) malloc( sizeof(IP_INTERFACE_INFO) );
-    ULONG ulOutBufLen = sizeof(IP_INTERFACE_INFO);
-    DWORD dwRetVal = 0;
+    ulOutBufLen = sizeof(IP_INTERFACE_INFO);
+    dwRetVal = 0;
 
 
     // Make an initial call to GetInterfaceInfo to get