summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel3CommandsLib
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2017-08-02 09:54:47 +0800
committerGuo Mang <mang.guo@intel.com>2017-09-05 19:45:08 +0800
commit6c128c65b5ec0e5b8b5a0ccb165f3afd29e485f8 (patch)
tree444372d92a0ae8991fe4d15eb3937df43690dfda /ShellPkg/Library/UefiShellLevel3CommandsLib
parentb207c6434d7a5a4502975d322312e07017e8a8cb (diff)
downloadedk2-platforms-6c128c65b5ec0e5b8b5a0ccb165f3afd29e485f8.tar.xz
Remove core packages since we can get them from edk2 repository
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel3CommandsLib')
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c182
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c133
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c121
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c97
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c476
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c107
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c294
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c328
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c101
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h162
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf74
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.unibin44956 -> 0 bytes
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c147
13 files changed, 0 insertions, 2222 deletions
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
deleted file mode 100644
index 1161746cc7..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/** @file
- 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>
- 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "UefiShellLevel3CommandsLib.h"
-
-#include <Library/ShellLib.h>
-
-/**
- Print out each alias registered with the Shell.
-
- @retval STATUS_SUCCESS the printout was sucessful
- @return any return code from GetNextVariableName except EFI_NOT_FOUND
-**/
-SHELL_STATUS
-EFIAPI
-PrintAllShellAlias(
- VOID
- )
-{
- CONST CHAR16 *ConstAllAliasList;
- CHAR16 *Alias;
- CONST CHAR16 *Command;
- CHAR16 *Walker;
- BOOLEAN Volatile;
-
- Volatile = FALSE;
-
- ConstAllAliasList = gEfiShellProtocol->GetAlias(NULL, NULL);
- if (ConstAllAliasList == NULL) {
- return (SHELL_SUCCESS);
- }
- Alias = AllocateZeroPool(StrSize(ConstAllAliasList));
- if (Alias == NULL) {
- return (SHELL_OUT_OF_RESOURCES);
- }
- Walker = (CHAR16*)ConstAllAliasList;
-
- do {
- CopyMem(Alias, Walker, StrSize(Walker));
- Walker = StrStr(Alias, L";");
- if (Walker != NULL) {
- Walker[0] = CHAR_NULL;
- Walker = Walker + 1;
- }
- Command = gEfiShellProtocol->GetAlias(Alias, &Volatile);
- if (ShellCommandIsOnAliasList(Alias)) {
- Volatile = FALSE;
- }
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_ALIAS_OUTPUT), gShellLevel3HiiHandle, !Volatile?L' ':L'*', Alias, Command);
- } while (Walker != NULL && Walker[0] != CHAR_NULL);
-
- FreePool(Alias);
-
- return (SHELL_SUCCESS);
-}
-
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-v", TypeFlag},
- {L"-d", TypeFlag},
- {NULL, TypeMax}
- };
-
-/**
- Function for 'alias' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunAlias (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Param1;
- CONST CHAR16 *Param2;
- CHAR16 *CleanParam2;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- CleanParam2 = NULL;
-
- //
- // initialize the shell lib (we must be in non-auto-init...)
- //
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
-
- //
- // parse the command line
- //
- 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), gShellLevel3HiiHandle, L"alias", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ASSERT(FALSE);
- }
- } else {
- Param1 = ShellCommandLineGetRawValue(Package, 1);
- Param2 = ShellCommandLineGetRawValue(Package, 2);
-
- if (Param2 != NULL) {
- CleanParam2 = AllocateCopyPool (StrSize(Param2), Param2);
- if (CleanParam2 == NULL) {
- return SHELL_OUT_OF_RESOURCES;
- }
-
- if (CleanParam2[0] == L'\"' && CleanParam2[StrLen(CleanParam2)-1] == L'\"') {
- CleanParam2[StrLen(CleanParam2)-1] = L'\0';
- CopyMem (CleanParam2, CleanParam2 + 1, StrSize(CleanParam2) - sizeof(CleanParam2[0]));
- }
- }
-
- //
- // check for "-?"
- //
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- }
- if (ShellCommandLineGetCount(Package) == 1) {
- //
- // print out alias'
- //
- Status = PrintAllShellAlias();
- } else if (ShellCommandLineGetFlag(Package, L"-d")) {
- //
- // delete an alias
- //
- Status = gEfiShellProtocol->SetAlias(Param1, NULL, TRUE, FALSE);
- } else if (ShellCommandLineGetCount(Package) == 3) {
- //
- // must be adding an alias
- //
- Status = gEfiShellProtocol->SetAlias(CleanParam2, Param1, FALSE, ShellCommandLineGetFlag(Package, L"-v"));
- if (EFI_ERROR(Status)) {
- if (Status == EFI_ACCESS_DENIED) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel3HiiHandle, L"alias");
- ShellStatus = SHELL_ACCESS_DENIED;
- } else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel3HiiHandle, L"alias", Status);
- ShellStatus = SHELL_DEVICE_ERROR;
- }
- }
- } else if (ShellCommandLineGetCount(Package) == 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"alias");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"alias");
- ShellStatus = SHELL_INVALID_PARAMETER;
- }
- //
- // free the command line package
- //
- ShellCommandLineFreeVarList (Package);
- }
-
- SHELL_FREE_NON_NULL (CleanParam2);
- return (ShellStatus);
-}
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c
deleted file mode 100644
index 61b9ef854e..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/** @file
- Main file for attrib shell level 2 function.
-
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2014, 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "UefiShellLevel3CommandsLib.h"
-
-/**
- Function for 'cls' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunCls (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- UINTN Background;
- UINTN ForeColor;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Param1;
-
- //
- // Initialize variables
- //
- ShellStatus = SHELL_SUCCESS;
- ProblemParam = NULL;
- Background = 0;
-
- //
- // initialize the shell lib (we must be in non-auto-init...)
- //
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- //
- // parse the command line
- //
- Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"cls", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ASSERT(FALSE);
- }
- } else {
- //
- // check for "-?"
- //
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else {
- //
- // If there are 0 value parameters, clear sceen
- //
- Param1 = ShellCommandLineGetRawValue(Package, 1);
- if (Param1 == NULL) {
- //
- // clear screen
- //
- gST->ConOut->ClearScreen (gST->ConOut);
- } else if (ShellCommandLineGetCount(Package) > 2) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"cls");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- if (ShellStrToUintn(Param1) > 7 || StrLen(Param1) > 1 || !ShellIsDecimalDigitCharacter(*Param1)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"cls", Param1);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- switch (ShellStrToUintn(Param1)) {
- case 0:
- Background = EFI_BACKGROUND_BLACK;
- break;
- case 1:
- Background = EFI_BACKGROUND_BLUE;
- break;
- case 2:
- Background = EFI_BACKGROUND_GREEN;
- break;
- case 3:
- Background = EFI_BACKGROUND_CYAN;
- break;
- case 4:
- Background = EFI_BACKGROUND_RED;
- break;
- case 5:
- Background = EFI_BACKGROUND_MAGENTA;
- break;
- case 6:
- Background = EFI_BACKGROUND_BROWN;
- break;
- case 7:
- Background = EFI_BACKGROUND_LIGHTGRAY;
- break;
- }
- ForeColor = (~ShellStrToUintn(Param1)) & 0xF;
- Status = gST->ConOut->SetAttribute (gST->ConOut, (ForeColor | Background) & 0x7F );
- ASSERT_EFI_ERROR(Status);
- Status = gST->ConOut->ClearScreen (gST->ConOut);
- ASSERT_EFI_ERROR(Status);
- }
- }
- }
- }
- //
- // free the command line package
- //
- ShellCommandLineFreeVarList (Package);
-
- //
- // return the status
- //
- return (ShellStatus);
-}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c
deleted file mode 100644
index a638de8ce2..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/** @file
- Main file for Echo shell level 3 function.
-
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2012, 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "UefiShellLevel3CommandsLib.h"
-
-#include <Library/ShellLib.h>
-
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-on", TypeFlag},
- {L"-off", TypeFlag},
- {NULL, TypeMax}
- };
-
-/**
- Function for 'echo' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunEcho (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- CHAR16 *ProblemParam;
- UINTN Size;
- CHAR16 *PrintString;
-
- Size = 0;
- ProblemParam = NULL;
- PrintString = NULL;
- ShellStatus = SHELL_SUCCESS;
-
- //
- // initialize the shell lib (we must be in non-auto-init...)
- //
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- //
- // parse the command line
- //
- Status = ShellCommandLineParseEx (ParamList, &Package, &ProblemParam, TRUE, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"echo", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ASSERT(FALSE);
- }
- } else {
- //
- // check for "-?"
- //
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- }
- if (ShellCommandLineGetFlag(Package, L"-on")) {
- //
- // Turn it on
- //
- ShellCommandSetEchoState(TRUE);
- } else if (ShellCommandLineGetFlag(Package, L"-off")) {
- //
- // turn it off
- //
- ShellCommandSetEchoState(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
- //
- // output its current state
- //
- if (ShellCommandGetEchoState()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_ECHO_ON), gShellLevel3HiiHandle);
- } else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_ECHO_OFF), gShellLevel3HiiHandle);
- }
- } else {
- //
- // print the line
- //
- for ( ParamCount = 1
- ; ShellCommandLineGetRawValue(Package, ParamCount) != NULL
- ; ParamCount++
- ) {
- StrnCatGrow(&PrintString, &Size, ShellCommandLineGetRawValue(Package, ParamCount), 0);
- if (ShellCommandLineGetRawValue(Package, ParamCount+1) != NULL) {
- StrnCatGrow(&PrintString, &Size, L" ", 0);
- }
- }
- ShellPrintEx(-1, -1, L"%s\r\n", PrintString);
- SHELL_FREE_NON_NULL(PrintString);
- }
-
- //
- // free the command line package
- //
- ShellCommandLineFreeVarList (Package);
- }
-
- return (ShellStatus);
-}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c
deleted file mode 100644
index 21c5bc81eb..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
- Main file for GetMtc shell level 3 function.
-
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2013, 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "UefiShellLevel3CommandsLib.h"
-
-#include <Library/ShellLib.h>
-
-/**
- Function for 'getmtc' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunGetMtc (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINT64 Mtc;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
-
- //
- // initialize the shell lib (we must be in non-auto-init...)
- //
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- //
- // parse the command line
- //
- Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"getmtc", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ASSERT(FALSE);
- }
- } else {
- //
- // check for "-?"
- //
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"getmtc");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- //
- // Get the monotonic counter count
- //
- Status = gBS->GetNextMonotonicCount(&Mtc);
- if (Status == EFI_DEVICE_ERROR) {
- ShellStatus = SHELL_DEVICE_ERROR;
- } else if (Status == EFI_SECURITY_VIOLATION) {
- ShellStatus = SHELL_SECURITY_VIOLATION;
- } else if (EFI_ERROR(Status)) {
- ShellStatus = SHELL_DEVICE_ERROR;
- }
-
- //
- // print it...
- //
- if (ShellStatus == SHELL_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GET_MTC_OUTPUT), gShellLevel3HiiHandle, Mtc);
- }
- }
- //
- // free the command line package
- //
- ShellCommandLineFreeVarList (Package);
- }
-
- return (ShellStatus);
-}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
deleted file mode 100644
index c8d0e7887c..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/** @file
- Main file for Help shell level 3 function.
-
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved. <BR>
- Copyright (c) 2014, ARM Limited. All rights reserved. <BR>
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "UefiShellLevel3CommandsLib.h"
-
-#include <Library/ShellLib.h>
-#include <Library/HandleParsingLib.h>
-
-#include <Protocol/EfiShellDynamicCommand.h>
-
-/**
- function to insert string items into a list in the correct alphabetical place
-
- the resultant list is a double NULL terminated list of NULL terminated strings.
-
- upon successful return the memory must be caller freed (unless passed back in
- via a loop where it will get reallocated).
-
- @param[in,out] DestList double pointer to the list. may be NULL.
- @param[in,out] DestSize pointer to the size of list. may be 0, if DestList is NULL.
- @param[in] Item the item to insert.
-
- @retval EFI_SUCCESS the operation was successful.
-**/
-EFI_STATUS
-EFIAPI
-LexicalInsertIntoList(
- IN OUT CHAR16 **DestList,
- IN OUT UINTN *DestSize,
- IN CONST CHAR16 *Item
- )
-{
- CHAR16 *NewList;
- INTN LexicalMatchValue;
- CHAR16 *LexicalSpot;
- UINTN SizeOfAddedNameInBytes;
-
- //
- // If there are none, then just return with success
- //
- if (Item == NULL || *Item == CHAR_NULL || StrLen(Item)==0) {
- return (EFI_SUCCESS);
- }
-
- NewList = *DestList;
-
- SizeOfAddedNameInBytes = StrSize(Item);
- NewList = ReallocatePool(*DestSize, (*DestSize) + SizeOfAddedNameInBytes, NewList);
- (*DestSize) = (*DestSize) + SizeOfAddedNameInBytes;
-
- //
- // Find the correct spot in the list
- //
- for (LexicalSpot = NewList
- ; LexicalSpot != NULL && LexicalSpot < NewList + (*DestSize)
- ; LexicalSpot += StrLen(LexicalSpot) + 1
- ) {
- //
- // Get Lexical Comparison Value between PrevCommand and Command list entry
- //
- LexicalMatchValue = gUnicodeCollation->StriColl (
- gUnicodeCollation,
- (CHAR16 *)LexicalSpot,
- (CHAR16 *)Item
- );
- //
- // The new item goes before this one.
- //
- if (LexicalMatchValue > 0 || StrLen(LexicalSpot) == 0) {
- if (StrLen(LexicalSpot) != 0) {
- //
- // Move this and all other items out of the way
- //
- CopyMem(
- LexicalSpot + (SizeOfAddedNameInBytes/sizeof(CHAR16)),
- LexicalSpot,
- (*DestSize) - SizeOfAddedNameInBytes - ((LexicalSpot - NewList) * sizeof(CHAR16))
- );
- }
-
- //
- // Stick this one in place
- //
- StrCpyS(LexicalSpot, SizeOfAddedNameInBytes/sizeof(CHAR16), Item);
- break;
- }
- }
-
- *DestList = NewList;
- return (EFI_SUCCESS);
-}
-
-/**
- function to add each command name from the linked list to the string list.
-
- the resultant list is a double NULL terminated list of NULL terminated strings.
-
- @param[in,out] DestList double pointer to the list. may be NULL.
- @param[in,out] DestSize pointer to the size of list. may be 0, if DestList is NULL.
- @param[in] SourceList the double linked list of commands.
-
- @retval EFI_SUCCESS the operation was successful.
-**/
-EFI_STATUS
-EFIAPI
-CopyListOfCommandNames(
- IN OUT CHAR16 **DestList,
- IN OUT UINTN *DestSize,
- IN CONST COMMAND_LIST *SourceList
- )
-{
- CONST COMMAND_LIST *Node;
-
- for ( Node = (COMMAND_LIST*)GetFirstNode(&SourceList->Link)
- ; SourceList != NULL && !IsListEmpty(&SourceList->Link) && !IsNull(&SourceList->Link, &Node->Link)
- ; Node = (COMMAND_LIST*)GetNextNode(&SourceList->Link, &Node->Link)
- ) {
- LexicalInsertIntoList(DestList, DestSize, Node->CommandString);
- }
- return (EFI_SUCCESS);
-}
-
-/**
- function to add each dynamic command name to the string list.
-
- the resultant list is a double NULL terminated list of NULL terminated strings.
-
- @param[in,out] DestList double pointer to the list. may be NULL.
- @param[in,out] DestSize pointer to the size of list. may be 0, if DestList is NULL.
-
- @retval EFI_SUCCESS the operation was successful.
- @return an error from HandleProtocol
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-CopyListOfCommandNamesWithDynamic(
- IN OUT CHAR16** DestList,
- IN OUT UINTN *DestSize
- )
-{
- EFI_HANDLE *CommandHandleList;
- CONST EFI_HANDLE *NextCommand;
- EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand;
- EFI_STATUS Status;
-
- CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid);
-
- //
- // If there are none, then just return with success
- //
- if (CommandHandleList == NULL) {
- return (EFI_SUCCESS);
- }
-
- Status = EFI_SUCCESS;
-
- //
- // Append those to the list.
- //
- for (NextCommand = CommandHandleList ; *NextCommand != NULL && !EFI_ERROR(Status) ; NextCommand++) {
- Status = gBS->HandleProtocol(
- *NextCommand,
- &gEfiShellDynamicCommandProtocolGuid,
- (VOID **)&DynamicCommand
- );
-
- if (EFI_ERROR(Status)) {
- continue;
- }
-
- Status = LexicalInsertIntoList(DestList, DestSize, DynamicCommand->CommandName);
- }
-
- SHELL_FREE_NON_NULL(CommandHandleList);
- return (Status);
-}
-
-
-/**
- Attempt to print help from a dynamically added command.
-
- @param[in] CommandToGetHelpOn The unicode name of the command that help is
- requested on.
- @param[in] SectionToGetHelpOn Pointer to the section specifier(s).
- @param[in] PrintCommandText Print the command followed by the help content
- or just help.
-
- @retval EFI_SUCCESS The help was displayed
- @retval EFI_NOT_FOUND The command name could not be found
- @retval EFI_DEVICE_ERROR The help data format was incorrect.
-**/
-EFI_STATUS
-EFIAPI
-PrintDynamicCommandHelp(
- IN CONST CHAR16 *CommandToGetHelpOn,
- IN CONST CHAR16 *SectionToGetHelpOn,
- IN BOOLEAN PrintCommandText
- )
-{
- EFI_STATUS Status;
- BOOLEAN Found;
- EFI_HANDLE *CommandHandleList;
- EFI_HANDLE *NextCommand;
- EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand;
-
- Status = EFI_NOT_FOUND;
- Found = FALSE;
- CommandHandleList = NULL;
-
- CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid);
-
- if (CommandHandleList == NULL) {
- //
- // not found or out of resources
- //
- return Status;
- }
-
- for (NextCommand = CommandHandleList; *NextCommand != NULL; NextCommand++) {
- Status = gBS->HandleProtocol(
- *NextCommand,
- &gEfiShellDynamicCommandProtocolGuid,
- (VOID **)&DynamicCommand
- );
-
- if (EFI_ERROR(Status)) {
- continue;
- }
-
- //
- // Check execution break flag when printing multiple command help information.
- //
- if (ShellGetExecutionBreakFlag ()) {
- break;
- }
-
- if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16*)CommandToGetHelpOn)) ||
- (gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) {
- // Print as Shell Help if in ManPage format.
- Status = ShellPrintHelp (DynamicCommand->CommandName, SectionToGetHelpOn,
- PrintCommandText);
- if (Status == EFI_DEVICE_ERROR) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV),
- gShellLevel3HiiHandle, DynamicCommand->CommandName);
- } else if (EFI_ERROR(Status)) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF),
- gShellLevel3HiiHandle, DynamicCommand->CommandName);
- } else {
- Found = TRUE;
- }
- }
- }
-
- SHELL_FREE_NON_NULL(CommandHandleList);
-
- return (Found ? EFI_SUCCESS : Status);
-
-}
-
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-usage", TypeFlag},
- {L"-section", TypeMaxValue},
- {L"-verbose", TypeFlag},
- {L"-v", TypeFlag},
- {NULL, TypeMax}
- };
-
-/**
- Function for 'help' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunHelp (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CHAR16 *SortedCommandList;
- CONST CHAR16 *CurrentCommand;
- CHAR16 *CommandToGetHelpOn;
- CHAR16 *SectionToGetHelpOn;
- CHAR16 *HiiString;
- BOOLEAN Found;
- BOOLEAN PrintCommandText;
- UINTN SortedCommandListSize;
-
- PrintCommandText = TRUE;
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- CommandToGetHelpOn = NULL;
- SectionToGetHelpOn = NULL;
- Found = FALSE;
-
- //
- // initialize the shell lib (we must be in non-auto-init...)
- //
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
-
- //
- // parse the command line
- //
- 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), gShellLevel3HiiHandle, L"help", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ASSERT(FALSE);
- }
- } else {
- //
- // Check for conflicting parameters.
- //
- if (ShellCommandLineGetFlag(Package, L"-usage")
- &&ShellCommandLineGetFlag(Package, L"-section")
- &&(ShellCommandLineGetFlag(Package, L"-verbose") || ShellCommandLineGetFlag(Package, L"-v"))
- ){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CON), gShellLevel3HiiHandle, L"help");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"help");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- //
- // Get the command name we are getting help on
- //
- ASSERT(CommandToGetHelpOn == NULL);
- StrnCatGrow(&CommandToGetHelpOn, NULL, ShellCommandLineGetRawValue(Package, 1), 0);
- if (CommandToGetHelpOn == NULL && ShellCommandLineGetFlag(Package, L"-?")) {
- //
- // If we dont have a command and we got a simple -?
- // we are looking for help on help command.
- //
- StrnCatGrow(&CommandToGetHelpOn, NULL, L"help", 0);
- }
-
- if (CommandToGetHelpOn == NULL) {
- StrnCatGrow(&CommandToGetHelpOn, NULL, L"*", 0);
- ASSERT(SectionToGetHelpOn == NULL);
- StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME", 0);
- } else {
- PrintCommandText = FALSE;
- ASSERT(SectionToGetHelpOn == NULL);
- //
- // Get the section name for the given command name
- //
- if (ShellCommandLineGetFlag(Package, L"-section")) {
- StrnCatGrow(&SectionToGetHelpOn, NULL, ShellCommandLineGetValue(Package, L"-section"), 0);
- } else if (ShellCommandLineGetFlag(Package, L"-usage")) {
- StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME,SYNOPSIS", 0);
- } else if (ShellCommandLineGetFlag(Package, L"-verbose") || ShellCommandLineGetFlag(Package, L"-v")) {
- } else {
- //
- // The output of help <command> will display NAME, SYNOPSIS, OPTIONS, DESCRIPTION, and EXAMPLES sections.
- //
- StrnCatGrow (&SectionToGetHelpOn, NULL, L"NAME,SYNOPSIS,OPTIONS,DESCRIPTION,EXAMPLES", 0);
- }
- }
-
- if (gUnicodeCollation->StriColl(gUnicodeCollation, CommandToGetHelpOn, L"special") == 0) {
- //
- // we need info on the special characters
- //
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_SC_HEADER), gShellLevel3HiiHandle);
- HiiString = HiiGetString(gShellLevel3HiiHandle, STRING_TOKEN(STR_HELP_SC_DATA), NULL);
- ShellPrintEx(-1, -1, L"%s", HiiString);
- FreePool(HiiString);
- Found = TRUE;
- } else {
- SortedCommandList = NULL;
- SortedCommandListSize = 0;
- CopyListOfCommandNames(&SortedCommandList, &SortedCommandListSize, ShellCommandGetCommandList(TRUE));
- CopyListOfCommandNamesWithDynamic(&SortedCommandList, &SortedCommandListSize);
-
- for (CurrentCommand = SortedCommandList
- ; CurrentCommand != NULL && *CurrentCommand != CHAR_NULL && CurrentCommand < SortedCommandList + SortedCommandListSize/sizeof(CHAR16)
- ; CurrentCommand += StrLen(CurrentCommand) + 1
- ) {
- //
- // Checking execution break flag when print multiple command help information.
- //
- if (ShellGetExecutionBreakFlag ()) {
- break;
- }
-
- if ((gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)CurrentCommand, CommandToGetHelpOn)) ||
- (gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch(gUnicodeCollation, (CHAR16*)CurrentCommand, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) {
- //
- // We have a command to look for help on.
- //
- Status = ShellPrintHelp(CurrentCommand, SectionToGetHelpOn, PrintCommandText);
- if (EFI_ERROR(Status)) {
- //
- // now try to match against the dynamic command list and print help
- //
- Status = PrintDynamicCommandHelp (CurrentCommand, SectionToGetHelpOn, PrintCommandText);
- }
- if (Status == EFI_DEVICE_ERROR) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CurrentCommand);
- } else if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CurrentCommand);
- } else {
- Found = TRUE;
- }
- }
- }
-
- //
- // Search the .man file for Shell applications (Shell external commands).
- //
- if (!Found) {
- Status = ShellPrintHelp(CommandToGetHelpOn, SectionToGetHelpOn, FALSE);
- if (Status == EFI_DEVICE_ERROR) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CommandToGetHelpOn);
- } else if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn);
- } else {
- Found = TRUE;
- }
- }
- }
-
- if (!Found) {
- ShellStatus = SHELL_NOT_FOUND;
- }
-
- //
- // free the command line package
- //
- ShellCommandLineFreeVarList (Package);
- }
- }
-
- if (CommandToGetHelpOn != NULL && StrCmp(CommandToGetHelpOn, L"*") == 0){
- //
- // If '*' then the command entered was 'Help' without qualifiers, This footer
- // provides additional info on help switches
- //
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_FOOTER), gShellLevel3HiiHandle);
- }
- if (CommandToGetHelpOn != NULL) {
- FreePool(CommandToGetHelpOn);
- }
- if (SectionToGetHelpOn != NULL) {
- FreePool(SectionToGetHelpOn);
- }
-
- return (ShellStatus);
-}
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c
deleted file mode 100644
index ab597060e2..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/** @file
- Main file for Pause shell level 3 function.
-
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2014, 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "UefiShellLevel3CommandsLib.h"
-
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-q", TypeFlag},
- {NULL, TypeMax}
- };
-
-/**
- Function for 'pause' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunPause (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- SHELL_PROMPT_RESPONSE *Resp;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- Resp = NULL;
-
- //
- // initialize the shell lib (we must be in non-auto-init...)
- //
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
-
- if (!gEfiShellProtocol->BatchIsActive()) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel3HiiHandle, L"pause");
- return (SHELL_UNSUPPORTED);
- }
-
- //
- // parse the command line
- //
- 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), gShellLevel3HiiHandle, L"pause", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ASSERT(FALSE);
- }
- } else {
- //
- // check for "-?"
- //
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"pause");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- if (!ShellCommandLineGetFlag(Package, L"-q")) {
- Status = ShellPromptForResponseHii(ShellPromptResponseTypeQuitContinue, STRING_TOKEN (STR_PAUSE_PROMPT), gShellLevel3HiiHandle, (VOID**)&Resp);
- } else {
- Status = ShellPromptForResponse(ShellPromptResponseTypeQuitContinue, NULL, (VOID**)&Resp);
- }
-
- if (EFI_ERROR(Status) || Resp == NULL || *Resp == ShellPromptResponseQuit) {
- ShellCommandRegisterExit(TRUE, 0);
- ShellStatus = SHELL_ABORTED;
- }
-
- if (Resp != NULL) {
- FreePool(Resp);
- }
- }
-
- //
- // free the command line package
- //
- ShellCommandLineFreeVarList (Package);
- }
-
-
- return (ShellStatus);
-}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c
deleted file mode 100644
index 88c5d750e0..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/** @file
- Main file for Touch shell level 3 function.
-
- (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2011, 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "UefiShellLevel3CommandsLib.h"
-
-#include <Library/ShellLib.h>
-
-/**
- Do the touch operation on a single handle.
-
- @param[in] Handle The handle to update the date/time on.
-
- @retval EFI_ACCESS_DENIED The file referenced by Handle is read only.
- @retval EFI_SUCCESS The operation was successful.
-**/
-EFI_STATUS
-EFIAPI
-TouchFileByHandle (
- IN EFI_HANDLE Handle
- )
-{
- EFI_STATUS Status;
- EFI_FILE_INFO *FileInfo;
-
- FileInfo = gEfiShellProtocol->GetFileInfo(Handle);
- if ((FileInfo->Attribute & EFI_FILE_READ_ONLY) != 0){
- return (EFI_ACCESS_DENIED);
- }
- Status = gRT->GetTime(&FileInfo->ModificationTime, NULL);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"gRT->GetTime", Status);
- return (SHELL_DEVICE_ERROR);
- }
-
- CopyMem(&FileInfo->LastAccessTime, &FileInfo->ModificationTime, sizeof(EFI_TIME));
-
- Status = gEfiShellProtocol->SetFileInfo(Handle, FileInfo);
-
- FreePool(FileInfo);
-
- return (Status);
-}
-
-/**
- Touch a given file and potantially recurse down if it was a directory.
-
- @param[in] Name The name of this file.
- @param[in] FS The name of the file system this file is on.
- @param[in] Handle The handle of this file already opened.
- @param[in] Rec TRUE to recurse if possible.
-
- @retval EFI_INVALID_PARAMETER A parameter was invalid.
- @retval EFI_SUCCESS The operation was successful.
-**/
-EFI_STATUS
-EFIAPI
-DoTouchByHandle (
- IN CONST CHAR16 *Name,
- IN CHAR16 *FS,
- IN SHELL_FILE_HANDLE Handle,
- IN BOOLEAN Rec
- )
-{
- EFI_STATUS Status;
- EFI_SHELL_FILE_INFO *FileList;
- EFI_SHELL_FILE_INFO *Walker;
- CHAR16 *TempSpot;
-
- Status = EFI_SUCCESS;
- FileList = NULL;
- Walker = NULL;
-
- if (FS == NULL) {
- FS = StrnCatGrow(&FS, NULL, Name, 0);
- if (FS != NULL) {
- TempSpot = StrStr(FS, L"\\");
- if (TempSpot != NULL) {
- *TempSpot = CHAR_NULL;
- }
- }
- }
- if (FS == NULL) {
- return (EFI_INVALID_PARAMETER);
- }
-
- //
- // do it
- //
- Status = TouchFileByHandle(Handle);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Name);
- return (Status);
- }
-
- //
- // if it's a directory recurse...
- //
- if (FileHandleIsDirectory(Handle) == EFI_SUCCESS && Rec) {
- //
- // get each file under this directory
- //
- if (EFI_ERROR(gEfiShellProtocol->FindFilesInDir(Handle, &FileList))) {
- Status = EFI_INVALID_PARAMETER;
- }
-
- //
- // recurse on each
- //
- for (Walker = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link)
- ; FileList != NULL && !IsNull(&FileList->Link, &Walker->Link) && !EFI_ERROR(Status)
- ; Walker = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Walker->Link)
- ){
- if ( (StrCmp(Walker->FileName, L".") != 0)
- && (StrCmp(Walker->FileName, L"..") != 0)
- ){
- //
- // Open the file since we need that handle.
- //
- Status = gEfiShellProtocol->OpenFileByName (Walker->FullName, &Walker->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Walker->FullName);
- Status = EFI_ACCESS_DENIED;
- } else {
- Status = DoTouchByHandle(Walker->FullName, FS, Walker->Handle, TRUE);
- gEfiShellProtocol->CloseFile(Walker->Handle);
- Walker->Handle = NULL;
- }
- }
- }
-
- //
- // free stuff
- //
- if (FileList != NULL && EFI_ERROR(gEfiShellProtocol->FreeFileList(&FileList))) {
- Status = EFI_INVALID_PARAMETER;
- }
- }
-
- return (Status);
-}
-
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-r", TypeFlag},
- {NULL, TypeMax}
- };
-
-/**
- Function for 'touch' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunTouch (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- CONST CHAR16 *Param;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- EFI_SHELL_FILE_INFO *FileList;
- EFI_SHELL_FILE_INFO *Node;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- ParamCount = 0;
- FileList = NULL;
-
- //
- // initialize the shell lib (we must be in non-auto-init...)
- //
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
-
- //
- // parse the command line
- //
- 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), gShellLevel3HiiHandle, L"touch", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ASSERT(FALSE);
- }
- } else {
- //
- // check for "-?"
- //
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- }
- if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
- //
- // we insufficient parameters
- //
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"touch");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- //
- // get a list with each file specified by parameters
- // if parameter is a directory then add all the files below it to the list
- //
- for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ; Param != NULL
- ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ){
- Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, &FileList);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"touch", (CHAR16*)Param);
- ShellStatus = SHELL_NOT_FOUND;
- break;
- }
- //
- // make sure we completed the param parsing sucessfully...
- // Also make sure that any previous action was sucessful
- //
- if (ShellStatus == SHELL_SUCCESS) {
- //
- // check that we have at least 1 file
- //
- if (FileList == NULL || IsListEmpty(&FileList->Link)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel3HiiHandle, L"touch", Param);
- continue;
- } else {
- //
- // loop through the list and make sure we are not aborting...
- //
- for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag()
- ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link)
- ){
- //
- // make sure the file opened ok
- //
- if (EFI_ERROR(Node->Status)){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Node->FileName);
- ShellStatus = SHELL_NOT_FOUND;
- continue;
- }
-
- Status = DoTouchByHandle(Node->FullName, NULL, Node->Handle, ShellCommandLineGetFlag(Package, L"-r"));
- if (EFI_ERROR(Status) && Status != EFI_ACCESS_DENIED) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"touch", Node->FileName);
- ShellStatus = SHELL_NOT_FOUND;
- }
- }
- }
- }
- //
- // Free the fileList
- //
- if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
- Status = ShellCloseFileMetaArg(&FileList);
- ASSERT_EFI_ERROR(Status);
- }
- FileList = NULL;
- }
- }
-
- //
- // free the command line package
- //
- ShellCommandLineFreeVarList (Package);
- }
-
- if (ShellGetExecutionBreakFlag()) {
- return (SHELL_ABORTED);
- }
-
- return (ShellStatus);
-}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c
deleted file mode 100644
index ccd1199bd1..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/** @file
- Main file for Type shell level 3 function.
-
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2011, 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "UefiShellLevel3CommandsLib.h"
-
-#include <Library/ShellLib.h>
-
-/**
- Display a single file to StdOut.
-
- If both Ascii and UCS2 are FALSE attempt to discover the file type.
-
- @param[in] Handle The handle to the file to display.
- @param[in] Ascii TRUE to force ASCII, FALSE othewise.
- @param[in] UCS2 TRUE to force UCS2, FALSE othewise.
-
- @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
- @retval EFI_SUCCESS The operation was successful.
-**/
-EFI_STATUS
-EFIAPI
-TypeFileByHandle (
- IN SHELL_FILE_HANDLE Handle,
- IN BOOLEAN Ascii,
- IN BOOLEAN UCS2
- )
-{
- UINTN ReadSize;
- VOID *Buffer;
- VOID *AllocatedBuffer;
- EFI_STATUS Status;
- UINTN LoopVar;
- UINTN LoopSize;
- CHAR16 AsciiChar;
- CHAR16 Ucs2Char;
-
- ReadSize = PcdGet32(PcdShellFileOperationSize);
- AllocatedBuffer = AllocateZeroPool(ReadSize);
- if (AllocatedBuffer == NULL) {
- return (EFI_OUT_OF_RESOURCES);
- }
-
- Status = ShellSetFilePosition(Handle, 0);
- ASSERT_EFI_ERROR(Status);
-
- while (ReadSize == ((UINTN)PcdGet32(PcdShellFileOperationSize))) {
- Buffer = AllocatedBuffer;
- ZeroMem(Buffer, ReadSize);
- Status = ShellReadFile(Handle, &ReadSize, Buffer);
- if (EFI_ERROR(Status)){
- break;
- }
-
- if (!(Ascii|UCS2)) {
- if (*(UINT16*)Buffer == gUnicodeFileTag) {
- UCS2 = TRUE;
- } else {
- Ascii = TRUE;
- }
- }
-
- if (Ascii) {
- LoopSize = ReadSize;
- for (LoopVar = 0 ; LoopVar < LoopSize ; LoopVar++) {
- //
- // The valid range of ASCII characters is 0x20-0x7E.
- // Display "." when there is an invalid character.
- //
- AsciiChar = CHAR_NULL;
- AsciiChar = ((CHAR8*)Buffer)[LoopVar];
- if (AsciiChar == '\r' || AsciiChar == '\n') {
- //
- // Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD)
- // characters to be displayed as is.
- //
- if (AsciiChar == '\n' && ((CHAR8*)Buffer)[LoopVar-1] != '\r') {
- //
- // In case Line Feed (0xA) is encountered & Carriage Return (0xD)
- // was not the previous character, print CR and LF. This is because
- // Shell 2.0 requires carriage return with line feed for displaying
- // each new line from left.
- //
- ShellPrintEx (-1, -1, L"\r\n");
- continue;
- }
- } else {
- //
- // For all other characters which are not printable, display '.'
- //
- if (AsciiChar < 0x20 || AsciiChar >= 0x7F) {
- AsciiChar = '.';
- }
- }
- ShellPrintEx (-1, -1, L"%c", AsciiChar);
- }
- } else {
- if (*(UINT16*)Buffer == gUnicodeFileTag) {
- //
- // For unicode files, skip displaying the byte order marker.
- //
- Buffer = ((UINT16*)Buffer) + 1;
- LoopSize = (ReadSize / (sizeof (CHAR16))) - 1;
- } else {
- LoopSize = ReadSize / (sizeof (CHAR16));
- }
-
- for (LoopVar = 0 ; LoopVar < LoopSize ; LoopVar++) {
- //
- // An invalid range of characters is 0x0-0x1F.
- // Display "." when there is an invalid character.
- //
- Ucs2Char = CHAR_NULL;
- Ucs2Char = ((CHAR16*)Buffer)[LoopVar];
- if (Ucs2Char == '\r' || Ucs2Char == '\n') {
- //
- // Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD)
- // characters to be displayed as is.
- //
- if (Ucs2Char == '\n' && ((CHAR16*)Buffer)[LoopVar-1] != '\r') {
- //
- // In case Line Feed (0xA) is encountered & Carriage Return (0xD)
- // was not the previous character, print CR and LF. This is because
- // Shell 2.0 requires carriage return with line feed for displaying
- // each new line from left.
- //
- ShellPrintEx (-1, -1, L"\r\n");
- continue;
- }
- }
- else if (Ucs2Char < 0x20) {
- //
- // For all other characters which are not printable, display '.'
- //
- Ucs2Char = L'.';
- }
- ShellPrintEx (-1, -1, L"%c", Ucs2Char);
- }
- }
-
- if (ShellGetExecutionBreakFlag()) {
- break;
- }
- }
- FreePool (AllocatedBuffer);
- ShellPrintEx (-1, -1, L"\r\n");
- return (Status);
-}
-
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-a", TypeFlag},
- {L"-u", TypeFlag},
- {NULL, TypeMax}
- };
-
-/**
- Function for 'type' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunType (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- CONST CHAR16 *Param;
- SHELL_STATUS ShellStatus;
- UINTN ParamCount;
- EFI_SHELL_FILE_INFO *FileList;
- EFI_SHELL_FILE_INFO *Node;
- BOOLEAN AsciiMode;
- BOOLEAN UnicodeMode;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- ParamCount = 0;
- FileList = NULL;
-
- //
- // initialize the shell lib (we must be in non-auto-init...)
- //
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
-
- //
- // parse the command line
- //
- 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), gShellLevel3HiiHandle, L"type", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ASSERT(FALSE);
- }
- } else {
- //
- // check for "-?"
- //
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- }
- AsciiMode = ShellCommandLineGetFlag(Package, L"-a");
- UnicodeMode = ShellCommandLineGetFlag(Package, L"-u");
-
- if (AsciiMode && UnicodeMode) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"type", L"-a & -u");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) {
- //
- // we insufficient parameters
- //
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel3HiiHandle, L"type");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- //
- // get a list with each file specified by parameters
- // if parameter is a directory then add all the files below it to the list
- //
- for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ; Param != NULL
- ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount)
- ){
- Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_READ, &FileList);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"type", (CHAR16*)Param);
- ShellStatus = SHELL_NOT_FOUND;
- break;
- }
- //
- // make sure we completed the param parsing sucessfully...
- // Also make sure that any previous action was sucessful
- //
- if (ShellStatus == SHELL_SUCCESS) {
- //
- // check that we have at least 1 file
- //
- if (FileList == NULL || IsListEmpty(&FileList->Link)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NF), gShellLevel3HiiHandle, L"type", Param);
- continue;
- } else {
- //
- // loop through the list and make sure we are not aborting...
- //
- for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link)
- ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag()
- ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link)
- ){
-
- if (ShellGetExecutionBreakFlag()) {
- break;
- }
-
- //
- // make sure the file opened ok
- //
- if (EFI_ERROR(Node->Status)){
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel3HiiHandle, L"type", Node->FileName);
- ShellStatus = SHELL_NOT_FOUND;
- continue;
- }
-
- //
- // make sure its not a directory
- //
- if (FileHandleIsDirectory(Node->Handle) == EFI_SUCCESS) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_IS_DIR), gShellLevel3HiiHandle, L"type", Node->FileName);
- ShellStatus = SHELL_NOT_FOUND;
- continue;
- }
-
- //
- // do it
- //
- Status = TypeFileByHandle (Node->Handle, AsciiMode, UnicodeMode);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TYP_ERROR), gShellLevel3HiiHandle, L"type", Node->FileName);
- ShellStatus = SHELL_INVALID_PARAMETER;
- }
- ASSERT(ShellStatus == SHELL_SUCCESS);
- }
- }
- }
- //
- // Free the fileList
- //
- if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
- Status = ShellCloseFileMetaArg(&FileList);
- }
- ASSERT_EFI_ERROR(Status);
- FileList = NULL;
- }
- }
-
- //
- // free the command line package
- //
- ShellCommandLineFreeVarList (Package);
- }
-
- if (ShellGetExecutionBreakFlag()) {
- return (SHELL_ABORTED);
- }
-
- return (ShellStatus);
-}
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c
deleted file mode 100644
index 448f7234dd..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/** @file
- Main file for NULL named library for level 3 shell command functions.
-
- (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2011, 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-#include "UefiShellLevel3CommandsLib.h"
-
-CONST CHAR16 gShellLevel3FileName[] = L"ShellCommands";
-EFI_HANDLE gShellLevel3HiiHandle = NULL;
-
-/**
- return the filename to get help from is not using HII.
-
- @retval The filename.
-**/
-CONST CHAR16*
-EFIAPI
-ShellCommandGetManFileNameLevel3 (
- VOID
- )
-{
- return (gShellLevel3FileName);
-}
-
-/**
- Constructor for the Shell Level 3 Commands library.
-
- Install the handlers for level 3 UEFI Shell 2.0 commands.
-
- @param ImageHandle the image handle of the process
- @param SystemTable the EFI System Table pointer
-
- @retval EFI_SUCCESS the shell command handlers were installed sucessfully
- @retval EFI_UNSUPPORTED the shell level required was not found.
-**/
-EFI_STATUS
-EFIAPI
-ShellLevel3CommandsLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- gShellLevel3HiiHandle = NULL;
- //
- // if shell level is less than 3 do nothing
- //
- if (PcdGet8(PcdShellSupportLevel) < 3) {
- return (EFI_SUCCESS);
- }
-
- gShellLevel3HiiHandle = HiiAddPackages (&gShellLevel3HiiGuid, gImageHandle, UefiShellLevel3CommandsLibStrings, NULL);
- if (gShellLevel3HiiHandle == NULL) {
- return (EFI_DEVICE_ERROR);
- }
- //
- // install our shell command handlers that are always installed
- //
- // Note: that Time, Timezone, and Date are part of level 2 library
- //
- ShellCommandRegisterCommandName(L"type", ShellCommandRunType , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TYPE));
- ShellCommandRegisterCommandName(L"touch", ShellCommandRunTouch , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_TOUCH));
- ShellCommandRegisterCommandName(L"ver", ShellCommandRunVer , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_VER));
- ShellCommandRegisterCommandName(L"alias", ShellCommandRunAlias , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ALIAS));
- ShellCommandRegisterCommandName(L"cls", ShellCommandRunCls , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_CLS));
- ShellCommandRegisterCommandName(L"echo", ShellCommandRunEcho , ShellCommandGetManFileNameLevel3, 3, L"", FALSE, gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_ECHO));
- ShellCommandRegisterCommandName(L"pause", ShellCommandRunPause , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_PAUSE));
- ShellCommandRegisterCommandName(L"getmtc", ShellCommandRunGetMtc , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_GETMTC));
- ShellCommandRegisterCommandName(L"help", ShellCommandRunHelp , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_HELP));
-
- ShellCommandRegisterAlias(L"type", L"cat");
-
- return (EFI_SUCCESS);
-}
-
-/**
- Destructor for the library. free any resources.
-
- @param ImageHandle The image handle of the process.
- @param SystemTable The EFI System Table pointer.
-**/
-EFI_STATUS
-EFIAPI
-ShellLevel3CommandsLibDestructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- if (gShellLevel3HiiHandle != NULL) {
- HiiRemovePackages(gShellLevel3HiiHandle);
- }
- return (EFI_SUCCESS);
-}
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h
deleted file mode 100644
index bd5b9bec9c..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/** @file
- header file for NULL named library for level 3 shell command functions.
-
- Copyright (c) 2009 - 2011, 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _UEFI_SHELL_LEVEL3_COMMANDS_LIB_H_
-#define _UEFI_SHELL_LEVEL3_COMMANDS_LIB_H_
-
-#include <Uefi.h>
-#include <ShellBase.h>
-
-#include <Guid/ShellLibHiiGuid.h>
-
-#include <Protocol/EfiShell.h>
-#include <Protocol/EfiShellParameters.h>
-#include <Protocol/DevicePath.h>
-#include <Protocol/LoadedImage.h>
-#include <Protocol/UnicodeCollation.h>
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Library/ShellCommandLib.h>
-#include <Library/ShellLib.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/HiiLib.h>
-#include <Library/FileHandleLib.h>
-
-extern EFI_HANDLE gShellLevel3HiiHandle;
-
-/**
- Function for 'type' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunType (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
- Function for 'touch' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunTouch (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
- Function for 'ver' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunVer (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
- Function for 'alias' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunAlias (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
- Function for 'cls' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunCls (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
- Function for 'echo' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunEcho (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
- Function for 'pause' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunPause (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
- Function for 'getmtc' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunGetMtc (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
- Function for 'help' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunHelp (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-#endif
-
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
deleted file mode 100644
index a13cd9babf..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
+++ /dev/null
@@ -1,74 +0,0 @@
-## @file
-# Provides shell level 3 functions
-# Note that the interactive versions of the time, date, and timezone functions are handled in the level 2 library.
-#
-# (C) Copyright 2013 Hewlett-Packard Development Company, L.P.<BR>
-# Copyright (c) 2009-2015, 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
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010006
- BASE_NAME = UefiShellLevel3CommandsLib
- FILE_GUID = 71374B42-85D7-4753-AD17-AA84C3A0EB93
- MODULE_TYPE = UEFI_APPLICATION
- VERSION_STRING = 1.0
- LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER
- CONSTRUCTOR = ShellLevel3CommandsLibConstructor
- DESTRUCTOR = ShellLevel3CommandsLibDestructor
-
-[Sources.common]
-# note that time, timezone, and date are part of the level 2 library
- Type.c
- Touch.c
- Ver.c
- UefiShellLevel3CommandsLib.uni
- UefiShellLevel3CommandsLib.c
- UefiShellLevel3CommandsLib.h
- Cls.c
- Alias.c
- Echo.c
- Pause.c
- GetMtc.c
- Help.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- ShellPkg/ShellPkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- MemoryAllocationLib
- BaseLib
- BaseMemoryLib
- DebugLib
- ShellCommandLib
- ShellLib
- UefiLib
- UefiRuntimeServicesTableLib
- UefiBootServicesTableLib
- PcdLib
- HiiLib
- FileHandleLib
- HandleParsingLib
-
-[Guids]
- gEfiFileInfoGuid ## UNDEFINED
- gShellLevel3HiiGuid ## SOMETIMES_CONSUMES ## HII
-
-[Pcd.common]
- gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES
- gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize ## SOMETIMES_CONSUMES
- gEfiShellPkgTokenSpaceGuid.PcdShellSupplier ## SOMETIMES_CONSUMES
-
-[Protocols]
- gEfiShellDynamicCommandProtocolGuid ## SOMETIMES_CONSUMES
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni b/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni
deleted file mode 100644
index f4473ada5f..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.uni
+++ /dev/null
Binary files differ
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c
deleted file mode 100644
index deefaf0bb2..0000000000
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/** @file
- Main file for Ver shell level 3 function.
-
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2010, 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
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "UefiShellLevel3CommandsLib.h"
-
-#include <Library/ShellLib.h>
-
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-s", TypeFlag},
- {L"-terse", TypeFlag},
- {L"-t", TypeFlag},
- {L"-_pa", TypeFlag},
- {NULL, TypeMax}
- };
-
-/**
- Function for 'ver' command.
-
- @param[in] ImageHandle Handle to the Image (NULL if Internal).
- @param[in] SystemTable Pointer to the System Table (NULL if Internal).
-**/
-SHELL_STATUS
-EFIAPI
-ShellCommandRunVer (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- UINT8 Level;
-
- Level = PcdGet8(PcdShellSupportLevel);
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
-
- //
- // initialize the shell lib (we must be in non-auto-init...)
- //
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
-
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
-
- //
- // parse the command line
- //
- 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), gShellLevel3HiiHandle, L"ver", ProblemParam);
- FreePool(ProblemParam);
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- ASSERT(FALSE);
- }
- } else {
- //
- // check for "-?"
- //
- if (ShellCommandLineGetFlag(Package, L"-?")) {
- ASSERT(FALSE);
- }
- if (ShellCommandLineGetRawValue(Package, 1) != NULL) {
- //
- // we have too many parameters
- //
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"ver");
- ShellStatus = SHELL_INVALID_PARAMETER;
- } else {
- if (ShellCommandLineGetFlag(Package, L"-s")) {
- ShellPrintHiiEx (
- 0,
- gST->ConOut->Mode->CursorRow,
- NULL,
- STRING_TOKEN (STR_VER_OUTPUT_SIMPLE),
- gShellLevel3HiiHandle,
- gEfiShellProtocol->MajorVersion,
- gEfiShellProtocol->MinorVersion
- );
- } else {
- ShellPrintHiiEx (
- 0,
- gST->ConOut->Mode->CursorRow,
- NULL,
- STRING_TOKEN (STR_VER_OUTPUT_SHELL),
- gShellLevel3HiiHandle,
- SupportLevel[Level],
- gEfiShellProtocol->MajorVersion,
- gEfiShellProtocol->MinorVersion
- );
- if (!ShellCommandLineGetFlag(Package, L"-terse") && !ShellCommandLineGetFlag(Package, L"-t")){
- ShellPrintHiiEx(
- -1,
- -1,
- NULL,
- STRING_TOKEN (STR_VER_OUTPUT_SUPPLIER),
- gShellLevel3HiiHandle,
- (CHAR16 *) PcdGetPtr (PcdShellSupplier)
- );
-
-
- ShellPrintHiiEx (
- -1,
- -1,
- NULL,
- STRING_TOKEN (STR_VER_OUTPUT_UEFI),
- gShellLevel3HiiHandle,
- (gST->Hdr.Revision&0xffff0000)>>16,
- (gST->Hdr.Revision&0x0000ffff),
- gST->FirmwareVendor,
- gST->FirmwareRevision
- );
- }
- }
- //
- // implementation specific support for displaying processor architecture
- //
- if (ShellCommandLineGetFlag(Package, L"-_pa")) {
- ShellPrintEx(-1, -1, L"%d\r\n", sizeof(UINTN)==sizeof(UINT64)?64:32);
- }
- }
-
- //
- // free the command line package
- //
- ShellCommandLineFreeVarList (Package);
- }
-
- return (ShellStatus);
-}
-