aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-09-03 13:28:48 +0000
committer_ov4 <ov4@ov4.org>2026-09-03 13:28:48 +0000
commit617104adeb89f4581f5810b40c546d94316bc9f9 (patch)
treeff40d2c838571afe4294c3aa30df349378a4f7f8 /src
parent5a6b17235a10aea87b3b74122df861536a6efdd2 (diff)
idk
Diffstat (limited to 'src')
-rw-r--r--src/option.cc34
-rw-r--r--src/util/io.cc14
2 files changed, 34 insertions, 14 deletions
diff --git a/src/option.cc b/src/option.cc
index 552d83f..2cae4ef 100644
--- a/src/option.cc
+++ b/src/option.cc
@@ -5,6 +5,7 @@
#include "global.h"
#include "util/io.h"
+#include "util/prompt.h"
using namespace std;
@@ -27,6 +28,37 @@ void v(string s)
}
LOG << "-v: invalid value" << endl;
}
-
+
+void p(string s)
+{
+ if (s == "" || s == "true" || s == "1")
+ {
+ ov4::emit_prompt = true;
+ LOG << "emit_prompt = true" << endl;
+ return;
+ }
+ if (s == "false" || s == "0")
+ {
+ ov4::emit_prompt = false;
+ LOG << "emit_prompt = flase" << endl;
+ return;
+ }
+ LOG << "-p: invalid value" << endl;
+}
+
+
+/*
+ * usage - print a help message
+ */
+void h([[maybe_unused]] string s)
+{
+ cout << "\
+Usage: ccshell [-hvp] \n\
+ -h print this message \n\
+ -v(=<bool>) print additional diagnostic information \n\
+ -p(=<bool>) do not emit a command prompt \
+" << endl;
+ exit(1);
}
+}
diff --git a/src/util/io.cc b/src/util/io.cc
index 09479e6..e1960ae 100644
--- a/src/util/io.cc
+++ b/src/util/io.cc
@@ -130,7 +130,7 @@ void wrap_eliminator(char *s, char replacement)
s[i] = replacement;
}
-void write_helper(const char *s)
+void _write_helper(const char *s)
{
int errno_old = errno;
@@ -142,18 +142,6 @@ void write_helper(const char *s)
}
/*
- * usage - print a help message
- */
-void usage(void)
-{
- printf("Usage: shell [-hvp]\n");
- printf(" -h print this message\n");
- printf(" -v print additional diagnostic information\n");
- printf(" -p do not emit a command prompt\n");
- exit(1);
-}
-
-/*
* unix_error - unix-style error routine
*/
void unix_error(const char *msg)