cs252/lab3-src-final/read-line-example.c

30 lines
415 B
C
Raw Normal View History

2018-10-25 14:45:56 -04:00
/*
* Example that shows how to read one line with simple editing
* using raw terminal.
*
*
*/
char * read_line();
char * prompt = "myshell>";
int main(int argc, char ** argv)
{
// Example to test read_line
while (1) {
char * s;
// Print prompt
write(1, prompt, strlen(prompt));
// Read one line
s = read_line();
// Print line read
printf("line read: %s\n", s);
}
}