aboutsummaryrefslogtreecommitdiffstats
path: root/roms/edk2/ShellPkg/Application/ShellCTestApp
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/edk2/ShellPkg/Application/ShellCTestApp
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/edk2/ShellPkg/Application/ShellCTestApp')
-rw-r--r--roms/edk2/ShellPkg/Application/ShellCTestApp/README.txt5
-rw-r--r--roms/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c45
-rw-r--r--roms/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.inf34
-rw-r--r--roms/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.logbin0 -> 3320 bytes
-rw-r--r--roms/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.nsh58
5 files changed, 142 insertions, 0 deletions
diff --git a/roms/edk2/ShellPkg/Application/ShellCTestApp/README.txt b/roms/edk2/ShellPkg/Application/ShellCTestApp/README.txt
new file mode 100644
index 000000000..d788d3ef6
--- /dev/null
+++ b/roms/edk2/ShellPkg/Application/ShellCTestApp/README.txt
@@ -0,0 +1,5 @@
+TestArgv.nsh is a very simple shell script to test how the interpreter parses
+the parameters. It uses ShellCTestApp.efi to dump the parameters passed from the
+interpreter.
+
+TestArgv.log is the desired output created using "TestArgv.nsh > TestArgv.log".
diff --git a/roms/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c b/roms/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c
new file mode 100644
index 000000000..b9451795f
--- /dev/null
+++ b/roms/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c
@@ -0,0 +1,45 @@
+/** @file
+ This is a test application that demonstrates how to use the C-style entry point
+ for a shell application.
+
+ Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/UefiLib.h>
+#include <Library/DebugLib.h>
+#include <Library/ShellCEntryLib.h>
+
+/**
+ UEFI application entry point which has an interface similar to a
+ standard C main function.
+
+ The ShellCEntryLib library instance wrappers the actual UEFI application
+ entry point and calls this ShellAppMain function.
+
+ @param[in] Argc The number of items in Argv.
+ @param[in] Argv Array of pointers to strings.
+
+ @retval 0 The application exited normally.
+ @retval Other An error occurred.
+
+**/
+INTN
+EFIAPI
+ShellAppMain (
+ IN UINTN Argc,
+ IN CHAR16 **Argv
+ )
+{
+ UINTN Index;
+ if (Argc == 1) {
+ Print (L"Argv[1] = NULL\n");
+ }
+ for (Index = 1; Index < Argc; Index++) {
+ Print(L"Argv[%d]: \"%s\"\n", Index, Argv[Index]);
+ }
+
+ return 0;
+}
diff --git a/roms/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.inf b/roms/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.inf
new file mode 100644
index 000000000..a0211caf3
--- /dev/null
+++ b/roms/edk2/ShellPkg/Application/ShellCTestApp/ShellCTestApp.inf
@@ -0,0 +1,34 @@
+## @file
+# This is the shell application
+#
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010006
+ BASE_NAME = ShellCTestApp
+ FILE_GUID = 7a6ca3b8-ee1b-489c-b300-24544a7bd418
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = ShellCEntryLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ ShellCTestApp.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ ShellPkg/ShellPkg.dec
+
+[LibraryClasses]
+ ShellCEntryLib
+ UefiLib
diff --git a/roms/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.log b/roms/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.log
new file mode 100644
index 000000000..e76781ea0
--- /dev/null
+++ b/roms/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.log
Binary files differ
diff --git a/roms/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.nsh b/roms/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.nsh
new file mode 100644
index 000000000..f48c956a3
--- /dev/null
+++ b/roms/edk2/ShellPkg/Application/ShellCTestApp/TestArgv.nsh
@@ -0,0 +1,58 @@
+#/** @file
+# This is a very simple shell script to test how the interpreter parses the parameters.
+#
+# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+echo -on
+set Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA ValueOfGuid
+set Sharp_E8528E46_A008_4221_8DE0_D5AB42A9C580 ^#
+set Quote_E95DEE8B_E3AA_4155_9ED5_6916394104FC ^"
+set Var_ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE
+alias ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE ShellCTestApp
+
+#
+# '^' should escape all special characters (including space)
+# but has no impact to non-special characters
+#
+ShellCTestApp ^^
+ShellCTestApp ^#
+ShellCTestApp ^%Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA%
+ShellCTestApp ^"
+ShellCTestApp ^ 1
+ShellCTestApp ^
+ShellCTestApp ^1
+ShellCTestApp ^^^"
+ShellCTestApp ^^^
+
+#
+# '#' should be processed before %% replacement, and inside '"'
+#
+ShellCTestApp #%Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA%
+#ShellCTestApp "#"
+ShellCTestApp %Sharp_E8528E46_A008_4221_8DE0_D5AB42A9C580%
+
+#
+# '%' should be processed before grouping parameters
+#
+ShellCTestApp "%Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA% 2%Quote_E95DEE8B_E3AA_4155_9ED5_6916394104FC%
+
+#
+# alias should be processed after %% replacement
+#
+%Var_ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE%
+
+#
+# '"' should be stripped, space inside '"' should be kept,
+#
+ShellCTestApp "p 1"
+ShellCTestApp "p"1
+ShellCTestApp "p 1"e"x"""
+
+set -d Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA
+set -d Sharp_E8528E46_A008_4221_8DE0_D5AB42A9C580
+set -d Quote_E95DEE8B_E3AA_4155_9ED5_6916394104FC
+set -d Var_ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE
+alias -d ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE
+echo -off \ No newline at end of file