From 16d8e9af6f620c3dcd0d4fdc44b9b2711a602bf4 Mon Sep 17 00:00:00 2001 From: jsm Date: Thu, 21 Sep 2000 09:49:03 +0000 Subject: [PATCH] die() on EOF; based on OpenBSD. --- games/battlestar/getcom.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/games/battlestar/getcom.c b/games/battlestar/getcom.c index 3f8f130690ca..4c7e293535fe 100644 --- a/games/battlestar/getcom.c +++ b/games/battlestar/getcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: getcom.c,v 1.7 2000/09/17 23:04:17 jsm Exp $ */ +/* $NetBSD: getcom.c,v 1.8 2000/09/21 09:49:03 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)getcom.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: getcom.c,v 1.7 2000/09/17 23:04:17 jsm Exp $"); +__RCSID("$NetBSD: getcom.c,v 1.8 2000/09/21 09:49:03 jsm Exp $"); #endif #endif /* not lint */ @@ -53,6 +53,8 @@ getcom(buf, size, prompt, error) for (;;) { fputs(prompt, stdout); if (fgets(buf, size, stdin) == 0) { + if (feof(stdin)) + die(); clearerr(stdin); continue; }