diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-02 19:38:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-02 19:38:46 +0200 |
| commit | 997be16e5ac9a68d54882ab69529815860d62955 (patch) | |
| tree | 19d6129c2d776bb1edc5d4a7325e39ca176c3403 /public/tools/open/src/CommandLine.cc | |
| parent | 618104e74c195d7508a18450524f8ed7f9af8cc6 (diff) | |
| parent | b3b4b1ebdcd6adeac914869017c86d892b7a8ced (diff) | |
Merge pull request #28 from nekernel-org/dev
0.0.2
Diffstat (limited to 'public/tools/open/src/CommandLine.cc')
| -rw-r--r-- | public/tools/open/src/CommandLine.cc | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/public/tools/open/src/CommandLine.cc b/public/tools/open/src/CommandLine.cc index 7ba7b7f6..f2378599 100644 --- a/public/tools/open/src/CommandLine.cc +++ b/public/tools/open/src/CommandLine.cc @@ -9,41 +9,39 @@ /// @brief This program opens an application from **OPEN_APP_BASE_PATH** /// @file CommandLine.cc -#define OPEN_APP_APP_FLAG "-a" +#define OPEN_APP_APP_FLAG "-a" #define OPEN_APP_HELP_FLAG "-h" #define OPEN_APP_BASE_PATH "/app/" -SInt32 main(SInt32 argc, Char* argv[]) -{ - if (argc == 1) - return EXIT_FAILURE; +SInt32 _NeMain(SInt32 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) - { - PrintOut(nullptr, "open: open .app(s) directories.\n"); - PrintOut(nullptr, "open: © 2024-2025 Amlal El Mahrouss, All rights reserved.\n"); + PrintOut(nullptr, "open: Open Loader.\n"); + PrintOut(nullptr, "open: © 2024-2025 Amlal El Mahrouss, All rights reserved.\n"); - PrintOut(nullptr, "open: %s: Application is being taken as the input (opens a PEF/PE32+/ELF program depending on the CPU architecture).\n", OPEN_APP_APP_FLAG); + for (SInt32 i = 1U; i < argc; ++i) { + if (MmStrCmp(argv[i], OPEN_APP_HELP_FLAG) == 0) { + PrintOut(nullptr, + "open: %s: Application is being taken as the input (opens a PEF/PE32+ program " + "depending on the CPU 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; - else if ((i + 2) == argc) - return EXIT_FAILURE; + return EXIT_SUCCESS; + } else if (MmStrCmp(argv[i], OPEN_APP_APP_FLAG) == 0) { + if ((i + 1) == argc) + return EXIT_FAILURE; + else if ((i + 2) == 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])); + 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])); - UIntPtr ret = RtlSpawnProcess(StrFmt("{}/dist/{]}", base_path, argv[i + 2]), 0, nullptr, nullptr, 0); + UIntPtr ret = + RtlSpawnProcess(StrFmt("{}/dist/{]}", base_path, argv[i + 2]), 0, nullptr, nullptr, 0); - return ret; - } - } + return ret; + } + } - return EXIT_FAILURE; + return EXIT_FAILURE; } |
