diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-13 05:43:49 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-13 05:48:18 +0100 |
| commit | faf73d5258b3c61ea1a84efa6bed543d6bfd5321 (patch) | |
| tree | 6d77156202d11a378d326b25a82f4b8b41fe0200 /public/tools/manual/src/CommandLine.cc | |
| parent | d5263778065e62a4a20f3af236f6dde7bbb3afc4 (diff) | |
feat: kernel: API tweaks and new FMT specs for NeKernel.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'public/tools/manual/src/CommandLine.cc')
| -rw-r--r-- | public/tools/manual/src/CommandLine.cc | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/public/tools/manual/src/CommandLine.cc b/public/tools/manual/src/CommandLine.cc index 8c75d565..9dc535bb 100644 --- a/public/tools/manual/src/CommandLine.cc +++ b/public/tools/manual/src/CommandLine.cc @@ -1,13 +1,45 @@ +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/nekernel-org/nekernel + +#include <libSystem/SystemKit/Err.h> #include <libSystem/SystemKit/System.h> SInt32 _NeMain(SInt32 argc, Char* argv[]) { LIBSYS_UNUSED(argc); LIBSYS_UNUSED(argv); - if (argc < 2) { - PrintOut(nullptr, "HELP: manual <tutorial_name>\n"); + if (argc != 3) { + PrintOut(nullptr, "HELP: manual <tutorial_name> <output_name>\n"); return EXIT_FAILURE; } + IORef fileHtml = IoOpenFile(argv[2], nullptr); + + if (fileHtml) { + IORef printRef = PrintCreate(); + + PrintOut(printRef, "<HTML>"); + PrintOut(printRef, "<PRE>"); + + IORef in = PrintGet(argv[1]); + + MUST_PASS(in); + + Char buf[1024] = {0}; + + while (PrintIn(printRef, "%s:1024", buf) == kErrorSuccess); + + PrintRelease(in); + + PrintOut(printRef, "</PRE>"); + PrintOut(printRef, "</HTML>"); + + IoWriteFile(fileHtml, printRef, PrintSize(printRef)); + PrintRelease(printRef); + + IoCloseFile(fileHtml); + } + return EXIT_SUCCESS; }
\ No newline at end of file |
