Prompt
This commit is contained in:
parent
eab3fc33be
commit
d1b0f45c28
23
os/console.c
23
os/console.c
@ -40,6 +40,24 @@ static Int prompt1(USES_REGS1);
|
|||||||
static int ConsoleGetc(int);
|
static int ConsoleGetc(int);
|
||||||
static int ConsolePutc(int, int);
|
static int ConsolePutc(int, int);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool Yap_DoPrompt(StreamDesc *s) {
|
||||||
|
if (s->status & Tty_Stream_f) {
|
||||||
|
if (GLOBAL_Stream[0].status & Tty_Stream_f &&
|
||||||
|
s->name == GLOBAL_Stream[0].name)
|
||||||
|
return true;
|
||||||
|
if (GLOBAL_Stream[1].status & Tty_Stream_f &&
|
||||||
|
s->name == GLOBAL_Stream[1].name)
|
||||||
|
return true;
|
||||||
|
if (GLOBAL_Stream[2].status & Tty_Stream_f &&
|
||||||
|
s->name == GLOBAL_Stream[2].name)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* check if we read a newline or an EOF */
|
/* check if we read a newline or an EOF */
|
||||||
int console_post_process_read_char(int ch, StreamDesc *s) {
|
int console_post_process_read_char(int ch, StreamDesc *s) {
|
||||||
/* the character is also going to be output by the console handler */
|
/* the character is also going to be output by the console handler */
|
||||||
@ -121,11 +139,10 @@ static int ConsoleGetc(int sno) {
|
|||||||
restart:
|
restart:
|
||||||
/* keep the prompt around, just in case, but don't actually
|
/* keep the prompt around, just in case, but don't actually
|
||||||
show it in silent mode */
|
show it in silent mode */
|
||||||
if (LOCAL_newline) {
|
if (Yap_DoPrompt(s)) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
char *cptr = LOCAL_Prompt, ch;
|
char *cptr = LOCAL_Prompt, ch;
|
||||||
|
/* use the default routine */
|
||||||
/* use the default routine */
|
|
||||||
while ((ch = *cptr++) != '\0') {
|
while ((ch = *cptr++) != '\0') {
|
||||||
GLOBAL_Stream[StdErrStream].stream_putc(StdErrStream, ch);
|
GLOBAL_Stream[StdErrStream].stream_putc(StdErrStream, ch);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user