summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2016-01-06 07:43:58 +0000
committershenshushi <shenshushi@Edk2>2016-01-06 07:43:58 +0000
commit7f9c4a515adc08f831990ea721bba3f3fa933717 (patch)
tree594e83ad6b457fe248de742bcca71fa0c472c320 /ShellPkg
parent10e547ac2d4cf41df2cef1a7ac5ae45184e57d17 (diff)
downloadedk2-7f9c4a515adc08f831990ea721bba3f3fa933717.tar.gz
edk2-7f9c4a515adc08f831990ea721bba3f3fa933717.tar.bz2
edk2-7f9c4a515adc08f831990ea721bba3f3fa933717.zip
ShellPkg: Make 'alias' can display a single alias name.
When we run command "alias cat" Shell print out "alias: Too few arguments". This patch makes value of single alias name can be displayed. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19608 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
index 1161746cc7..bcd14c8541 100644
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
+++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
@@ -2,7 +2,7 @@
Main file for Alias shell level 3 function.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. <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
@@ -92,6 +92,8 @@ ShellCommandRunAlias (
CONST CHAR16 *Param1;
CONST CHAR16 *Param2;
CHAR16 *CleanParam2;
+ CONST CHAR16 *ConstAliasVal;
+ BOOLEAN Volatile;
ProblemParam = NULL;
ShellStatus = SHELL_SUCCESS;
@@ -165,8 +167,19 @@ ShellCommandRunAlias (
}
}
} else if (ShellCommandLineGetCount(Package) == 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"alias");
- ShellStatus = SHELL_INVALID_PARAMETER;
+ //
+ // print out a single alias
+ //
+ ConstAliasVal = gEfiShellProtocol->GetAlias(Param1, &Volatile);
+ if (ConstAliasVal == NULL) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"alias", Param1);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ } else {
+ if (ShellCommandIsOnAliasList(Param1)) {
+ Volatile = FALSE;
+ }
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_ALIAS_OUTPUT), gShellLevel3HiiHandle, !Volatile?L' ':L'*', Param1, ConstAliasVal);
+ }
} else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"alias");
ShellStatus = SHELL_INVALID_PARAMETER;