brenns10 / lsh

Simple shell implementation. Tutorial here ->
http://brennan.io/2015/01/16/write-a-shell-in-c/
The Unlicense
1.47k stars 340 forks source link

EOF is not handled properly #6

Closed levex closed 7 years ago

levex commented 7 years ago

Why is the last byte replaced with \0 on EOF? This makes it impossible to exit the shell using ^D. A simple fix would be:

if (c == EOF)
    exit(0);
brenns10 commented 7 years ago

Yeah, you're right.