handle EOF in shell

This commit is contained in:
rsc 2007-08-08 08:39:07 +00:00
parent 349ee132f0
commit f8f7fcbebd

7
sh.c
View file

@ -42,12 +42,15 @@ main(void)
{
while(1){
puts("$ ");
memset(buf, '\0', sizeof(buf));
gets(buf, sizeof(buf));
memset(buf, 0, sizeof buf);
gets(buf, sizeof buf);
if(buf[0] == 0) // EOF
break;
if(parse(buf) < 0)
continue;
runcmd();
}
exit();
}
int