VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel1CommandsLib/Shift.c

Last change on this file was 99404, checked in by vboxsync, 22 months ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/** @file
2 Main file for Shift shell level 1 function.
3
4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include "UefiShellLevel1CommandsLib.h"
11
12/**
13 Function for 'shift' command.
14
15 @param[in] ImageHandle Handle to the Image (NULL if Internal).
16 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
17**/
18SHELL_STATUS
19EFIAPI
20ShellCommandRunShift (
21 IN EFI_HANDLE ImageHandle,
22 IN EFI_SYSTEM_TABLE *SystemTable
23 )
24{
25 EFI_STATUS Status;
26 SCRIPT_FILE *CurrentScriptFile;
27 UINTN LoopVar;
28
29 Status = CommandInit ();
30 ASSERT_EFI_ERROR (Status);
31
32 if (!gEfiShellProtocol->BatchIsActive ()) {
33 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel1HiiHandle, L"shift");
34 return (SHELL_UNSUPPORTED);
35 }
36
37 CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
38 ASSERT (CurrentScriptFile != NULL);
39
40 if (CurrentScriptFile->Argc < 2) {
41 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellLevel1HiiHandle, L"shift");
42 return (SHELL_UNSUPPORTED);
43 }
44
45 for (LoopVar = 0; LoopVar < CurrentScriptFile->Argc; LoopVar++) {
46 if (LoopVar == 0) {
47 SHELL_FREE_NON_NULL (CurrentScriptFile->Argv[LoopVar]);
48 }
49
50 if (LoopVar < CurrentScriptFile->Argc -1) {
51 CurrentScriptFile->Argv[LoopVar] = CurrentScriptFile->Argv[LoopVar+1];
52 } else {
53 CurrentScriptFile->Argv[LoopVar] = NULL;
54 }
55 }
56
57 CurrentScriptFile->Argc--;
58 return (SHELL_SUCCESS);
59}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette