2 Main file for Echo shell level 3 function.
4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. <BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "UefiShellLevel3CommandsLib.h"
18 #include <Library/ShellLib.h>
21 Function for 'echo' command.
23 @param[in] ImageHandle Handle to the Image (NULL if Internal).
24 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
29 IN EFI_HANDLE ImageHandle
,
30 IN EFI_SYSTEM_TABLE
*SystemTable
37 CHAR16
*TempParameter
;
42 RawCmdLine
= ShellGetRawCmdLine ();
43 if (RawCmdLine
== NULL
) {
44 return SHELL_OUT_OF_RESOURCES
;
50 Size
= StrSize (RawCmdLine
);
51 TempParameter
= AllocateZeroPool(Size
);
52 if (TempParameter
== NULL
) {
53 Status
= SHELL_OUT_OF_RESOURCES
;
59 ; Walker
!= NULL
&& *Walker
!= CHAR_NULL
62 if (EFI_ERROR (ShellGetNextParameter (&Walker
, TempParameter
, Size
, FALSE
))) {
67 if (gUnicodeCollation
->StriColl(gUnicodeCollation
, TempParameter
, L
"-on") == 0 ) {
70 if (gUnicodeCollation
->StriColl(gUnicodeCollation
, TempParameter
, L
"-off") == 0 ) {
76 if (OnFlag
|| OffFlag
) {
78 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_ECHO_INVALID_PARAM
), gShellLevel3HiiHandle
, L
"echo", L
"-on/-off");
79 Status
= SHELL_INVALID_PARAMETER
;
83 ShellCommandSetEchoState(OnFlag
);
84 Status
= SHELL_SUCCESS
;
88 Walker
= RawCmdLine
+ StrLen (L
"echo");
89 if (*Walker
!= CHAR_NULL
) {
91 ShellPrintEx (-1, -1, L
"%s\r\n", Walker
);
94 Status
= SHELL_SUCCESS
;
97 SHELL_FREE_NON_NULL (TempParameter
);
98 SHELL_FREE_NON_NULL (RawCmdLine
);