]>
Commit | Line | Data |
---|---|---|
a405b86d | 1 | /** @file\r |
2 | Main file for Shift shell level 1 function.\r | |
3 | \r | |
c011b6c9 | 4 | (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r |
a405b86d | 5 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include "UefiShellLevel1CommandsLib.h"\r | |
17 | \r | |
18 | /**\r | |
19 | Function for 'shift' command.\r | |
20 | \r | |
21 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
22 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
23 | **/\r | |
24 | SHELL_STATUS\r | |
25 | EFIAPI\r | |
26 | ShellCommandRunShift (\r | |
27 | IN EFI_HANDLE ImageHandle,\r | |
28 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
29 | )\r | |
30 | {\r | |
31 | EFI_STATUS Status;\r | |
32 | SCRIPT_FILE *CurrentScriptFile;\r | |
33 | UINTN LoopVar;\r | |
34 | \r | |
35 | Status = CommandInit();\r | |
36 | ASSERT_EFI_ERROR(Status);\r | |
37 | \r | |
38 | if (!gEfiShellProtocol->BatchIsActive()) {\r | |
0861edab | 39 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"shift"); \r |
a405b86d | 40 | return (SHELL_UNSUPPORTED);\r |
41 | }\r | |
42 | \r | |
43 | CurrentScriptFile = ShellCommandGetCurrentScriptFile();\r | |
44 | ASSERT(CurrentScriptFile != NULL);\r | |
45 | \r | |
46 | if (CurrentScriptFile->Argc < 2) {\r | |
0861edab | 47 | ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"shift"); \r |
a405b86d | 48 | return (SHELL_UNSUPPORTED);\r |
49 | }\r | |
50 | \r | |
51 | for (LoopVar = 0 ; LoopVar < CurrentScriptFile->Argc ; LoopVar++) {\r | |
52 | if (LoopVar == 0) {\r | |
53 | SHELL_FREE_NON_NULL(CurrentScriptFile->Argv[LoopVar]);\r | |
54 | }\r | |
55 | if (LoopVar < CurrentScriptFile->Argc -1) {\r | |
56 | CurrentScriptFile->Argv[LoopVar] = CurrentScriptFile->Argv[LoopVar+1];\r | |
57 | } else {\r | |
58 | CurrentScriptFile->Argv[LoopVar] = NULL;\r | |
59 | }\r | |
60 | }\r | |
61 | CurrentScriptFile->Argc--;\r | |
62 | return (SHELL_SUCCESS);\r | |
63 | }\r | |
64 | \r |