2 Main file for Ver shell level 3 function.
4 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
5 (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
6 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "UefiShellLevel3CommandsLib.h"
19 #include <Library/ShellLib.h>
21 STATIC CONST SHELL_PARAM_ITEM ParamList
[] = {
23 {L
"-terse", TypeFlag
},
30 Function for 'ver' command.
32 @param[in] ImageHandle Handle to the Image (NULL if Internal).
33 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
38 IN EFI_HANDLE ImageHandle
,
39 IN EFI_SYSTEM_TABLE
*SystemTable
45 SHELL_STATUS ShellStatus
;
48 Level
= PcdGet8(PcdShellSupportLevel
);
50 ShellStatus
= SHELL_SUCCESS
;
53 // initialize the shell lib (we must be in non-auto-init...)
55 Status
= ShellInitialize();
56 ASSERT_EFI_ERROR(Status
);
58 Status
= CommandInit();
59 ASSERT_EFI_ERROR(Status
);
62 // parse the command line
64 Status
= ShellCommandLineParse (ParamList
, &Package
, &ProblemParam
, TRUE
);
65 if (EFI_ERROR(Status
)) {
66 if (Status
== EFI_VOLUME_CORRUPTED
&& ProblemParam
!= NULL
) {
67 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PROBLEM
), gShellLevel3HiiHandle
, L
"ver", ProblemParam
);
68 FreePool(ProblemParam
);
69 ShellStatus
= SHELL_INVALID_PARAMETER
;
77 if (ShellCommandLineGetFlag(Package
, L
"-?")) {
80 if (ShellCommandLineGetRawValue(Package
, 1) != NULL
) {
82 // we have too many parameters
84 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_MANY
), gShellLevel3HiiHandle
, L
"ver");
85 ShellStatus
= SHELL_INVALID_PARAMETER
;
87 if (ShellCommandLineGetFlag(Package
, L
"-s")) {
88 if (ShellCommandLineGetFlag(Package
, L
"-terse") || ShellCommandLineGetFlag(Package
, L
"-t")){
89 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_CONFLICT
), gShellLevel3HiiHandle
, L
"ver", L
"-t or -terse", L
"-s");
90 ShellStatus
= SHELL_INVALID_PARAMETER
;
94 gST
->ConOut
->Mode
->CursorRow
,
96 STRING_TOKEN (STR_VER_OUTPUT_SIMPLE
),
97 gShellLevel3HiiHandle
,
98 gEfiShellProtocol
->MajorVersion
,
99 gEfiShellProtocol
->MinorVersion
105 gST
->ConOut
->Mode
->CursorRow
,
107 STRING_TOKEN (STR_VER_OUTPUT_SHELL
),
108 gShellLevel3HiiHandle
,
110 gEfiShellProtocol
->MajorVersion
,
111 gEfiShellProtocol
->MinorVersion
113 if (!ShellCommandLineGetFlag(Package
, L
"-terse") && !ShellCommandLineGetFlag(Package
, L
"-t")){
118 STRING_TOKEN (STR_VER_OUTPUT_SUPPLIER
),
119 gShellLevel3HiiHandle
,
120 (CHAR16
*) PcdGetPtr (PcdShellSupplier
)
128 STRING_TOKEN (STR_VER_OUTPUT_UEFI
),
129 gShellLevel3HiiHandle
,
130 (gST
->Hdr
.Revision
&0xffff0000)>>16,
131 (gST
->Hdr
.Revision
&0x0000ffff),
133 gST
->FirmwareRevision
138 // implementation specific support for displaying processor architecture
140 if (ShellCommandLineGetFlag(Package
, L
"-_pa")) {
141 ShellPrintEx(-1, -1, L
"%d\r\n", sizeof(UINTN
)==sizeof(UINT64
)?64:32);
146 // free the command line package
148 ShellCommandLineFreeVarList (Package
);
151 return (ShellStatus
);