X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FApplication%2FShell%2FShell.h;h=e6eb150f57a525fbf75974c2752ac0f67f3b17db;hb=6a5033ca3e8868a176a9671d55ad297bac385b1b;hp=1f2fa8127a46ae5ace068f5b65d7e88e9dbea24e;hpb=69c569bf550c3071b4b5dccc52d9b78db2addc2e;p=mirror_edk2.git diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h index 1f2fa8127a..e6eb150f57 100644 --- a/ShellPkg/Application/Shell/Shell.h +++ b/ShellPkg/Application/Shell/Shell.h @@ -1,15 +1,9 @@ /** @file function definitions for internal to shell functions. - (C) Copyright 2014, Hewlett-Packard Development Company, L.P. - Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
- 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. + (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -17,18 +11,18 @@ #define _SHELL_INTERNAL_HEADER_ #include -#include #include #include #include #include -#include +#include #include #include -#include +#include #include +#include #include #include @@ -47,6 +41,7 @@ #include #include #include +#include #include "ShellParametersProtocol.h" #include "ShellProtocol.h" @@ -56,10 +51,14 @@ #include "ConsoleWrappers.h" #include "FileHandleWrappers.h" +extern CONST CHAR16 mNoNestingEnvVarName[]; +extern CONST CHAR16 mNoNestingTrue[]; +extern CONST CHAR16 mNoNestingFalse[]; + typedef struct { LIST_ENTRY Link; ///< Standard linked list handler. - SHELL_FILE_HANDLE *SplitStdOut; ///< ConsoleOut for use in the split. - SHELL_FILE_HANDLE *SplitStdIn; ///< ConsoleIn for use in the split. + SHELL_FILE_HANDLE SplitStdOut; ///< ConsoleOut for use in the split. + SHELL_FILE_HANDLE SplitStdIn; ///< ConsoleIn for use in the split. } SPLIT_LIST; typedef struct { @@ -71,7 +70,8 @@ typedef struct { UINT32 NoMap:1; ///< Was "-nomap" found on command line. UINT32 NoVersion:1; ///< Was "-noversion" found on command line. UINT32 Delay:1; ///< Was "-delay[:n] found on command line - UINT32 Exit:1; ///< Was "-_exit" found on command line + UINT32 Exit:1; ///< Was "-_exit" found on command line + UINT32 NoNest:1; ///< Was "-nonest" found on command line UINT32 Reserved:7; ///< Extra bits } SHELL_BITS; @@ -122,27 +122,28 @@ typedef struct { BOOLEAN HaltOutput; ///< TRUE to start a CTRL-S halt. } SHELL_INFO; -extern SHELL_INFO ShellInfoObject; +#pragma pack(1) +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} SHELL_MAN_HII_VENDOR_DEVICE_PATH; +#pragma pack() -typedef enum { - Internal_Command, - Script_File_Name, - Efi_Application, - File_Sys_Change, - Unknown_Invalid -} SHELL_OPERATION_TYPES; +extern SHELL_INFO ShellInfoObject; /** - Converts the command line to it's post-processed form. this replaces variables and alias' per UEFI Shell spec. + Converts the command line to its post-processed form. this replaces variables and alias' per UEFI Shell spec. @param[in,out] CmdLine pointer to the command line to update @retval EFI_SUCCESS The operation was successful @retval EFI_OUT_OF_RESOURCES A memory allocation failed. - @return some other error occured + @return some other error occurred **/ EFI_STATUS -EFIAPI ProcessCommandLineToFinal( IN OUT CHAR16 **CmdLine ); @@ -153,7 +154,6 @@ ProcessCommandLineToFinal( @param[in] ErrorCode the error code to put into lasterror **/ EFI_STATUS -EFIAPI SetLastError( IN CONST SHELL_STATUS ErrorCode ); @@ -161,10 +161,9 @@ SetLastError( /** Sets all the alias' that were registered with the ShellCommandLib library. - @retval EFI_SUCCESS all init commands were run sucessfully. + @retval EFI_SUCCESS all init commands were run successfully. **/ EFI_STATUS -EFIAPI SetBuiltInAlias( VOID ); @@ -175,16 +174,15 @@ SetBuiltInAlias( loaded image protocol installed on it. the FilePath will point to the device path for the file that was loaded. - @param[in, out] DevPath on a sucessful return the device path to the loaded image - @param[in, out] FilePath on a sucessful return the device path to the file + @param[in, out] DevPath on a successful return the device path to the loaded image + @param[in, out] FilePath on a successful return the device path to the file - @retval EFI_SUCCESS the 2 device paths were sucessfully returned. + @retval EFI_SUCCESS the 2 device paths were successfully returned. @return other a error from gBS->HandleProtocol @sa HandleProtocol **/ EFI_STATUS -EFIAPI GetDevicePathsForImageAndFile ( IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPath, IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath @@ -218,7 +216,6 @@ GetDevicePathsForImageAndFile ( @retval EFI_SUCCESS the variable is initialized. **/ EFI_STATUS -EFIAPI ProcessCommandLine( VOID ); @@ -234,7 +231,6 @@ ProcessCommandLine( @retval EFI_SUCCESS The variable is initialized. **/ EFI_STATUS -EFIAPI DoStartupScript( IN EFI_DEVICE_PATH_PROTOCOL *ImagePath, IN EFI_DEVICE_PATH_PROTOCOL *FilePath @@ -249,7 +245,6 @@ DoStartupScript( @retval RETURN_ABORTED **/ EFI_STATUS -EFIAPI DoShellPrompt ( VOID ); @@ -261,7 +256,6 @@ DoShellPrompt ( @param Buffer Something to pass to FreePool when the shell is exiting. **/ VOID* -EFIAPI AddBufferToFreeList( VOID *Buffer ); @@ -272,7 +266,6 @@ AddBufferToFreeList( @param Buffer[in] The line buffer to add. **/ VOID -EFIAPI AddLineToCommandHistory( IN CONST CHAR16 *Buffer ); @@ -288,36 +281,38 @@ AddLineToCommandHistory( @retval EFI_ABORTED the command's operation was aborted **/ EFI_STATUS -EFIAPI RunCommand( IN CONST CHAR16 *CmdLine ); /** - Function determins if the CommandName COULD be a valid command. It does not determine whether - this is a valid command. It only checks for invalid characters. + Function will process and run a command line. - @param[in] CommandName The name to check + This will determine if the command line represents an internal shell + command or dispatch an external application. - @retval TRUE CommandName could be a command name - @retval FALSE CommandName could not be a valid command name + @param[in] CmdLine The command line to parse. + @param[out] CommandStatus The status from the command line. + + @retval EFI_SUCCESS The command was completed. + @retval EFI_ABORTED The command's operation was aborted. **/ -BOOLEAN -EFIAPI -IsValidCommandName( - IN CONST CHAR16 *CommandName +EFI_STATUS +RunShellCommand( + IN CONST CHAR16 *CmdLine, + OUT EFI_STATUS *CommandStatus ); + /** Function to process a NSH script file via SHELL_FILE_HANDLE. @param[in] Handle The handle to the already opened file. @param[in] Name The name of the script file. - @retval EFI_SUCCESS the script completed sucessfully + @retval EFI_SUCCESS the script completed successfully **/ EFI_STATUS -EFIAPI RunScriptFileHandle ( IN SHELL_FILE_HANDLE Handle, IN CONST CHAR16 *Name @@ -331,10 +326,9 @@ RunScriptFileHandle ( @param[in] CmdLine the command line to run. @param[in] ParamProtocol the shell parameters protocol pointer - @retval EFI_SUCCESS the script completed sucessfully + @retval EFI_SUCCESS the script completed successfully **/ EFI_STATUS -EFIAPI RunScriptFile ( IN CONST CHAR16 *ScriptPath, IN SHELL_FILE_HANDLE Handle OPTIONAL, @@ -343,7 +337,7 @@ RunScriptFile ( ); /** - Return the pointer to the first occurance of any character from a list of characters. + Return the pointer to the first occurrence of any character from a list of characters. @param[in] String the string to parse @param[in] CharacterList the list of character to look for @@ -353,12 +347,44 @@ RunScriptFile ( @retval CHAR_NULL no instance of any character in CharacterList was found in String **/ CONST CHAR16* -EFIAPI FindFirstCharacter( IN CONST CHAR16 *String, IN CONST CHAR16 *CharacterList, IN CONST CHAR16 EscapeCharacter ); +/** + Cleans off leading and trailing spaces and tabs. + + @param[in] String pointer to the string to trim them off. +**/ +EFI_STATUS +TrimSpaces( + IN CHAR16 **String + ); + +/** + + Create a new buffer list and stores the old one to OldBufferList + + @param OldBufferList The temporary list head used to store the nodes in BufferToFreeList. +**/ +VOID +SaveBufferList ( + OUT LIST_ENTRY *OldBufferList + ); + +/** + Restore previous nodes into BufferToFreeList . + + @param OldBufferList The temporary list head used to store the nodes in BufferToFreeList. +**/ +VOID +RestoreBufferList ( + IN OUT LIST_ENTRY *OldBufferList + ); + + + #endif //_SHELL_INTERNAL_HEADER_