X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/38b77b2541ff8fe8f87fd82e8f088e5d03e06b4a..a2ed42264d57a90d79315f08e0639aa09b72bacd:/banner/banner.c diff --git a/banner/banner.c b/banner/banner.c index 01100acb..b442d306 100644 --- a/banner/banner.c +++ b/banner/banner.c @@ -1,4 +1,4 @@ -/* $NetBSD: banner.c,v 1.13 2005/06/27 19:49:20 rillig Exp $ */ +/* $NetBSD: banner.c,v 1.17 2008/07/20 01:03:20 lukem Exp $ */ /* * Copyright (c) 1980, 1993, 1994 @@ -31,15 +31,15 @@ #include #ifndef lint -__COPYRIGHT("@(#) Copyright (c) 1980, 1993, 1994\n\ - The Regents of the University of California. All rights reserved.\n"); +__COPYRIGHT("@(#) Copyright (c) 1980, 1993, 1994\ + The Regents of the University of California. All rights reserved."); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)banner.c 8.4 (Berkeley) 4/29/95"; #else -__RCSID("$NetBSD: banner.c,v 1.13 2005/06/27 19:49:20 rillig Exp $"); +__RCSID("$NetBSD: banner.c,v 1.17 2008/07/20 01:03:20 lukem Exp $"); #endif #endif /* not lint */ @@ -87,7 +87,7 @@ const int asc_ptr[NCHARS] = { * is the next elt in array) and goto second * next element in array. */ -const char data_table[NBYTES] = { +const unsigned char data_table[NBYTES] = { /* 0 1 2 3 4 5 6 7 8 9 */ /* 0 */ 129, 227, 130, 34, 6, 90, 19, 129, 32, 10, /* 10 */ 74, 40, 129, 31, 12, 64, 53, 129, 30, 14, @@ -1031,12 +1031,8 @@ toolong(void) errx(EXIT_FAILURE, "message too long"); } -int main(int, char *[]); - int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; @@ -1050,7 +1046,7 @@ main(argc, argv) break; case 'w': width = atoi(optarg); - if (width <= 0) + if (width <= 0 || width > DWIDTH) errx(1, "illegal argument for -w option"); break; case '?': @@ -1062,7 +1058,7 @@ main(argc, argv) argv += optind; for (i = 0; i < width; i++) { - j = i * 132 / width; + j = i * DWIDTH / width; print[j] = 1; } @@ -1102,7 +1098,7 @@ main(argc, argv) for (i = 0; i < NBYTES; i += 10) { printf("/* %4d */ ",i); for (j = i; j < i+10; j++) { - x = data_table[j] & 0377; + x = data_table[j]; printf(" %3d, ",x); } putchar('\n'); @@ -1139,9 +1135,12 @@ main(argc, argv) printf("bad pc: %d\n",pc); exit(1); } - x = data_table[pc] & 0377; - if (trace) - printf("pc=%d, term=%d, max=%d, linen=%d, x=%d\n",pc,term,max,linen,x); + x = data_table[pc]; + if (trace) { + printf("pc=%d, term=%d, max=%d, linen=%d, x=%d", + pc,term,max,linen,x); + printf("\n"); + } if (x >= 128) { if (x>192) term++; x = x & 63; @@ -1159,7 +1158,7 @@ main(argc, argv) else { y = data_table[pc+1]; /* compensate for narrow teminals */ -#ifdef notdef +#if 0 /* notdef */ x = (x*width + (DWIDTH/2)) / DWIDTH; y = (y*width + (DWIDTH/2)) / DWIDTH; #endif