Module Name: src
Committed By: rillig
Date: Sat May 1 20:21:25 UTC 2021
Modified Files:
src/games/caesar: Makefile caesar.c
Log Message:
caesar: WARNS=6, strict bool mode
The rotation is validated to be nonnegative, therefore use unsigned int
for it.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/games/caesar/Makefile
cvs rdiff -u -r1.22 -r1.23 src/games/caesar/caesar.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/games/caesar/Makefile
diff -u src/games/caesar/Makefile:1.8 src/games/caesar/Makefile:1.9
--- src/games/caesar/Makefile:1.8 Mon Jan 28 07:03:59 2008
+++ src/games/caesar/Makefile Sat May 1 20:21:25 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.8 2008/01/28 07:03:59 dholland Exp $
+# $NetBSD: Makefile,v 1.9 2021/05/01 20:21:25 rillig Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= caesar
@@ -8,4 +8,7 @@ LDADD= -lm
MLINKS= caesar.6 rot13.6
SCRIPTS=rot13.sh
+WARNS= 6
+LINTFLAGS+= -T
+
.include <bsd.prog.mk>
Index: src/games/caesar/caesar.c
diff -u src/games/caesar/caesar.c:1.22 src/games/caesar/caesar.c:1.23
--- src/games/caesar/caesar.c:1.22 Sun Jul 20 01:03:21 2008
+++ src/games/caesar/caesar.c Sat May 1 20:21:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: caesar.c,v 1.22 2008/07/20 01:03:21 lukem Exp $ */
+/* $NetBSD: caesar.c,v 1.23 2021/05/01 20:21:25 rillig Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -48,7 +48,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
#if 0
static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: caesar.c,v 1.22 2008/07/20 01:03:21 lukem Exp $");
+__RCSID("$NetBSD: caesar.c,v 1.23 2021/05/01 20:21:25 rillig Exp $");
#endif
#endif /* not lint */
@@ -79,7 +79,7 @@ static unsigned char rottbl[NCHARS];
static void
-init_rottbl(int rot)
+init_rottbl(unsigned int rot)
{
size_t i;
@@ -121,7 +121,7 @@ print_array(const unsigned char *a, size
}
}
-static int
+static unsigned int
get_rotation(const char *arg)
{
long rot;
@@ -135,7 +135,7 @@ get_rotation(const char *arg)
errno = ERANGE;
if (errno)
err(EXIT_FAILURE, "Bad rotation value `%s'", arg);
- return (int)rot;
+ return (unsigned int)rot;
}
static void
@@ -145,7 +145,7 @@ guess_and_rotate(void)
unsigned int obs[NCHARS];
size_t i, nread;
double dot, winnerdot;
- int try, winner;
+ unsigned int try, winner;
int ch;
/* adjust frequency table to weight low probs REAL low */