summaryrefslogtreecommitdiffstats
path: root/sail
diff options
context:
space:
mode:
authorglass <glass@NetBSD.org>1994-01-13 19:22:29 +0000
committerglass <glass@NetBSD.org>1994-01-13 19:22:29 +0000
commit45386720c726554e3651adddc74da5b577cbac79 (patch)
treed5f0698a15703360ff4dfbc82bbfc2ddfa0d4d22 /sail
parentc31cb547c92562faca75f3360d66c1226582e0bf (diff)
downloadbsdgames-darwin-45386720c726554e3651adddc74da5b577cbac79.tar.gz
bsdgames-darwin-45386720c726554e3651adddc74da5b577cbac79.tar.zst
bsdgames-darwin-45386720c726554e3651adddc74da5b577cbac79.zip
fixed to use fgets()
Diffstat (limited to 'sail')
-rw-r--r--sail/pl_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sail/pl_main.c b/sail/pl_main.c
index 95ca848d..c4b7cad1 100644
--- a/sail/pl_main.c
+++ b/sail/pl_main.c
@@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)pl_main.c 5.5 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: pl_main.c,v 1.2 1993/08/01 18:51:34 mycroft Exp $";
+static char rcsid[] = "$Id: pl_main.c,v 1.3 1994/01/13 19:22:29 glass Exp $";
#endif /* not lint */
#include "player.h"
@@ -199,9 +199,11 @@ reprint:
else {
(void) printf("Your name, Captain? ");
(void) fflush(stdout);
- (void) gets(captain);
+ (void) fgets(captain, sizeof captain, stdin);
if (!*captain)
(void) strcpy(captain, "no name");
+ else
+ captain[strlen(captain) - 1] = '\0';
}
captain[sizeof captain - 1] = '\0';
Write(W_CAPTAIN, ms, 1, (int)captain, 0, 0, 0);