summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2007-03-02 04:32:33 +0000
committerRay Lai <ray@cvs.openbsd.org>2007-03-02 04:32:33 +0000
commitee4d88ad7057b1d6bc161923816bc92e608b5112 (patch)
tree11ab32f9c00b988d7e67f57549412e979b11d5ca /games
parent14c53d4817d194407a6f4e37fb939e4fbbfe6104 (diff)
strlen fixes from Charles Longeau.
OK moritz@.
Diffstat (limited to 'games')
-rw-r--r--games/monop/getinp.c7
-rw-r--r--games/monop/monop.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/games/monop/getinp.c b/games/monop/getinp.c
index c2a3d1d27ad..f6684fe3465 100644
--- a/games/monop/getinp.c
+++ b/games/monop/getinp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getinp.c,v 1.7 2003/06/03 03:01:40 millert Exp $ */
+/* $OpenBSD: getinp.c,v 1.8 2007/03/02 04:32:32 ray Exp $ */
/* $NetBSD: getinp.c,v 1.4 1995/04/24 12:24:20 cgd Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getinp.c 8.1 (Berkeley) 5/31/93";
#else
-static const char rcsid[] = "$OpenBSD: getinp.c,v 1.7 2003/06/03 03:01:40 millert Exp $";
+static const char rcsid[] = "$OpenBSD: getinp.c,v 1.8 2007/03/02 04:32:32 ray Exp $";
#endif
#endif /* not lint */
@@ -84,8 +84,7 @@ getinp(prompt, list)
}
continue;
}
- sp = buf + strlen(buf) - 1;
- if (*sp == '\n')
+ if ((sp = strchr(buf, '\n')) != NULL)
*sp = '\0';
for (sp = buf; *sp; sp++)
if (isupper(*sp))
diff --git a/games/monop/monop.c b/games/monop/monop.c
index 902450fea05..2392882f578 100644
--- a/games/monop/monop.c
+++ b/games/monop/monop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monop.c,v 1.7 2003/06/03 03:01:40 millert Exp $ */
+/* $OpenBSD: monop.c,v 1.8 2007/03/02 04:32:32 ray Exp $ */
/* $NetBSD: monop.c,v 1.3 1995/03/23 08:34:52 cgd Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)monop.c 8.1 (Berkeley) 5/31/93";
#else
-static const char rcsid[] = "$OpenBSD: monop.c,v 1.7 2003/06/03 03:01:40 millert Exp $";
+static const char rcsid[] = "$OpenBSD: monop.c,v 1.8 2007/03/02 04:32:32 ray Exp $";
#endif
#endif /* not lint */
@@ -111,8 +111,7 @@ blew_it:
printf("user closed input stream, quitting...\n");
exit(0);
}
- sp = buf + strlen(buf) - 1;
- if (*sp == '\n')
+ if ((sp = strchr(buf, '\n')) != NULL)
*sp = '\0';
} while (strlen(buf) == 0);
if ((name_list[i] = play[i].name = strdup(buf)) == NULL)