2 Main file for Ver shell level 3 function.
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "UefiShellLevel3CommandsLib.h"
17 #include <Library/ShellLib.h>
19 STATIC CONST SHELL_PARAM_ITEM ParamList
[] = {
21 {L
"-terse", TypeFlag
},
28 Function for 'ver' command.
30 @param[in] ImageHandle Handle to the Image (NULL if Internal).
31 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
36 IN EFI_HANDLE ImageHandle
,
37 IN EFI_SYSTEM_TABLE
*SystemTable
43 SHELL_STATUS ShellStatus
;
46 Level
= PcdGet8(PcdShellSupportLevel
);
48 ShellStatus
= SHELL_SUCCESS
;
51 // initialize the shell lib (we must be in non-auto-init...)
53 Status
= ShellInitialize();
54 ASSERT_EFI_ERROR(Status
);
56 Status
= CommandInit();
57 ASSERT_EFI_ERROR(Status
);
60 // parse the command line
62 Status
= ShellCommandLineParse (ParamList
, &Package
, &ProblemParam
, TRUE
);
63 if (EFI_ERROR(Status
)) {
64 if (Status
== EFI_VOLUME_CORRUPTED
&& ProblemParam
!= NULL
) {
65 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PROBLEM
), gShellLevel3HiiHandle
, ProblemParam
);
66 FreePool(ProblemParam
);
67 ShellStatus
= SHELL_INVALID_PARAMETER
;
75 if (ShellCommandLineGetFlag(Package
, L
"-?")) {
78 if (ShellCommandLineGetRawValue(Package
, 1) != NULL
) {
80 // we have too many parameters
82 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_MANY
), gShellLevel3HiiHandle
);
83 ShellStatus
= SHELL_INVALID_PARAMETER
;
85 if (ShellCommandLineGetFlag(Package
, L
"-s")) {
88 gST
->ConOut
->Mode
->CursorRow
,
90 STRING_TOKEN (STR_VER_OUTPUT_SIMPLE
),
91 gShellLevel3HiiHandle
,
92 gEfiShellProtocol
->MajorVersion
,
93 gEfiShellProtocol
->MinorVersion
98 gST
->ConOut
->Mode
->CursorRow
,
100 STRING_TOKEN (STR_VER_OUTPUT_SHELL
),
101 gShellLevel3HiiHandle
,
103 gEfiShellProtocol
->MajorVersion
,
104 gEfiShellProtocol
->MinorVersion
106 if (!ShellCommandLineGetFlag(Package
, L
"-terse") && !ShellCommandLineGetFlag(Package
, L
"-t")){
111 STRING_TOKEN (STR_VER_EXTRA_STRING
),
112 gShellLevel3HiiHandle
120 STRING_TOKEN (STR_VER_OUTPUT_UEFI
),
121 gShellLevel3HiiHandle
,
122 (gST
->Hdr
.Revision
&0xffff0000)>>16,
123 (gST
->Hdr
.Revision
&0x0000ffff),
125 gST
->FirmwareRevision
130 // implementation specific support for displaying processor architecture
132 if (ShellCommandLineGetFlag(Package
, L
"-_pa")) {
133 ShellPrintEx(-1, -1, L
"%d\r\n", sizeof(UINTN
)==sizeof(UINT64
)?64:32);
138 // free the command line package
140 ShellCommandLineFreeVarList (Package
);
143 return (ShellStatus
);