From 9a09c0bfc5956ed57fa4c26f84babb6778fa8a34 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 1 Sep 2026 07:58:49 +0000 Subject: path --- include/all.h | 1 + include/command/builtin.h | 3 +++ include/global.h | 2 ++ include/path.h | 9 ++++----- include/util/prompt.h | 13 +++++++++++++ 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 include/util/prompt.h (limited to 'include') diff --git a/include/all.h b/include/all.h index 266735b..5141e37 100644 --- a/include/all.h +++ b/include/all.h @@ -2,6 +2,7 @@ #include "command/builtin.h" #include "util/io.h" +#include "util/prompt.h" #include "util/string.h" #include "eval.h" #include "global.h" diff --git a/include/command/builtin.h b/include/command/builtin.h index 49a8e13..cd58b14 100644 --- a/include/command/builtin.h +++ b/include/command/builtin.h @@ -9,6 +9,8 @@ #include #include +#include "all.h" + namespace ov4 { @@ -26,5 +28,6 @@ void jobs(char **argv); void bg(char **argv); void fg(char **argv); void exit(char **argv); +void cd(char **argv); } diff --git a/include/global.h b/include/global.h index 5ff04f3..36fe3be 100644 --- a/include/global.h +++ b/include/global.h @@ -14,4 +14,6 @@ constexpr int MAXARGS = 128; constexpr bool GLOBAL_DEBUG = true; +constexpr std::string_view name = "ccshell"; + } diff --git a/include/path.h b/include/path.h index c4ea85c..06e5459 100644 --- a/include/path.h +++ b/include/path.h @@ -11,11 +11,10 @@ namespace ov4 { -extern std::string current_dir; - -std::string find_cmd(char* s); -std::string find_cmd(std::string s); -std::string set_current_dir(std::string s); +std::string find_cmd(const char* s); +std::string find_cmd(const std::string &s); std::string path_unifier(const std::string &s); +std::string get_current_dir(); +int set_current_dir(const std::string &s); } diff --git a/include/util/prompt.h b/include/util/prompt.h new file mode 100644 index 0000000..464156a --- /dev/null +++ b/include/util/prompt.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +#include "all.h" + +namespace ov4 +{ + constexpr std::string_view prompt = "$"; + extern bool emit_prompt; + + void print_prompt(); +} -- cgit v1.3.1-4-g156e