ShellPkg: Clean-up 'map' command error message handling
Refactor 'map' command error handling code and add standard error message Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tapan Shah <tapandshah@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19616 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
/** @file
|
||||
Main file for map shell level 2 command.
|
||||
|
||||
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
|
||||
Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
|
||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@ -1196,23 +1198,19 @@ ShellCommandRunMap (
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", Mapping);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
if (MapAsHandle != NULL) {
|
||||
TempStringLength = StrLen(SName);
|
||||
if (!IsNumberLetterOnly(SName, TempStringLength-(SName[TempStringLength-1]==L':'?1:0))) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", SName);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ShellStatus = AddMappingFromHandle(MapAsHandle, SName);
|
||||
}
|
||||
} else {
|
||||
TempStringLength = StrLen(SName);
|
||||
if (!IsNumberLetterOnly(SName, TempStringLength-(SName[TempStringLength-1]==L':'?1:0))) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"map", SName);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
|
||||
if (ShellStatus == SHELL_SUCCESS) {
|
||||
if (MapAsHandle != NULL) {
|
||||
ShellStatus = AddMappingFromHandle(MapAsHandle, SName);
|
||||
} else {
|
||||
ShellStatus = AddMappingFromMapping(Mapping, SName);
|
||||
}
|
||||
}
|
||||
|
||||
if (ShellStatus != SHELL_SUCCESS) {
|
||||
switch (ShellStatus) {
|
||||
case SHELL_ACCESS_DENIED:
|
||||
@ -1241,6 +1239,7 @@ ShellCommandRunMap (
|
||||
TRUE
|
||||
);
|
||||
} // we were sucessful so do an output
|
||||
}
|
||||
} // got a valid map target
|
||||
} // got 2 variables
|
||||
} // we are adding a mapping
|
||||
|
Reference in New Issue
Block a user