aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Farfeleder <stefanf@FreeBSD.org>2004-07-11 17:26:18 +0000
committerStefan Farfeleder <stefanf@FreeBSD.org>2004-07-11 17:26:18 +0000
commit2e96a4c68b23aa12bd3bc8f8bd964de92fe971db (patch)
tree1fda59a06df4f6931118a48271456b9d810cf176
parent67f8f14a6e956522a9128a468dbfa4c2f4082f04 (diff)
downloadsrc-2e96a4c68b23aa12bd3bc8f8bd964de92fe971db.tar.gz
src-2e96a4c68b23aa12bd3bc8f8bd964de92fe971db.zip
Resolve a couple of warnings and bump WARNS to 6.
Notes
Notes: svn path=/head/; revision=131989
-rw-r--r--games/bcd/Makefile1
-rw-r--r--games/bcd/bcd.c21
2 files changed, 12 insertions, 10 deletions
diff --git a/games/bcd/Makefile b/games/bcd/Makefile
index 1e0bbfc60cea..5698c121d638 100644
--- a/games/bcd/Makefile
+++ b/games/bcd/Makefile
@@ -2,6 +2,7 @@
# $FreeBSD$
PROG= bcd
+WARNS?= 6
MAN= bcd.6
MLINKS= bcd.6 ppt.6
diff --git a/games/bcd/bcd.c b/games/bcd/bcd.c
index a3968a46d5cd..27f483ec6313 100644
--- a/games/bcd/bcd.c
+++ b/games/bcd/bcd.c
@@ -80,9 +80,11 @@ static const char rcsid[] =
#include <sys/types.h>
+#include <ctype.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
+#include <unistd.h>
u_short holes[256] = {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@@ -119,15 +121,15 @@ u_short holes[256] = {
0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x0
};
+void printcard(char *);
+
/*
* i'th bit of w.
*/
#define bit(w,i) ((w)&(1<<(i)))
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
char cardline[80];
@@ -150,16 +152,15 @@ main(argc, argv)
#define COLUMNS 48
-printcard(str)
- char *str;
+void
+printcard(char *str)
{
static char rowchars[] = " 123456789";
int i, row;
char *p;
- char *index();
/* ruthlessly remove newlines and truncate at 48 characters. */
- if ((p = index(str, '\n')))
+ if ((p = strchr(str, '\n')))
*p = '\0';
if (strlen(str) > COLUMNS)
@@ -183,7 +184,7 @@ printcard(str)
p = str;
putchar('/');
for (i = 1; *p; i++, p++)
- if (holes[*p])
+ if (holes[(unsigned char)*p])
putchar(*p);
else
putchar(' ');
@@ -201,7 +202,7 @@ printcard(str)
for (row = 0; row <= 11; ++row) {
putchar('|');
for (i = 0, p = str; *p; i++, p++) {
- if (bit(holes[*p], 11 - row))
+ if (bit(holes[(unsigned char)*p], 11 - row))
putchar(']');
else
putchar(rowchars[row]);