Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/fish Flush input to EOL correctly in games/fish.
details: https://anonhg.NetBSD.org/src/rev/303afbfb4873
branches: trunk
changeset: 984823:303afbfb4873
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jul 25 02:00:42 2021 +0000
description:
Flush input to EOL correctly in games/fish.
PR 54885 from Mouse, with a somewhat different patch.
diffstat:
games/fish/fish.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (42 lines):
diff -r 5b014b698266 -r 303afbfb4873 games/fish/fish.c
--- a/games/fish/fish.c Sun Jul 25 01:43:08 2021 +0000
+++ b/games/fish/fish.c Sun Jul 25 02:00:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fish.c,v 1.26 2021/05/02 12:25:55 rillig Exp $ */
+/* $NetBSD: fish.c,v 1.27 2021/07/25 02:00:42 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: fish.c,v 1.26 2021/05/02 12:25:55 rillig Exp $");
+__RCSID("$NetBSD: fish.c,v 1.27 2021/07/25 02:00:42 dholland Exp $");
#endif
#endif /* not lint */
@@ -432,15 +432,20 @@
static void
instructions(void)
{
- int input;
+ int input, c;
pid_t pid;
int fd;
const char *pager;
int status;
(void)printf("Would you like instructions (y or n)? ");
- input = getchar();
- while (getchar() != '\n');
+ input = c = getchar();
+ while (c != '\n') {
+ c = getchar();
+ if (c == EOF) {
+ exit(1);
+ }
+ }
if (input != 'y')
return;
Home |
Main Index |
Thread Index |
Old Index