summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjanzen <pjanzen@openbsd.org>1999-03-27 05:07:07 +0000
committerpjanzen <pjanzen@openbsd.org>1999-03-27 05:07:07 +0000
commite33001c524aee768e6849e2d0589265a09f1c8a7 (patch)
tree0be348cb644be2f6afed616188b5b0bc78761acd
parentuse const where appropriate; jsm28@cam.ac.uk (diff)
downloadwireguard-openbsd-e33001c524aee768e6849e2d0589265a09f1c8a7.tar.xz
wireguard-openbsd-e33001c524aee768e6849e2d0589265a09f1c8a7.zip
Fix rev 1.4
-rw-r--r--games/sail/pl_main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c
index 9f2dfc3a839..b9e958a7599 100644
--- a/games/sail/pl_main.c
+++ b/games/sail/pl_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pl_main.c,v 1.4 1999/03/26 02:35:53 pjanzen Exp $ */
+/* $OpenBSD: pl_main.c,v 1.5 1999/03/27 05:07:07 pjanzen Exp $ */
/* $NetBSD: pl_main.c,v 1.5 1995/04/24 12:25:25 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_main.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: pl_main.c,v 1.4 1999/03/26 02:35:53 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: pl_main.c,v 1.5 1999/03/27 05:07:07 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -198,10 +198,10 @@ reprint:
(void) printf("Your name, Captain? ");
(void) fflush(stdout);
(void) fgets(captain, sizeof captain, stdin);
- if (!*captain)
+ if (!*captain || *captain == '\n')
(void) strcpy(captain, "no name");
- else
- captain[sizeof(captain) - 1] = '\0';
+ else if (captain[strlen(captain) - 1] == '\n')
+ captain[strlen(captain) - 1] = '\0';
}
Writestr(W_CAPTAIN, ms, captain);
for (n = 0; n < 2; n++) {