-/* $NetBSD: bcd.c,v 1.15 2008/07/20 01:03:21 lukem Exp $ */
+/* $NetBSD: bcd.c,v 1.17 2009/08/12 05:21:28 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
#if 0
static char sccsid[] = "@(#)bcd.c 8.2 (Berkeley) 3/20/94";
#else
-__RCSID("$NetBSD: bcd.c,v 1.15 2008/07/20 01:03:21 lukem Exp $");
+__RCSID("$NetBSD: bcd.c,v 1.17 2009/08/12 05:21:28 dholland Exp $");
#endif
#endif /* not lint */
#include <ctype.h>
#include <unistd.h>
-const u_short holes[256] = {
+static const u_short holes[256] = {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
*/
#define bit(w,i) ((w)&(1<<(i)))
-void printcard(char *);
+static void printcard(char *);
int
main(int argc, char **argv)
#define COLUMNS 48
-void
+static void
printcard(char *str)
{
static const char rowchars[] = " 123456789";
int i, row;
- unsigned char *p;
+ char *p;
/* ruthlessly remove newlines and truncate at 48 characters. */
if ((p = strchr(str, '\n')))
/* make string upper case. */
for (p = str; *p; ++p)
- if (isascii(*p) && islower(*p))
- *p = toupper(*p);
+ if (isascii((unsigned char)*p) && islower((unsigned char)*p))
+ *p = toupper((unsigned char) *p);
/* top of card */
putchar(' ');
p = str;
putchar('/');
for (i = 1; *p; i++, p++)
- if (holes[(int)*p])
+ if (holes[(unsigned char)*p])
putchar(*p);
else
putchar(' ');
for (row = 0; row <= 11; ++row) {
putchar('|');
for (i = 0, p = str; *p; i++, p++) {
- if (bit(holes[(int)*p], 11 - row))
+ if (bit(holes[(unsigned char)*p], 11 - row))
putchar(']');
else
putchar(rowchars[row]);