diff options
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 |
