ShellPkg: Clean up source files

1. Do not use tab characters
2. No trailing white space in one line
3. All files must end with CRLF

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
Liming Gao
2018-06-27 21:13:38 +08:00
parent 24bfed691d
commit ba0014b9f8
133 changed files with 1886 additions and 1886 deletions

View File

@ -1,7 +1,7 @@
/** @file
This is THE shell (application)
Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2013-2014 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
@ -104,7 +104,7 @@ TrimSpaces(
}
/**
Parse for the next instance of one string within another string. Can optionally make sure that
Parse for the next instance of one string within another string. Can optionally make sure that
the string was not escaped (^ character) per the shell specification.
@param[in] SourceString The string to search within
@ -160,13 +160,13 @@ IsValidEnvironmentVariableName(
)
{
CONST CHAR16 *Walker;
Walker = NULL;
ASSERT (BeginPercent != NULL);
ASSERT (EndPercent != NULL);
ASSERT (BeginPercent < EndPercent);
if ((BeginPercent + 1) == EndPercent) {
return FALSE;
}
@ -212,9 +212,9 @@ ContainsSplit(
SecondQuote = NULL;
TempSpot = FindFirstCharacter(CmdLine, L"|", L'^');
if (FirstQuote == NULL ||
TempSpot == NULL ||
TempSpot == CHAR_NULL ||
if (FirstQuote == NULL ||
TempSpot == NULL ||
TempSpot == CHAR_NULL ||
FirstQuote > TempSpot
) {
return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
@ -223,7 +223,7 @@ ContainsSplit(
while ((TempSpot != NULL) && (*TempSpot != CHAR_NULL)) {
if (FirstQuote == NULL || FirstQuote > TempSpot) {
break;
}
}
SecondQuote = FindNextInstance (FirstQuote + 1, L"\"", TRUE);
if (SecondQuote == NULL) {
break;
@ -235,14 +235,14 @@ ContainsSplit(
FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);
TempSpot = FindFirstCharacter(TempSpot + 1, L"|", L'^');
continue;
}
}
}
return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
}
/**
Function to start monitoring for CTRL-S using SimpleTextInputEx. This
Function to start monitoring for CTRL-S using SimpleTextInputEx. This
feature's enabled state was not known when the shell initially launched.
@retval EFI_SUCCESS The feature is enabled.
@ -266,8 +266,8 @@ InternalEfiShellStartCtrlSMonitor(
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(
-1,
-1,
-1,
-1,
NULL,
STRING_TOKEN (STR_SHELL_NO_IN_EX),
ShellInfoObject.HiiHandle);
@ -284,7 +284,7 @@ InternalEfiShellStartCtrlSMonitor(
&KeyData,
NotificationFunction,
&ShellInfoObject.CtrlSNotifyHandle1);
KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
if (!EFI_ERROR(Status)) {
Status = SimpleEx->RegisterKeyNotify(
@ -302,7 +302,7 @@ InternalEfiShellStartCtrlSMonitor(
&KeyData,
NotificationFunction,
&ShellInfoObject.CtrlSNotifyHandle3);
}
}
KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
if (!EFI_ERROR(Status)) {
Status = SimpleEx->RegisterKeyNotify(
@ -1129,7 +1129,7 @@ ProcessCommandLine(
/**
Function try to find location of the Startup.nsh file.
The buffer is callee allocated and should be freed by the caller.
@param ImageDevicePath The path to the image for shell. first place to look for the startup script
@ -1156,7 +1156,7 @@ LocateStartupScript (
// Try to find 'Startup.nsh' in the directory where the shell itself was launched.
//
MapName = ShellInfoObject.NewEfiShellProtocol->GetMapFromDevicePath (&ImageDevicePath);
if (MapName != NULL) {
if (MapName != NULL) {
StartupScriptPath = StrnCatGrow (&StartupScriptPath, &Size, MapName, 0);
if (StartupScriptPath == NULL) {
//
@ -1387,7 +1387,7 @@ AddBufferToFreeList (
/**
Create a new buffer list and stores the old one to OldBufferList
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.
**/
@ -1432,7 +1432,7 @@ AddLineToCommandHistory(
Count = 0;
MaxHistoryCmdCount = PcdGet16(PcdShellMaxHistoryCommandCount);
if (MaxHistoryCmdCount == 0) {
return ;
}
@ -1546,7 +1546,7 @@ StripUnreplacedEnvironmentVariables(
}
continue;
}
if (FirstQuote == NULL || SecondPercent < FirstQuote) {
if (IsValidEnvironmentVariableName(FirstPercent, SecondPercent)) {
//
@ -1662,16 +1662,16 @@ ShellConvertVariables (
; MasterEnvList != NULL && *MasterEnvList != CHAR_NULL
; MasterEnvList += StrLen(MasterEnvList) + 1
){
StrCpyS( ItemTemp,
((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)),
StrCpyS( ItemTemp,
((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)),
L"%"
);
StrCatS( ItemTemp,
((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)),
StrCatS( ItemTemp,
((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)),
MasterEnvList
);
StrCatS( ItemTemp,
((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)),
StrCatS( ItemTemp,
((ItemSize+(2*sizeof(CHAR16)))/sizeof(CHAR16)),
L"%"
);
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, ItemTemp, EfiShellGetEnv(MasterEnvList), TRUE, FALSE);
@ -1697,7 +1697,7 @@ ShellConvertVariables (
//
ShellCopySearchAndReplace(NewCommandLine1, NewCommandLine2, NewSize, L"^%", L"%", TRUE, FALSE);
StrCpyS(NewCommandLine1, NewSize/sizeof(CHAR16), NewCommandLine2);
FreePool(NewCommandLine2);
FreePool(ItemTemp);
@ -1823,7 +1823,7 @@ RunSplitCommand(
}
/**
Take the original command line, substitute any variables, free
Take the original command line, substitute any variables, free
the original string, return the modified copy.
@param[in] CmdLine pointer to the command line to update.
@ -1847,7 +1847,7 @@ ShellSubstituteVariables(
}
/**
Take the original command line, substitute any alias in the first group of space delimited characters, free
Take the original command line, substitute any alias in the first group of space delimited characters, free
the original string, return the modified copy.
@param[in] CmdLine pointer to the command line to update.
@ -1906,7 +1906,7 @@ ShellSubstituteAliases(
SHELL_FREE_NON_NULL(*CmdLine);
SHELL_FREE_NON_NULL(CommandName);
//
// re-assign the passed in double pointer to point to our newly allocated buffer
//
@ -1919,7 +1919,7 @@ ShellSubstituteAliases(
Takes the Argv[0] part of the command line and determine the meaning of it.
@param[in] CmdName pointer to the command line to update.
@retval Internal_Command The name is an internal command.
@retval File_Sys_Change the name is a file system change.
@retval Script_File_Name the name is a NSH script file.
@ -1947,7 +1947,7 @@ GetOperationType(
// Test for file system change request. anything ending with first : and cant have spaces.
//
if (CmdName[(StrLen(CmdName)-1)] == L':') {
if ( StrStr(CmdName, L" ") != NULL
if ( StrStr(CmdName, L" ") != NULL
|| StrLen(StrStr(CmdName, L":")) > 1
) {
return (Unknown_Invalid);
@ -1977,7 +1977,7 @@ GetOperationType(
SHELL_FREE_NON_NULL(FileWithPath);
return (Efi_Application);
}
SHELL_FREE_NON_NULL(FileWithPath);
//
// No clue what this is... return invalid flag...
@ -1994,7 +1994,7 @@ GetOperationType(
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@retval EFI_NOT_FOUND The operation type is unknown or invalid.
**/
EFI_STATUS
EFI_STATUS
IsValidSplit(
IN CONST CHAR16 *CmdLine
)
@ -2079,13 +2079,13 @@ VerifySplit(
// recurse to verify the next item
//
TempSpot = FindFirstCharacter(CmdLine, L"|", L'^') + 1;
if (*TempSpot == L'a' &&
if (*TempSpot == L'a' &&
(*(TempSpot + 1) == L' ' || *(TempSpot + 1) == CHAR_NULL)
) {
// If it's an ASCII pipe '|a'
TempSpot += 1;
}
return (VerifySplit(TempSpot));
}
@ -2149,7 +2149,7 @@ ChangeMappedDrive(
// make sure we are the right operation
//
ASSERT(CmdLine[(StrLen(CmdLine)-1)] == L':' && StrStr(CmdLine, L" ") == NULL);
//
// Call the protocol API to do the work
//
@ -2294,7 +2294,7 @@ ProcessCommandLineToFinal(
Run an internal shell command.
This API will update the shell's environment since these commands are libraries.
@param[in] CmdLine the command line to run.
@param[in] FirstParameter the first parameter on the command line
@param[in] ParamProtocol the shell parameters protocol pointer
@ -2317,7 +2317,7 @@ RunInternalCommand(
SHELL_STATUS CommandReturnedStatus;
BOOLEAN LastError;
CHAR16 *Walker;
CHAR16 *NewCmdLine;
CHAR16 *NewCmdLine;
NewCmdLine = AllocateCopyPool (StrSize (CmdLine), CmdLine);
if (NewCmdLine == NULL) {
@ -2597,7 +2597,7 @@ SetupAndRunCommandOrFile(
/**
Function will process and run a command line.
This will determine if the command line represents an internal shell
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.
@ -2673,7 +2673,7 @@ RunShellCommand(
Status = ProcessNewSplitCommandLine(CleanOriginal);
SHELL_FREE_NON_NULL(CleanOriginal);
return (Status);
}
}
//
// We need the first parameter information so we can determine the operation type
@ -2734,7 +2734,7 @@ RunShellCommand(
/**
Function will process and run a command line.
This will determine if the command line represents an internal shell
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.
@ -2907,8 +2907,8 @@ RunScriptFileHandle (
; // conditional increment in the body of the loop
){
ASSERT(CommandLine2 != NULL);
StrnCpyS( CommandLine2,
PrintBuffSize/sizeof(CHAR16),
StrnCpyS( CommandLine2,
PrintBuffSize/sizeof(CHAR16),
NewScriptFile->CurrentCommand->Cl,
PrintBuffSize/sizeof(CHAR16) - 1
);
@ -2934,8 +2934,8 @@ RunScriptFileHandle (
//
// Due to variability in starting the find and replace action we need to have both buffers the same.
//
StrnCpyS( CommandLine,
PrintBuffSize/sizeof(CHAR16),
StrnCpyS( CommandLine,
PrintBuffSize/sizeof(CHAR16),
CommandLine2,
PrintBuffSize/sizeof(CHAR16) - 1
);
@ -2990,8 +2990,8 @@ RunScriptFileHandle (
Status = ShellCopySearchAndReplace(CommandLine, CommandLine2, PrintBuffSize, L"%8", L"\"\"", FALSE, FALSE);
Status = ShellCopySearchAndReplace(CommandLine2, CommandLine, PrintBuffSize, L"%9", L"\"\"", FALSE, FALSE);
StrnCpyS( CommandLine2,
PrintBuffSize/sizeof(CHAR16),
StrnCpyS( CommandLine2,
PrintBuffSize/sizeof(CHAR16),
CommandLine,
PrintBuffSize/sizeof(CHAR16) - 1
);