step: handle ctrl+D.
This commit is contained in:
parent
5aa7f1ad70
commit
7f8b1dfb2f
|
@ -8,10 +8,12 @@ int main(int argc, char** argv)
|
||||||
puts("Press Ctrl+C to exit\n");
|
puts("Press Ctrl+C to exit\n");
|
||||||
int loop = 1;
|
int loop = 1;
|
||||||
while (loop) {
|
while (loop) {
|
||||||
fputs("mumble>", stdout);
|
fputs("mumble> ", stdout);
|
||||||
void* catcher = fgets(input, 2048, stdin);
|
void* catcher = fgets(input, 2048, stdin);
|
||||||
if (catcher == NULL) {
|
if (catcher == NULL) {
|
||||||
|
// ^ catches Ctrl+D
|
||||||
loop = 0;
|
loop = 0;
|
||||||
|
puts("");
|
||||||
} else {
|
} else {
|
||||||
printf("You said: %s", input);
|
printf("You said: %s", input);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user