EFI_HII_HANDLE mShellManHiiHandle = NULL;\r
EFI_HANDLE mShellManDriverHandle = NULL;\r
\r
-\r
SHELL_MAN_HII_VENDOR_DEVICE_PATH mShellManHiiDevicePath = {\r
{\r
{\r
HARDWARE_DEVICE_PATH,\r
HW_VENDOR_DP,\r
{\r
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),\r
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
}\r
},\r
SHELL_MAN_HII_GUID\r
END_DEVICE_PATH_TYPE,\r
END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
{\r
- (UINT8) (END_DEVICE_PATH_LENGTH),\r
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
+ (UINT8)(END_DEVICE_PATH_LENGTH),\r
+ (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)\r
}\r
}\r
};\r
**/\r
CHAR16 *\r
GetExecuatableFileName (\r
- IN CONST CHAR16 *NameString\r
+ IN CONST CHAR16 *NameString\r
)\r
{\r
CHAR16 *Buffer;\r
CHAR16 *SuffixStr;\r
+\r
if (NameString == NULL) {\r
return (NULL);\r
}\r
//\r
// Fix the file name\r
//\r
- if (StrnCmp(NameString+StrLen(NameString)-StrLen(L".efi"), L".efi", StrLen(L".efi"))==0) {\r
- Buffer = AllocateCopyPool(StrSize(NameString), NameString);\r
- } else if (StrnCmp(NameString+StrLen(NameString)-StrLen(L".man"), L".man", StrLen(L".man"))==0) {\r
- Buffer = AllocateCopyPool(StrSize(NameString), NameString);\r
+ if (StrnCmp (NameString+StrLen (NameString)-StrLen (L".efi"), L".efi", StrLen (L".efi")) == 0) {\r
+ Buffer = AllocateCopyPool (StrSize (NameString), NameString);\r
+ } else if (StrnCmp (NameString+StrLen (NameString)-StrLen (L".man"), L".man", StrLen (L".man")) == 0) {\r
+ Buffer = AllocateCopyPool (StrSize (NameString), NameString);\r
if (Buffer != NULL) {\r
- SuffixStr = Buffer+StrLen(Buffer)-StrLen(L".man");\r
- StrnCpyS (SuffixStr, StrSize(L".man")/sizeof(CHAR16), L".efi", StrLen(L".efi"));\r
+ SuffixStr = Buffer+StrLen (Buffer)-StrLen (L".man");\r
+ StrnCpyS (SuffixStr, StrSize (L".man")/sizeof (CHAR16), L".efi", StrLen (L".efi"));\r
}\r
} else {\r
- Buffer = AllocateZeroPool(StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16));\r
+ Buffer = AllocateZeroPool (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16));\r
if (Buffer != NULL) {\r
- StrnCpyS( Buffer,\r
- (StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16))/sizeof(CHAR16),\r
- NameString,\r
- StrLen(NameString)\r
- );\r
- StrnCatS( Buffer,\r
- (StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16))/sizeof(CHAR16),\r
- L".efi",\r
- StrLen(L".efi")\r
- );\r
+ StrnCpyS (\r
+ Buffer,\r
+ (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),\r
+ NameString,\r
+ StrLen (NameString)\r
+ );\r
+ StrnCatS (\r
+ Buffer,\r
+ (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),\r
+ L".efi",\r
+ StrLen (L".efi")\r
+ );\r
}\r
}\r
- return (Buffer);\r
\r
+ return (Buffer);\r
}\r
\r
/**\r
@return the new filename with .man as the extension.\r
**/\r
CHAR16 *\r
-GetManFileName(\r
- IN CONST CHAR16 *ManFileName\r
+GetManFileName (\r
+ IN CONST CHAR16 *ManFileName\r
)\r
{\r
- CHAR16 *Buffer;\r
+ CHAR16 *Buffer;\r
+\r
if (ManFileName == NULL) {\r
return (NULL);\r
}\r
+\r
//\r
// Fix the file name\r
//\r
- if (StrnCmp(ManFileName+StrLen(ManFileName)-4, L".man", 4)==0) {\r
- Buffer = AllocateCopyPool(StrSize(ManFileName), ManFileName);\r
+ if (StrnCmp (ManFileName+StrLen (ManFileName)-4, L".man", 4) == 0) {\r
+ Buffer = AllocateCopyPool (StrSize (ManFileName), ManFileName);\r
} else {\r
- Buffer = AllocateZeroPool(StrSize(ManFileName) + 4*sizeof(CHAR16));\r
+ Buffer = AllocateZeroPool (StrSize (ManFileName) + 4*sizeof (CHAR16));\r
if (Buffer != NULL) {\r
- StrnCpyS( Buffer,\r
- (StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16),\r
- ManFileName,\r
- StrLen(ManFileName)\r
- );\r
- StrnCatS( Buffer,\r
- (StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16),\r
- L".man",\r
- 4\r
- );\r
+ StrnCpyS (\r
+ Buffer,\r
+ (StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),\r
+ ManFileName,\r
+ StrLen (ManFileName)\r
+ );\r
+ StrnCatS (\r
+ Buffer,\r
+ (StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),\r
+ L".man",\r
+ 4\r
+ );\r
}\r
}\r
+\r
return (Buffer);\r
}\r
\r
@retval EFI_NOT_FOUND The file was not found.\r
**/\r
EFI_STATUS\r
-SearchPathForFile(\r
- IN CONST CHAR16 *FileName,\r
- OUT SHELL_FILE_HANDLE *Handle\r
+SearchPathForFile (\r
+ IN CONST CHAR16 *FileName,\r
+ OUT SHELL_FILE_HANDLE *Handle\r
)\r
{\r
- CHAR16 *FullFileName;\r
- EFI_STATUS Status;\r
+ CHAR16 *FullFileName;\r
+ EFI_STATUS Status;\r
\r
- if ( FileName == NULL\r
- || Handle == NULL\r
- || StrLen(FileName) == 0\r
- ){\r
+ if ( (FileName == NULL)\r
+ || (Handle == NULL)\r
+ || (StrLen (FileName) == 0)\r
+ )\r
+ {\r
return (EFI_INVALID_PARAMETER);\r
}\r
\r
- FullFileName = ShellFindFilePath(FileName);\r
+ FullFileName = ShellFindFilePath (FileName);\r
if (FullFileName == NULL) {\r
return (EFI_NOT_FOUND);\r
}\r
//\r
// now open that file\r
//\r
- Status = EfiShellOpenFileByName(FullFileName, Handle, EFI_FILE_MODE_READ);\r
- FreePool(FullFileName);\r
+ Status = EfiShellOpenFileByName (FullFileName, Handle, EFI_FILE_MODE_READ);\r
+ FreePool (FullFileName);\r
\r
return (Status);\r
}\r
an allocated buffer.\r
**/\r
EFI_STATUS\r
-ManFileFindSections(\r
+ManFileFindSections (\r
IN SHELL_FILE_HANDLE Handle,\r
IN CONST CHAR16 *Sections,\r
OUT CHAR16 **HelpText,\r
IN BOOLEAN Ascii\r
)\r
{\r
- EFI_STATUS Status;\r
- CHAR16 *ReadLine;\r
- UINTN Size;\r
- BOOLEAN CurrentlyReading;\r
- CHAR16 *SectionName;\r
- UINTN SectionLen;\r
- BOOLEAN Found;\r
-\r
- if ( Handle == NULL\r
- || HelpText == NULL\r
- || HelpSize == NULL\r
- ){\r
+ EFI_STATUS Status;\r
+ CHAR16 *ReadLine;\r
+ UINTN Size;\r
+ BOOLEAN CurrentlyReading;\r
+ CHAR16 *SectionName;\r
+ UINTN SectionLen;\r
+ BOOLEAN Found;\r
+\r
+ if ( (Handle == NULL)\r
+ || (HelpText == NULL)\r
+ || (HelpSize == NULL)\r
+ )\r
+ {\r
return (EFI_INVALID_PARAMETER);\r
}\r
\r
- Status = EFI_SUCCESS;\r
- CurrentlyReading = FALSE;\r
- Size = 1024;\r
- Found = FALSE;\r
+ Status = EFI_SUCCESS;\r
+ CurrentlyReading = FALSE;\r
+ Size = 1024;\r
+ Found = FALSE;\r
\r
- ReadLine = AllocateZeroPool(Size);\r
+ ReadLine = AllocateZeroPool (Size);\r
if (ReadLine == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
\r
- for (;!ShellFileHandleEof(Handle);Size = 1024) {\r
- Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, &Ascii);\r
+ for ( ; !ShellFileHandleEof (Handle); Size = 1024) {\r
+ Status = ShellFileHandleReadLine (Handle, ReadLine, &Size, TRUE, &Ascii);\r
if (ReadLine[0] == L'#') {\r
//\r
// Skip comment lines\r
//\r
continue;\r
}\r
+\r
//\r
// ignore too small of buffer...\r
//\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
Status = EFI_SUCCESS;\r
}\r
- if (EFI_ERROR(Status)) {\r
+\r
+ if (EFI_ERROR (Status)) {\r
break;\r
- } else if (StrnCmp(ReadLine, L".TH", 3) == 0) {\r
+ } else if (StrnCmp (ReadLine, L".TH", 3) == 0) {\r
//\r
// we hit the end of this commands section so stop.\r
//\r
break;\r
- } else if (StrnCmp(ReadLine, L".SH", 3) == 0) {\r
+ } else if (StrnCmp (ReadLine, L".SH", 3) == 0) {\r
if (Sections == NULL) {\r
CurrentlyReading = TRUE;\r
continue;\r
}\r
+\r
//\r
// we found a section\r
//\r
if (CurrentlyReading) {\r
CurrentlyReading = FALSE;\r
}\r
+\r
//\r
// is this a section we want to read in?\r
//\r
for ( SectionName = ReadLine + 3\r
- ; *SectionName == L' '\r
- ; SectionName++);\r
- SectionLen = StrLen(SectionName);\r
- SectionName = StrStr(Sections, SectionName);\r
+ ; *SectionName == L' '\r
+ ; SectionName++)\r
+ {\r
+ }\r
+\r
+ SectionLen = StrLen (SectionName);\r
+ SectionName = StrStr (Sections, SectionName);\r
if (SectionName == NULL) {\r
continue;\r
}\r
- if (*(SectionName + SectionLen) == CHAR_NULL || *(SectionName + SectionLen) == L',') {\r
+\r
+ if ((*(SectionName + SectionLen) == CHAR_NULL) || (*(SectionName + SectionLen) == L',')) {\r
CurrentlyReading = TRUE;\r
}\r
} else if (CurrentlyReading) {\r
//\r
// copy and save the current line.\r
//\r
- ASSERT((*HelpText == NULL && *HelpSize == 0) || (*HelpText != NULL));\r
+ ASSERT ((*HelpText == NULL && *HelpSize == 0) || (*HelpText != NULL));\r
StrnCatGrow (HelpText, HelpSize, ReadLine, 0);\r
StrnCatGrow (HelpText, HelpSize, L"\r\n", 0);\r
}\r
}\r
- FreePool(ReadLine);\r
- if (!Found && !EFI_ERROR(Status)) {\r
+\r
+ FreePool (ReadLine);\r
+ if (!Found && !EFI_ERROR (Status)) {\r
return (EFI_NOT_FOUND);\r
}\r
+\r
return (Status);\r
}\r
\r
@retval FALSE Line did not contain the Title Header\r
**/\r
BOOLEAN\r
-IsTitleHeader(\r
- IN CONST CHAR16 *Command,\r
- IN CHAR16 *Line,\r
- OUT CHAR16 **BriefDesc OPTIONAL,\r
- OUT UINTN *BriefSize OPTIONAL,\r
- OUT BOOLEAN *Found\r
+IsTitleHeader (\r
+ IN CONST CHAR16 *Command,\r
+ IN CHAR16 *Line,\r
+ OUT CHAR16 **BriefDesc OPTIONAL,\r
+ OUT UINTN *BriefSize OPTIONAL,\r
+ OUT BOOLEAN *Found\r
)\r
{\r
// The states of a simple state machine used to recognize a title header line\r
BOOLEAN ReturnValue; // TRUE if this the Title Header line of *some* MAN file.\r
BOOLEAN ReturnFound; // TRUE if this the Title Header line of *the desired* MAN file.\r
\r
- ReturnValue = FALSE;\r
- ReturnFound = FALSE;\r
+ ReturnValue = FALSE;\r
+ ReturnFound = FALSE;\r
CommandIndex = 0;\r
- State = LookForThMacro;\r
+ State = LookForThMacro;\r
\r
do {\r
-\r
if (*Line == L'\0') {\r
break;\r
}\r
\r
switch (State) {\r
-\r
// Handle "^\s*.TH\s"\r
// Go to state LookForCommandName if the title header macro is present; otherwise,\r
// eat white space. If we see something other than white space, this is not a\r
// title header line.\r
case LookForThMacro:\r
- if (StrnCmp (L".TH ", Line, 4) == 0 || StrnCmp (L".TH\t", Line, 4) == 0) {\r
+ if ((StrnCmp (L".TH ", Line, 4) == 0) || (StrnCmp (L".TH\t", Line, 4) == 0)) {\r
Line += 4;\r
State = LookForCommandName;\r
- }\r
- else if (*Line == L' ' || *Line == L'\t') {\r
+ } else if ((*Line == L' ') || (*Line == L'\t')) {\r
Line++;\r
- }\r
- else {\r
+ } else {\r
State = Final;\r
}\r
- break;\r
+\r
+ break;\r
\r
// Handle "\s*"\r
// Eat any "extra" whitespace after the title header macro (we have already seen\r
// at least one white space character). Go to state CompareCommands when a\r
// non-white space is seen.\r
case LookForCommandName:\r
- if (*Line == L' ' || *Line == L'\t') {\r
+ if ((*Line == L' ') || (*Line == L'\t')) {\r
Line++;\r
- }\r
- else {\r
+ } else {\r
ReturnValue = TRUE; // This is *some* command's title header line.\r
- State = CompareCommands;\r
+ State = CompareCommands;\r
// Do not increment Line; it points to the first character of the command\r
// name on the title header line.\r
}\r
- break;\r
+\r
+ break;\r
\r
// Handle "(\S)\s"\r
// Compare Command to the title header command name, ignoring case. When we\r
// reach the end of the command (i.e. we see white space), the next state\r
// depends on whether the caller wants a copy of the Brief Description.\r
case CompareCommands:\r
- if (*Line == L' ' || *Line == L'\t') {\r
+ if ((*Line == L' ') || (*Line == L'\t')) {\r
ReturnFound = TRUE; // This is the desired command's title header line.\r
- State = (BriefDesc == NULL) ? Final : GetBriefDescription;\r
- }\r
- else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {\r
+ State = (BriefDesc == NULL) ? Final : GetBriefDescription;\r
+ } else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {\r
State = Final;\r
}\r
+\r
Line++;\r
- break;\r
+ break;\r
\r
// Handle "[\s01]*(.*)$"\r
// Skip whitespace, '0', and '1' characters, if any, prior to the brief description.\r
// Return the description to the caller.\r
case GetBriefDescription:\r
- if (*Line != L' ' && *Line != L'\t' && *Line != L'0' && *Line != L'1') {\r
- *BriefSize = StrSize(Line);\r
- *BriefDesc = AllocateZeroPool(*BriefSize);\r
+ if ((*Line != L' ') && (*Line != L'\t') && (*Line != L'0') && (*Line != L'1')) {\r
+ *BriefSize = StrSize (Line);\r
+ *BriefDesc = AllocateZeroPool (*BriefSize);\r
if (*BriefDesc != NULL) {\r
- StrCpyS(*BriefDesc, (*BriefSize)/sizeof(CHAR16), Line);\r
+ StrCpyS (*BriefDesc, (*BriefSize)/sizeof (CHAR16), Line);\r
}\r
+\r
State = Final;\r
}\r
+\r
Line++;\r
- break;\r
+ break;\r
\r
default:\r
- break;\r
+ break;\r
}\r
-\r
} while (State < Final);\r
\r
*Found = ReturnFound;\r
an allocated buffer if requested.\r
**/\r
EFI_STATUS\r
-ManFileFindTitleSection(\r
+ManFileFindTitleSection (\r
IN SHELL_FILE_HANDLE Handle,\r
IN CONST CHAR16 *Command,\r
OUT CHAR16 **BriefDesc OPTIONAL,\r
BOOLEAN Found;\r
UINTN Start;\r
\r
- if ( Handle == NULL\r
- || Command == NULL\r
- || (BriefDesc != NULL && BriefSize == NULL)\r
- ){\r
+ if ( (Handle == NULL)\r
+ || (Command == NULL)\r
+ || ((BriefDesc != NULL) && (BriefSize == NULL))\r
+ )\r
+ {\r
return (EFI_INVALID_PARAMETER);\r
}\r
\r
- Status = EFI_SUCCESS;\r
- Size = 1024;\r
- Found = FALSE;\r
+ Status = EFI_SUCCESS;\r
+ Size = 1024;\r
+ Found = FALSE;\r
\r
- ReadLine = AllocateZeroPool(Size);\r
+ ReadLine = AllocateZeroPool (Size);\r
if (ReadLine == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
//\r
// Do not pass any leading path information that may be present to IsTitleHeader().\r
//\r
- Start = StrLen(Command);\r
- while ((Start != 0)\r
- && (*(Command + Start - 1) != L'\\')\r
- && (*(Command + Start - 1) != L'/')\r
- && (*(Command + Start - 1) != L':')) {\r
+ Start = StrLen (Command);\r
+ while ( (Start != 0)\r
+ && (*(Command + Start - 1) != L'\\')\r
+ && (*(Command + Start - 1) != L'/')\r
+ && (*(Command + Start - 1) != L':'))\r
+ {\r
--Start;\r
}\r
\r
- for (;!ShellFileHandleEof(Handle);Size = 1024) {\r
- Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, Ascii);\r
+ for ( ; !ShellFileHandleEof (Handle); Size = 1024) {\r
+ Status = ShellFileHandleReadLine (Handle, ReadLine, &Size, TRUE, Ascii);\r
//\r
// ignore too small of buffer...\r
//\r
- if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) {\r
+ if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {\r
break;\r
}\r
\r
}\r
}\r
\r
- FreePool(ReadLine);\r
+ FreePool (ReadLine);\r
return (Status);\r
}\r
\r
@retval EFI_NOT_FOUND There is no help text available for Command.\r
**/\r
EFI_STATUS\r
-ProcessManFile(\r
- IN CONST CHAR16 *ManFileName,\r
- IN CONST CHAR16 *Command,\r
- IN CONST CHAR16 *Sections OPTIONAL,\r
- OUT CHAR16 **BriefDesc OPTIONAL,\r
- OUT CHAR16 **HelpText\r
+ProcessManFile (\r
+ IN CONST CHAR16 *ManFileName,\r
+ IN CONST CHAR16 *Command,\r
+ IN CONST CHAR16 *Sections OPTIONAL,\r
+ OUT CHAR16 **BriefDesc OPTIONAL,\r
+ OUT CHAR16 **HelpText\r
)\r
{\r
- CHAR16 *TempString;\r
- SHELL_FILE_HANDLE FileHandle;\r
- EFI_HANDLE CmdFileImgHandle;\r
- EFI_STATUS Status;\r
- UINTN HelpSize;\r
- UINTN BriefSize;\r
- UINTN StringIdWalker;\r
- BOOLEAN Ascii;\r
- CHAR16 *CmdFileName;\r
- CHAR16 *CmdFilePathName;\r
- EFI_DEVICE_PATH_PROTOCOL *FileDevPath;\r
- EFI_DEVICE_PATH_PROTOCOL *DevPath;\r
- EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;\r
-\r
- if ( ManFileName == NULL\r
- || Command == NULL\r
- || HelpText == NULL\r
- ){\r
+ CHAR16 *TempString;\r
+ SHELL_FILE_HANDLE FileHandle;\r
+ EFI_HANDLE CmdFileImgHandle;\r
+ EFI_STATUS Status;\r
+ UINTN HelpSize;\r
+ UINTN BriefSize;\r
+ UINTN StringIdWalker;\r
+ BOOLEAN Ascii;\r
+ CHAR16 *CmdFileName;\r
+ CHAR16 *CmdFilePathName;\r
+ EFI_DEVICE_PATH_PROTOCOL *FileDevPath;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;\r
+ EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;\r
+\r
+ if ( (ManFileName == NULL)\r
+ || (Command == NULL)\r
+ || (HelpText == NULL)\r
+ )\r
+ {\r
return (EFI_INVALID_PARAMETER);\r
}\r
\r
//\r
// See if it's in HII first\r
//\r
- TempString = ShellCommandGetCommandHelp(Command);\r
+ TempString = ShellCommandGetCommandHelp (Command);\r
if (TempString != NULL) {\r
FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);\r
- HelpSize = StrLen (TempString) * sizeof (CHAR16);\r
+ HelpSize = StrLen (TempString) * sizeof (CHAR16);\r
ShellWriteFile (FileHandle, &HelpSize, TempString);\r
ShellSetFilePosition (FileHandle, 0);\r
HelpSize = 0;\r
BriefSize = 0;\r
- Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii);\r
- if (!EFI_ERROR(Status) && HelpText != NULL){\r
- Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii);\r
+ Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);\r
+ if (!EFI_ERROR (Status) && (HelpText != NULL)) {\r
+ Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);\r
}\r
+\r
ShellCloseFile (&FileHandle);\r
} else {\r
//\r
// If the image is a external app, check .MAN file first.\r
//\r
- FileHandle = NULL;\r
- TempString = GetManFileName(ManFileName);\r
+ FileHandle = NULL;\r
+ TempString = GetManFileName (ManFileName);\r
if (TempString == NULL) {\r
return (EFI_INVALID_PARAMETER);\r
}\r
\r
- Status = SearchPathForFile(TempString, &FileHandle);\r
- if (EFI_ERROR(Status)) {\r
- FileDevPath = FileDevicePath(NULL, TempString);\r
- DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, FileDevPath);\r
- Status = InternalOpenFileDevicePath(DevPath, &FileHandle, EFI_FILE_MODE_READ, 0);\r
- SHELL_FREE_NON_NULL(FileDevPath);\r
- SHELL_FREE_NON_NULL(DevPath);\r
+ Status = SearchPathForFile (TempString, &FileHandle);\r
+ if (EFI_ERROR (Status)) {\r
+ FileDevPath = FileDevicePath (NULL, TempString);\r
+ DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, FileDevPath);\r
+ Status = InternalOpenFileDevicePath (DevPath, &FileHandle, EFI_FILE_MODE_READ, 0);\r
+ SHELL_FREE_NON_NULL (FileDevPath);\r
+ SHELL_FREE_NON_NULL (DevPath);\r
}\r
\r
- if (!EFI_ERROR(Status)) {\r
+ if (!EFI_ERROR (Status)) {\r
HelpSize = 0;\r
BriefSize = 0;\r
- Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii);\r
- if (!EFI_ERROR(Status) && HelpText != NULL){\r
- Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii);\r
+ Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);\r
+ if (!EFI_ERROR (Status) && (HelpText != NULL)) {\r
+ Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);\r
}\r
- ShellInfoObject.NewEfiShellProtocol->CloseFile(FileHandle);\r
- if (!EFI_ERROR(Status)) {\r
+\r
+ ShellInfoObject.NewEfiShellProtocol->CloseFile (FileHandle);\r
+ if (!EFI_ERROR (Status)) {\r
//\r
// Get help text from .MAN file success.\r
//\r
//\r
// Load the app image to check EFI_HII_PACKAGE_LIST_PROTOCOL.\r
//\r
- CmdFileName = GetExecuatableFileName(TempString);\r
+ CmdFileName = GetExecuatableFileName (TempString);\r
if (CmdFileName == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
goto Done;\r
}\r
+\r
//\r
// If the file in CWD then use the file name, else use the full\r
// path name.\r
//\r
- CmdFilePathName = ShellFindFilePath(CmdFileName);\r
+ CmdFilePathName = ShellFindFilePath (CmdFileName);\r
if (CmdFilePathName == NULL) {\r
Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
- DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath(CmdFilePathName);\r
- Status = gBS->LoadImage(FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle);\r
- if(EFI_ERROR(Status)) {\r
+\r
+ DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath (CmdFilePathName);\r
+ Status = gBS->LoadImage (FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle);\r
+ if (EFI_ERROR (Status)) {\r
//\r
// With EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created\r
// with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.\r
if (Status == EFI_SECURITY_VIOLATION) {\r
gBS->UnloadImage (CmdFileImgHandle);\r
}\r
+\r
*HelpText = NULL;\r
goto Done;\r
}\r
- Status = gBS->OpenProtocol(\r
+\r
+ Status = gBS->OpenProtocol (\r
CmdFileImgHandle,\r
&gEfiHiiPackageListProtocolGuid,\r
- (VOID**)&PackageListHeader,\r
+ (VOID **)&PackageListHeader,\r
gImageHandle,\r
NULL,\r
EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
);\r
- if(EFI_ERROR(Status)) {\r
+ if (EFI_ERROR (Status)) {\r
*HelpText = NULL;\r
goto Done;\r
}\r
EFI_NATIVE_INTERFACE,\r
&mShellManHiiDevicePath\r
);\r
- if (EFI_ERROR(Status)) {\r
+ if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
\r
Status = gHiiDatabase->NewPackageList (\r
- gHiiDatabase,\r
- PackageListHeader,\r
- mShellManDriverHandle,\r
- &mShellManHiiHandle\r
- );\r
+ gHiiDatabase,\r
+ PackageListHeader,\r
+ mShellManDriverHandle,\r
+ &mShellManHiiHandle\r
+ );\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
\r
StringIdWalker = 1;\r
do {\r
- SHELL_FREE_NON_NULL(TempString);\r
- if (BriefDesc != NULL) {\r
- SHELL_FREE_NON_NULL(*BriefDesc);\r
- }\r
- TempString = HiiGetString (mShellManHiiHandle, (EFI_STRING_ID)StringIdWalker, NULL);\r
- if (TempString == NULL) {\r
- Status = EFI_NOT_FOUND;\r
- goto Done;\r
- }\r
- FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);\r
- HelpSize = StrLen (TempString) * sizeof (CHAR16);\r
- ShellWriteFile (FileHandle, &HelpSize, TempString);\r
- ShellSetFilePosition (FileHandle, 0);\r
- HelpSize = 0;\r
- BriefSize = 0;\r
- Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii);\r
- if (!EFI_ERROR(Status) && HelpText != NULL){\r
- Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii);\r
- }\r
- ShellCloseFile (&FileHandle);\r
- if (!EFI_ERROR(Status)){\r
- //\r
- // Found what we need and return\r
- //\r
- goto Done;\r
- }\r
+ SHELL_FREE_NON_NULL (TempString);\r
+ if (BriefDesc != NULL) {\r
+ SHELL_FREE_NON_NULL (*BriefDesc);\r
+ }\r
\r
- StringIdWalker += 1;\r
- } while (StringIdWalker < 0xFFFF && TempString != NULL);\r
+ TempString = HiiGetString (mShellManHiiHandle, (EFI_STRING_ID)StringIdWalker, NULL);\r
+ if (TempString == NULL) {\r
+ Status = EFI_NOT_FOUND;\r
+ goto Done;\r
+ }\r
\r
+ FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);\r
+ HelpSize = StrLen (TempString) * sizeof (CHAR16);\r
+ ShellWriteFile (FileHandle, &HelpSize, TempString);\r
+ ShellSetFilePosition (FileHandle, 0);\r
+ HelpSize = 0;\r
+ BriefSize = 0;\r
+ Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);\r
+ if (!EFI_ERROR (Status) && (HelpText != NULL)) {\r
+ Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);\r
+ }\r
+\r
+ ShellCloseFile (&FileHandle);\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Found what we need and return\r
+ //\r
+ goto Done;\r
+ }\r
+\r
+ StringIdWalker += 1;\r
+ } while (StringIdWalker < 0xFFFF && TempString != NULL);\r
}\r
\r
Done:\r
if (mShellManDriverHandle != NULL) {\r
gBS->UninstallProtocolInterface (\r
- mShellManDriverHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- &mShellManHiiDevicePath\r
+ mShellManDriverHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ &mShellManHiiDevicePath\r
);\r
mShellManDriverHandle = NULL;\r
}\r
Status = gBS->UnloadImage (CmdFileImgHandle);\r
}\r
\r
- SHELL_FREE_NON_NULL(TempString);\r
- SHELL_FREE_NON_NULL(CmdFileName);\r
- SHELL_FREE_NON_NULL(CmdFilePathName);\r
- SHELL_FREE_NON_NULL(FileDevPath);\r
- SHELL_FREE_NON_NULL(DevPath);\r
+ SHELL_FREE_NON_NULL (TempString);\r
+ SHELL_FREE_NON_NULL (CmdFileName);\r
+ SHELL_FREE_NON_NULL (CmdFilePathName);\r
+ SHELL_FREE_NON_NULL (FileDevPath);\r
+ SHELL_FREE_NON_NULL (DevPath);\r
\r
return (Status);\r
}\r
-\r