X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FApplication%2FShell%2FShell.h;h=25ac114da71d3f398d5e4b6feb3438eb00cfab93;hb=28165f245f26bad4dae86cda3d17458726a9a82f;hp=4fadab15e2ff4c4853ee39ff80cabba34335ac1f;hpb=00534bc3e2d49bbf3cb649136eed3f6891121114;p=mirror_edk2.git diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shell/Shell.h index 4fadab15e2..25ac114da7 100644 --- a/ShellPkg/Application/Shell/Shell.h +++ b/ShellPkg/Application/Shell/Shell.h @@ -1,8 +1,8 @@ /** @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.
+ (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
+ Copyright (c) 2009 - 2016, 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 @@ -17,18 +17,18 @@ #define _SHELL_INTERNAL_HEADER_ #include -#include #include #include #include #include -#include +#include #include #include -#include +#include #include +#include #include #include @@ -47,6 +47,7 @@ #include #include #include +#include #include "ShellParametersProtocol.h" #include "ShellProtocol.h" @@ -56,6 +57,10 @@ #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. @@ -71,7 +76,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,15 +128,17 @@ 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. @@ -139,10 +147,9 @@ typedef enum { @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 +160,6 @@ ProcessCommandLineToFinal( @param[in] ErrorCode the error code to put into lasterror **/ EFI_STATUS -EFIAPI SetLastError( IN CONST SHELL_STATUS ErrorCode ); @@ -161,10 +167,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 +180,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 +222,6 @@ GetDevicePathsForImageAndFile ( @retval EFI_SUCCESS the variable is initialized. **/ EFI_STATUS -EFIAPI ProcessCommandLine( VOID ); @@ -234,7 +237,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 +251,6 @@ DoStartupScript( @retval RETURN_ABORTED **/ EFI_STATUS -EFIAPI DoShellPrompt ( VOID ); @@ -261,7 +262,6 @@ DoShellPrompt ( @param Buffer Something to pass to FreePool when the shell is exiting. **/ VOID* -EFIAPI AddBufferToFreeList( VOID *Buffer ); @@ -272,7 +272,6 @@ AddBufferToFreeList( @param Buffer[in] The line buffer to add. **/ VOID -EFIAPI AddLineToCommandHistory( IN CONST CHAR16 *Buffer ); @@ -288,13 +287,30 @@ 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 + Function will process and run a command line. + + This will determine if the command line represents an internal shell + command or dispatch an external application. + + @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. +**/ +EFI_STATUS +RunShellCommand( + IN CONST CHAR16 *CmdLine, + OUT EFI_STATUS *CommandStatus + ); + +/** + Function determines if the CommandName COULD be a valid command. It does not determine whether this is a valid command. It only checks for invalid characters. @param[in] CommandName The name to check @@ -303,7 +319,6 @@ RunCommand( @retval FALSE CommandName could not be a valid command name **/ BOOLEAN -EFIAPI IsValidCommandName( IN CONST CHAR16 *CommandName ); @@ -314,10 +329,9 @@ IsValidCommandName( @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 +345,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 +356,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 +366,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_