[NET/USE]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 11 Dec 2016 10:23:02 +0000 (10:23 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 11 Dec 2016 10:23:02 +0000 (10:23 +0000)
On enumeration, don't print raw status

svn path=/trunk/; revision=73449

reactos/base/applications/network/net/cmdUse.c
reactos/base/applications/network/net/lang/en-US.rc
reactos/base/applications/network/net/lang/es-ES.rc
reactos/base/applications/network/net/lang/ro-RO.rc
reactos/base/applications/network/net/lang/ru-RU.rc
reactos/base/applications/network/net/lang/tr-TR.rc
reactos/base/applications/network/net/lang/zh-CN.rc
reactos/base/applications/network/net/lang/zh-TW.rc
reactos/base/applications/network/net/resource.h

index d6901a2..f0f405d 100644 (file)
@@ -63,6 +63,21 @@ EnumerateConnections(LPCWSTR Local)
     return 0;
 }
 
+static
+VOID
+PrintError(DWORD Status)
+{
+    LPWSTR Buffer;
+
+    ConResPrintf(StdErr, IDS_ERROR_SYSTEM_ERROR, Status);
+
+    if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, Status, 0, (LPWSTR)&Buffer, 0, NULL))
+    {
+        ConPrintf(StdErr, L"\n%s", Buffer);
+        LocalFree(Buffer);
+    }
+}
+
 INT
 cmdUse(
     INT argc,
@@ -73,7 +88,11 @@ cmdUse(
     if (argc == 2)
     {
         Status = EnumerateConnections(NULL);
-        ConPrintf(StdOut, L"Status: %lu\n", Status);
+        if (Status == NO_ERROR)
+            ConResPrintf(StdOut, IDS_ERROR_NO_ERROR);
+        else
+            PrintError(Status);
+
         return 0;
     }
     else if (argc == 3)
@@ -92,7 +111,11 @@ cmdUse(
         }
 
         Status = EnumerateConnections(argv[2]);
-        ConPrintf(StdOut, L"Status: %lu\n", Status);
+        if (Status == NO_ERROR)
+            ConResPrintf(StdOut, IDS_ERROR_NO_ERROR);
+        else
+            PrintError(Status);
+
         return 0;
     }
 
@@ -100,7 +123,6 @@ cmdUse(
     if (Len != 1 && Len != 2)
     {
         ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName");
-        ConPrintf(StdOut, L"Len: %lu\n", Len);
         return 1;
     }
 
@@ -192,17 +214,7 @@ cmdUse(
         if (argv[2][0] == L'*' && Status == NO_ERROR && OutFlags == CONNECT_LOCALDRIVE)
             ConResPrintf(StdOut, IDS_USE_NOW_CONNECTED, argv[3], Access);
         else if (Status != NO_ERROR)
-        {
-            LPWSTR Buffer;
-
-            ConResPrintf(StdErr, IDS_ERROR_SYSTEM_ERROR, Status);
-
-            if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, Status, 0, (LPWSTR)&Buffer, 0, NULL))
-            {
-                ConPrintf(StdErr, L"\n%s\n", Buffer);
-                LocalFree(Buffer);
-            }
-        }
+            PrintError(Status);
 
         return Status;
     }
index e8914c1..6ca97b5 100644 (file)
@@ -123,4 +123,5 @@ BEGIN
     IDS_ERROR_OPTION_NOT_SUPPORTED "The %s option is not supported yet.\n"
     IDS_ERROR_INVALID_OPTION_VALUE "You entered an invalid value for the %s option.\n"
     IDS_ERROR_SYSTEM_ERROR "The system error %d happened.\n"
+    IDS_ERROR_NO_ERROR "The command got executed successfully.\n"
 END
index 4367d02..fc87a44 100644 (file)
@@ -126,4 +126,5 @@ BEGIN
     IDS_ERROR_OPTION_NOT_SUPPORTED "La opción %s todavía no está disponible.\n"
     IDS_ERROR_INVALID_OPTION_VALUE "El valor para la opción %s no es válido.\n"
     IDS_ERROR_SYSTEM_ERROR "The system error %d happened.\n"
+    IDS_ERROR_NO_ERROR "The command got executed successfully.\n"
 END
index 561ea62..42bb632 100644 (file)
@@ -129,4 +129,5 @@ BEGIN
     IDS_ERROR_OPTION_NOT_SUPPORTED "Opţiunea %s încă nu este admisă.\n"
     IDS_ERROR_INVALID_OPTION_VALUE "Aţi introdus o valoare nevalidă pentru opţiunea %s.\n"
     IDS_ERROR_SYSTEM_ERROR "The system error %d happened.\n"
+    IDS_ERROR_NO_ERROR "The command got executed successfully.\n"
 END
index 60e66b1..492dd99 100644 (file)
@@ -125,4 +125,5 @@ BEGIN
     IDS_ERROR_OPTION_NOT_SUPPORTED "Опция %s в данный момент не поддерживается.\n"
     IDS_ERROR_INVALID_OPTION_VALUE "Вы ввели неверный данные для данной опции %s.\n"
     IDS_ERROR_SYSTEM_ERROR "The system error %d happened.\n"
+    IDS_ERROR_NO_ERROR "The command got executed successfully.\n"
 END
index 44de3db..8271023 100644 (file)
@@ -125,4 +125,5 @@ BEGIN
     IDS_ERROR_OPTION_NOT_SUPPORTED "%s seçeneği daha desteklenmiyor.\n"
     IDS_ERROR_INVALID_OPTION_VALUE "%s seçeneği için geçersiz bir değer girdiniz.\n"
     IDS_ERROR_SYSTEM_ERROR "The system error %d happened.\n"
+    IDS_ERROR_NO_ERROR "The command got executed successfully.\n"
 END
index 0f20d22..5b9ae52 100644 (file)
@@ -125,4 +125,5 @@ BEGIN
     IDS_ERROR_OPTION_NOT_SUPPORTED "尚不支持 %s 选项。\n"
     IDS_ERROR_INVALID_OPTION_VALUE "Y您输入了无效的值为 %s 选项。\n"
     IDS_ERROR_SYSTEM_ERROR "The system error %d happened.\n"
+    IDS_ERROR_NO_ERROR "The command got executed successfully.\n"
 END
index b22d9ce..f767c7d 100644 (file)
@@ -125,4 +125,5 @@ BEGIN
     IDS_ERROR_OPTION_NOT_SUPPORTED "尚不支援 %s 選項。\n"
     IDS_ERROR_INVALID_OPTION_VALUE "您輸入了無效的值為 %s 選項。\n"
     IDS_ERROR_SYSTEM_ERROR "The system error %d happened.\n"
+    IDS_ERROR_NO_ERROR "The command got executed successfully.\n"
 END
index a90a15d..ebe6588 100644 (file)
 #define IDS_ERROR_OPTION_NOT_SUPPORTED 700
 #define IDS_ERROR_INVALID_OPTION_VALUE 701
 #define IDS_ERROR_SYSTEM_ERROR         702
+#define IDS_ERROR_NO_ERROR             703