/* SPDX-License-Identifier: Apache-2.0 * (c) 2025, Konstantin Demin */ #include "print.hh" #include #include extern "C" { #include } static void print_simple(print_mode mode, const ovl_path_t * root, const ovl_path_t * subpath, const ovl_name_t * name); // TODO: shell-escape mode /* static void print_escape(print_mode mode, const ovl_path_t * root, const ovl_path_t * subpath, const ovl_name_t * name); */ void print_path(print_mode mode, const ovl_path_t * root, const ovl_path_t * subpath, const ovl_name_t * name) { // "root" and "name" are mandatory /* if ((!root) || (!name)) return; */ switch (mode) { case print_mode::normal: /* -fallthrough */ case print_mode::zero: print_simple(mode, root, subpath, name); return; // TODO: shell-escape mode /* case print_mode::shell_escape: print_escape(mode, root, subpath, name); return; */ } } static void print_simple(print_mode mode, const ovl_path_t * root, const ovl_path_t * subpath, const ovl_name_t * name) { // internal method, parameters are already checked /* if ((!root) || (!name)) return 0; */ char eol = (mode == print_mode::zero) ? 0 : '\n'; if (subpath) { (void) fprintf(stdout, "%s/%s/%s%c", root->str, subpath->str, name->str, eol); } else { (void) fprintf(stdout, "%s/%s%c", root->str, name->str, eol); } } // TODO: shell-escape mode /* static void print_escape(print_mode mode, const ovl_path_t * root, const ovl_path_t * subpath, const ovl_name_t * name) { } */