From ab7c10f28e92c4cfdc32fd50e4941915aa180d02 Mon Sep 17 00:00:00 2001 From: Tapan Shah Date: Tue, 3 Feb 2015 21:27:55 +0000 Subject: ShellPkg: Update Network1 profile commands response output Updates to Network1 profile commands response output. Updating Network1 profile commands source code to include command name as a prefix in error message. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tapan Shah Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16731 6f19259b-4bc3-4df7-8a09-765794883524 --- .../UefiShellNetwork1CommandsLib/Ifconfig.c | 26 ++++++++++---------- .../Library/UefiShellNetwork1CommandsLib/Ping.c | 27 ++++++++++++--------- .../UefiShellNetwork1CommandsLib.uni | Bin 19988 -> 19864 bytes 3 files changed, 28 insertions(+), 25 deletions(-) (limited to 'ShellPkg') diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c index 8e5434cfd2..7f07a22870 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c @@ -1,7 +1,7 @@ /** @file The implementation for ifcommand shell command. - Copyright (c) 2013 Hewlett-Packard Development Company, L.P. + Copyright (c) 2013 - 2015, Hewlett-Packard Development Company, L.P.
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials @@ -1253,7 +1253,7 @@ IfconfigSetNicAddr ( // Validate the parameter for DHCP, two valid forms: eth0 DHCP and eth0 DHCP permanent // if ((Argc != 2) && (Argc!= 3)) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, Temp); + ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ifconfig", Temp); ASSERT(ShellStatus == SHELL_INVALID_PARAMETER); goto ON_EXIT; } @@ -1266,7 +1266,7 @@ IfconfigSetNicAddr ( PermTemp = PermanentString; if (StringNoCaseCompare(&Temp, &PermTemp) != 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_OP2), gShellNetwork1HiiHandle, Temp, PermanentString, L"Nothing"); + ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_OP2), gShellNetwork1HiiHandle, L"ifconfig", Temp, PermanentString, L"Nothing"); ASSERT(ShellStatus == SHELL_INVALID_PARAMETER); goto ON_EXIT; } @@ -1289,7 +1289,7 @@ IfconfigSetNicAddr ( // eth0 static IP NETMASK GATEWAY permanent // if ((Argc != 5) && (Argc != 6)) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, Temp); + ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ifconfig", Temp); ASSERT(ShellStatus == SHELL_INVALID_PARAMETER); goto ON_EXIT; } @@ -1337,7 +1337,7 @@ IfconfigSetNicAddr ( PermTemp = PermanentString; if (StringNoCaseCompare(&Temp, &PermTemp) != 0) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_OP2), gShellNetwork1HiiHandle, Temp, PermanentString, L"Nothing"); + ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_OP2), gShellNetwork1HiiHandle, L"ifconfig", Temp, PermanentString, L"Nothing"); ASSERT(ShellStatus == SHELL_INVALID_PARAMETER); goto ON_EXIT; } @@ -1383,7 +1383,7 @@ IfconfigSetNicAddr ( CopyMem (&Config->Ip4Info.RouteTable[1].GatewayAddress, &Gateway.v4, sizeof (EFI_IPv4_ADDRESS)); } else { // neither static or DHCP. error. - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle); + ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle, L"ifconfig"); ASSERT(ShellStatus == SHELL_INVALID_PARAMETER); goto ON_EXIT; } @@ -1660,7 +1660,7 @@ ShellCommandRunIfconfig ( Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); if (EFI_ERROR(Status)) { if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellNetwork1HiiHandle, ProblemParam); + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellNetwork1HiiHandle, L"ifconfig", ProblemParam); FreePool(ProblemParam); ShellStatus = SHELL_INVALID_PARAMETER; } else { @@ -1678,11 +1678,11 @@ ShellCommandRunIfconfig ( ||(SetOperation && ListOperation) ||(ClearOperation && SetOperation) ) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellNetwork1HiiHandle); + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellNetwork1HiiHandle, L"ifconfig"); ShellStatus = SHELL_INVALID_PARAMETER; goto Done; } else if (!ClearOperation && !ListOperation && !SetOperation) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle); + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle, L"ifconfig"); ShellStatus = SHELL_INVALID_PARAMETER; goto Done; } @@ -1693,7 +1693,7 @@ ShellCommandRunIfconfig ( if (mIp4ConfigExist) { ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_GET_NIC_FAIL), gShellNetwork1HiiHandle, Status); } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellNetwork1HiiHandle, L"gEfiIp4ConfigProtocolGuid", &gEfiIp4ConfigProtocolGuid); + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROTOCOL_NF), gShellNetwork1HiiHandle, L"ifconfig", L"gEfiIp4ConfigProtocolGuid", &gEfiIp4ConfigProtocolGuid); } return SHELL_NOT_FOUND; @@ -1703,7 +1703,7 @@ ShellCommandRunIfconfig ( Item = ShellCommandLineGetValue (Package, L"-l"); if (Item != NULL && CountSubItems(Item) > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, L"-l"); + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, L"ifconfig", Item, L"-l"); ShellStatus = SHELL_INVALID_PARAMETER; goto Done; } @@ -1721,7 +1721,7 @@ ShellCommandRunIfconfig ( // IfConfig -s eth0 static ip netmask gateway [permanent] // if (Item == NULL || (CountSubItems(Item) < 2) || (CountSubItems(Item) > 6) || (CountSubItems(Item) == 4)) { - ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, L"-s"); + ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_GEN_NO_VALUE), gShellNetwork1HiiHandle, L"ifconfig", L"-s"); ShellStatus = SHELL_INVALID_PARAMETER; goto Done; } @@ -1731,7 +1731,7 @@ ShellCommandRunIfconfig ( Item = ShellCommandLineGetValue (Package, L"-c"); if (Item != NULL && CountSubItems(Item) > 1) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, L"-c"); + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellNetwork1HiiHandle, L"ifconfig", Item, L"-c"); ShellStatus = SHELL_INVALID_PARAMETER; goto Done; } diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c index fd4aa8d81e..ccd92b53db 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c @@ -1,6 +1,7 @@ /** @file The implementation for Ping shell command. + Copyright (c) 2015, Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials @@ -910,7 +911,7 @@ PingCreateIpInstance ( if (NetIp6IsLinkLocalAddr ((EFI_IPv6_ADDRESS*)&Private->DstAddress) && NetIp6IsUnspecifiedAddr ((EFI_IPv6_ADDRESS*)&Private->SrcAddress) && (HandleNum > 1)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellNetwork1HiiHandle, mSrcString); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", mSrcString); Status = EFI_INVALID_PARAMETER; goto ON_ERROR; } @@ -919,7 +920,7 @@ PingCreateIpInstance ( if (PingNetIp4IsLinkLocalAddr ((EFI_IPv4_ADDRESS*)&Private->DstAddress) && PingNetIp4IsUnspecifiedAddr ((EFI_IPv4_ADDRESS*)&Private->SrcAddress) && (HandleNum > 1)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellNetwork1HiiHandle, mSrcString); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", mSrcString); Status = EFI_INVALID_PARAMETER; goto ON_ERROR; } @@ -1061,7 +1062,7 @@ PingCreateIpInstance ( // if (HandleIndex == HandleNum) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellNetwork1HiiHandle, mSrcString); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_CONFIGD_NIC_NF), gShellNetwork1HiiHandle, L"ping"); Status = EFI_NOT_FOUND; goto ON_ERROR; } @@ -1321,7 +1322,7 @@ ShellPing ( } else if (Status == RETURN_NO_MAPPING) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NOROUTE_FOUND), gShellNetwork1HiiHandle, mDstString, mSrcString); } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NETWORK_ERROR), gShellNetwork1HiiHandle, Status); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_NETWORK_ERROR), gShellNetwork1HiiHandle, L"ping", Status); } goto ON_EXIT; @@ -1446,6 +1447,7 @@ ShellCommandRunPing ( CONST CHAR16 *ValueStr; UINTN NonOptionCount; UINT32 IpChoice; + CHAR16 *ProblemParam; // // we use IPv6 buffers to hold items... @@ -1457,10 +1459,11 @@ ShellCommandRunPing ( IpChoice = PING_IP_CHOICE_IP4; ShellStatus = SHELL_SUCCESS; + ProblemParam = NULL; - Status = ShellCommandLineParseEx (PingParamList, &ParamPackage, NULL, TRUE, FALSE); + Status = ShellCommandLineParseEx (PingParamList, &ParamPackage, &ProblemParam, TRUE, FALSE); if (EFI_ERROR(Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ProblemParam); ShellStatus = SHELL_INVALID_PARAMETER; goto ON_EXIT; } @@ -1480,7 +1483,7 @@ ShellCommandRunPing ( // ShellStrToUintn will return 0 when input is 0 or an invalid input string. // if ((SendNumber == 0) || (SendNumber > MAX_SEND_NUMBER)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellNetwork1HiiHandle, ValueStr); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr); ShellStatus = SHELL_INVALID_PARAMETER; goto ON_EXIT; } @@ -1498,7 +1501,7 @@ ShellCommandRunPing ( // ShellStrToUintn will return 0 when input is 0 or an invalid input string. // if ((BufferSize < 16) || (BufferSize > MAX_BUFFER_SIZE)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellNetwork1HiiHandle, ValueStr); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr); ShellStatus = SHELL_INVALID_PARAMETER; goto ON_EXIT; } @@ -1521,7 +1524,7 @@ ShellCommandRunPing ( Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS*)&SrcAddress); } if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellNetwork1HiiHandle, ValueStr); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr); ShellStatus = SHELL_INVALID_PARAMETER; goto ON_EXIT; } @@ -1531,12 +1534,12 @@ ShellCommandRunPing ( // NonOptionCount = ShellCommandLineGetCount(ParamPackage); if (NonOptionCount < 2) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellNetwork1HiiHandle, L"ping"); ShellStatus = SHELL_INVALID_PARAMETER; goto ON_EXIT; } if (NonOptionCount > 2) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellNetwork1HiiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellNetwork1HiiHandle, L"ping"); ShellStatus = SHELL_INVALID_PARAMETER; goto ON_EXIT; } @@ -1549,7 +1552,7 @@ ShellCommandRunPing ( Status = NetLibStrToIp4 (ValueStr, (EFI_IPv4_ADDRESS*)&DstAddress); } if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellNetwork1HiiHandle, ValueStr); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellNetwork1HiiHandle, L"ping", ValueStr); ShellStatus = SHELL_INVALID_PARAMETER; goto ON_EXIT; } diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni index 0e834a2421..d8405f7f31 100644 Binary files a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni and b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni differ -- cgit v1.2.3