aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/prompt.c
blob: 6a32d59405b8cf61973dea24ee6da3ba54d27335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "rc.h"

static char promptbuf[7] = {'>', ' ', 0, ' ' , ' ', ' ', 0};

void
resetprompt(void)
{
    promptbuf[2] = 0;
}

int
prompt(ushort *flag)
{
    int f = *flag;

    if(f){
        if(!readline(promptbuf)){
            runner->flag.eof = 1;
            return 0;
        }
        write(mapfd(0), "\n\r", 2);

        promptbuf[2] = ' ';

        runner->line++;
        *flag = 0;
    }

    return 1;
}