lose > before output, prompt when ready for input

This commit is contained in:
Ludwig Ortmann 2013-03-18 15:37:32 +01:00
parent 0a50f17006
commit dfeae74661

View File

@ -144,17 +144,25 @@ static int readline(shell_t *shell, char* buf, size_t size) {
return 1; return 1;
} }
static inline void print_prompt(shell_t *shell)
{
shell->put_char('>');
shell->put_char(' ');
return;
}
void shell_run(shell_t *shell) { void shell_run(shell_t *shell) {
char line_buf[255]; char line_buf[255];
print_prompt(shell);
while(1) { while(1) {
int res = readline(shell, line_buf, sizeof(line_buf)); int res = readline(shell, line_buf, sizeof(line_buf));
shell->put_char('>');
if (! res ) { if (! res ) {
char* line_copy = strdup(line_buf); char* line_copy = strdup(line_buf);
handle_input_line(shell, line_copy); handle_input_line(shell, line_copy);
free(line_copy); free(line_copy);
} }
print_prompt(shell);
} }
} }