aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/prompt.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-10-26 21:01:41 -0700
committerNicholas Noll <nbnoll@eml.cc>2021-10-26 21:01:41 -0700
commit29b56ef4e4113bcd091b19d6926f18814162ca53 (patch)
treea4888a16927576592af13928bb805f1f2b1159d6 /sys/cmd/rc/prompt.c
parente34a4791b72e426b02f33496fe03be1ad81819a6 (diff)
Feat(libunicode): Added an explicit unicode library
Refactored code to pull out utf8 functions from base into a standalone library. Also left the required function inside arg.c so that code that calls ARG_BEGIN doesn't have to link to libunicode.
Diffstat (limited to 'sys/cmd/rc/prompt.c')
-rw-r--r--sys/cmd/rc/prompt.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/cmd/rc/prompt.c b/sys/cmd/rc/prompt.c
index d6846e6..6a32d59 100644
--- a/sys/cmd/rc/prompt.c
+++ b/sys/cmd/rc/prompt.c
@@ -1,21 +1,30 @@
#include "rc.h"
+static char promptbuf[7] = {'>', ' ', 0, ' ' , ' ', ' ', 0};
+
+void
+resetprompt(void)
+{
+ promptbuf[2] = 0;
+}
int
prompt(ushort *flag)
{
- int fd, f = *flag;
+ int f = *flag;
+
if(f){
- if(!readline(shell.prompt)){
+ if(!readline(promptbuf)){
runner->flag.eof = 1;
return 0;
}
- fd = mapfd(0);
- write(fd, "\n\r", 2);
- shell.prompt = "> "; // NOTE: can't use tab here: we have a hacky prompt length computation
+ write(mapfd(0), "\n\r", 2);
+
+ promptbuf[2] = ' ';
runner->line++;
*flag = 0;
}
+
return 1;
}