Determine if the first item in a command line is valid. @param[in] CmdLine The command line to parse. @retval EFI_SUCCESS The item is valid. @retval EFI_OUT_OF_RESOURCES A memory allocation failed. @retval EFI_NOT_FOUND The operation type is unknown or invalid. **/
| 2056 | @retval EFI_NOT_FOUND The operation type is unknown or invalid. |
| 2057 | **/ |
| 2058 | EFI_STATUS |
| 2059 | IsValidSplit( |
| 2060 | IN CONST CHAR16 *CmdLine |
| 2061 | ) |
| 2062 | { |
| 2063 | CHAR16 *Temp; |
| 2064 | CHAR16 *FirstParameter; |
| 2065 | CHAR16 *TempWalker; |
| 2066 | EFI_STATUS Status; |
| 2067 | |
| 2068 | Temp = NULL; |
| 2069 | |
| 2070 | Temp = StrnCatGrow(&Temp, NULL, CmdLine, 0); |
| 2071 | if (Temp == NULL) { |
| 2072 | return (EFI_OUT_OF_RESOURCES); |
| 2073 | } |
| 2074 | |
| 2075 | FirstParameter = StrStr(Temp, L"|"); |
| 2076 | if (FirstParameter != NULL) { |
| 2077 | *FirstParameter = CHAR_NULL; |
| 2078 | } |
| 2079 | |
| 2080 | FirstParameter = NULL; |
| 2081 | |
| 2082 | // |
| 2083 | // Process the command line |
| 2084 | // |
| 2085 | Status = ProcessCommandLineToFinal(&Temp); |
| 2086 | |
| 2087 | if (!EFI_ERROR(Status)) { |
| 2088 | FirstParameter = AllocateZeroPool(StrSize(CmdLine)); |
| 2089 | if (FirstParameter == NULL) { |
| 2090 | SHELL_FREE_NON_NULL(Temp); |
| 2091 | return (EFI_OUT_OF_RESOURCES); |
| 2092 | } |
| 2093 | TempWalker = (CHAR16*)Temp; |
| 2094 | if (!EFI_ERROR(GetNextParameter(&TempWalker, &FirstParameter, StrSize(CmdLine), TRUE))) { |
| 2095 | if (GetOperationType(FirstParameter) == Unknown_Invalid) { |
| 2096 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_NOT_FOUND), ShellInfoObject.HiiHandle, FirstParameter); |
| 2097 | SetLastError(SHELL_NOT_FOUND); |
| 2098 | Status = EFI_NOT_FOUND; |
| 2099 | } |
| 2100 | } |
| 2101 | } |
| 2102 | |
| 2103 | SHELL_FREE_NON_NULL(Temp); |
| 2104 | SHELL_FREE_NON_NULL(FirstParameter); |
| 2105 | return Status; |
| 2106 | } |
| 2107 | |
| 2108 | /** |
| 2109 | Determine if a command line contains with a split contains only valid commands. |
no test coverage detected