MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / TrimSpaces

Function TrimSpaces

ShellPkg/Application/Shell/Shell.c:82–107  ·  view source on GitHub ↗

Cleans off leading and trailing spaces and tabs. @param[in] String pointer to the string to trim them off. **/

Source from the content-addressed store, hash-verified

80 @param[in] String pointer to the string to trim them off.
81**/
82EFI_STATUS
83TrimSpaces(
84 IN CHAR16 **String
85 )
86{
87// ASSERT(String != NULL);
88// ASSERT(*String!= NULL);
89 if (!String || !(*String)) {
90 return EFI_INVALID_PARAMETER;
91 }
92 //
93 // Remove any spaces and tabs at the beginning of the (*String).
94 //
95 while (((*String)[0] == L' ') || ((*String)[0] == L'\t')) {
96 CopyMem((*String), (*String)+1, StrSize((*String)) - sizeof((*String)[0]));
97 }
98
99 //
100 // Remove any spaces and tabs at the end of the (*String).
101 //
102 while ((StrLen (*String) > 0) && (((*String)[StrLen((*String))-1] == L' ') || ((*String)[StrLen((*String))-1] == L'\t'))) {
103 (*String)[StrLen((*String))-1] = CHAR_NULL;
104 }
105
106 return (EFI_SUCCESS);
107}
108
109/**
110 Parse for the next instance of one string within another string. Can optionally make sure that

Callers 4

ParseCommandLineToArgsFunction · 0.85
SetupAndRunCommandOrFileFunction · 0.85
RunShellCommandFunction · 0.85

Calls 3

CopyMemFunction · 0.50
StrSizeFunction · 0.50
StrLenFunction · 0.50

Tested by

no test coverage detected