diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-01-14 11:52:02 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-01-14 11:54:18 +0100 |
| commit | 99826c21b9da1c3a74fd8b3ebc08c7f8dbfadd30 (patch) | |
| tree | 6cfa8f7d18ed018917ea5609aeba1d870cd4e27a /public/tools/open | |
| parent | 39d565d61bb9f9926806bb87abb48f93d0b981f8 (diff) | |
T& Labs's ZKA, Multi-Processor Operating System.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'public/tools/open')
| -rw-r--r-- | public/tools/open/open.json | 5 | ||||
| -rw-r--r-- | public/tools/open/src/CLI.cc | 44 | ||||
| -rw-r--r-- | public/tools/open/src/CommandLine.cc | 49 |
3 files changed, 52 insertions, 46 deletions
diff --git a/public/tools/open/open.json b/public/tools/open/open.json index 71ef4bf0..04012ab3 100644 --- a/public/tools/open/open.json +++ b/public/tools/open/open.json @@ -1,9 +1,10 @@ { - "compiler_path": "g++", + "compiler_path": "cscc", "compiler_std": "c++20", "headers_path": ["./"], - "sources_path": ["src/CLI.cc"], + "sources_path": ["src/CommandLine.cc"], "output_name": "./dist/open", + "compiler_flags": "-lSCI", "cpp_macros": [ "kOpenVersion=0x0100", "kOpenVersionHighest=0x0100", diff --git a/public/tools/open/src/CLI.cc b/public/tools/open/src/CLI.cc deleted file mode 100644 index 2027b14d..00000000 --- a/public/tools/open/src/CLI.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Created on Thu Oct 17 08:00:42 CEST 2024 - * - * Copyright (c) 2024 t& Corporation - */ - -#include <iostream> -#include <vector> - -/// @brief This program makes a framework directory for ZKA OS. - -int main(int argc, char* argv[]) -{ - if (argc == 1) - return EXIT_FAILURE; - - for (size_t i = 1UL; i < argc; ++i) - { - if (strcmp(argv[i], "-h") == 0) - { - std::cout << "open: Open Application Tool.\n"; - std::cout << "open: © t& Corporation, All rights reserved.\n"; - - std::cout << "open: -a: Application is taken as input.\n"; - std::cout << "open: -u: URL is taken as input.\n"; - - return EXIT_SUCCESS; - } - else if (strcmp(argv[i], "-a") == 0) - { - const auto kBasePath = "/apps/packages/"; - - return EXIT_SUCCESS; - } - else if (strcmp(argv[i], "-u") == 0) - { - const auto kBasePath = "/support/defaults/browser"; - - return EXIT_SUCCESS; - } - } - - return EXIT_FAILURE; -} diff --git a/public/tools/open/src/CommandLine.cc b/public/tools/open/src/CommandLine.cc new file mode 100644 index 00000000..64b4076b --- /dev/null +++ b/public/tools/open/src/CommandLine.cc @@ -0,0 +1,49 @@ +/* + * Created on Thu Oct 17 08:00:42 CEST 2024 + * + * Copyright (c) 2024 t& Labs + */ + +#include <LibSCI/SCI.h> + +/// @brief This program opens an application from **OPEN_APP_BASE_PATH** + +#define OPEN_APP_APP_FLAG "-a" +#define OPEN_APP_HELP_FLAG "-h" +#define OPEN_APP_BASE_PATH "/app/" + +int main(int argc, char* argv[]) +{ + if (argc == 1) + return EXIT_FAILURE; + + for (SizeT i = 1UL; i < argc; ++i) + { + if (MmStrCmp(argv[i], OPEN_APP_HELP_FLAG) == 0) + { + ConOut(nullptr, "open: Open Tool.\n"); + ConOut(nullptr, "open: © t& Labs, All rights reserved.\n"); + + ConOut(nullptr, "open: %s: Application is taken as input (opens a PEF/PE32+/ELF program depending on architecture).\n", OPEN_APP_APP_FLAG); + + return EXIT_SUCCESS; + } + else if (MmStrCmp(argv[i], OPEN_APP_APP_FLAG) == 0) + { + if ((i + 1) == argc) + return EXIT_FAILURE; + + Char base_path[FILE_MAX_LEN] = OPEN_APP_BASE_PATH; + MmCopyMemory(base_path + MmStrLen(OPEN_APP_BASE_PATH), argv[i + 1], MmStrLen(argv[i + 1])); + + Bool ret = RtlSpawnProcess(base_path, 0, nullptr, nullptr, 0); + + if (ret > 0) + return EXIT_SUCCESS; + + break; + } + } + + return EXIT_FAILURE; +} |
