From fef85a6e438af9f4190645b00d74188d8850e530 Mon Sep 17 00:00:00 2001 From: glass Date: Sat, 25 Mar 1995 07:44:46 +0000 Subject: Merge 4.4Lite version --- banner/banner.c | 101 +++++++++++++++++++++++--------------------------------- 1 file changed, 42 insertions(+), 59 deletions(-) (limited to 'banner/banner.c') diff --git a/banner/banner.c b/banner/banner.c index da69d315..0b5fddd2 100644 --- a/banner/banner.c +++ b/banner/banner.c @@ -1,6 +1,8 @@ +/* $NetBSD: banner.c,v 1.3 1995/03/25 07:44:49 glass Exp $ */ + /* - * Copyright (c) 1980 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1980, 1993, 1994 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,14 +34,17 @@ */ #ifndef lint -char copyright[] = -"@(#) Copyright (c) 1980 The Regents of the University of California.\n\ - All rights reserved.\n"; +static char copyright[] = +"@(#) Copyright (c) 1980, 1993, 1994\n\ + The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint -/*static char sccsid[] = "from: @(#)banner.c 4.3 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$Id: banner.c,v 1.2 1993/08/01 18:56:19 mycroft Exp $"; +#if 0 +static char sccsid[] = "@(#)banner.c 8.3 (Berkeley) 4/2/94"; +#else +static char rcsid[] = "$NetBSD: banner.c,v 1.3 1995/03/25 07:44:49 glass Exp $"; +#endif #endif /* not lint */ /* @@ -47,7 +52,11 @@ static char rcsid[] = "$Id: banner.c,v 1.2 1993/08/01 18:56:19 mycroft Exp $"; * banner [-w#] [-d] [-t] message ... */ +#include #include +#include +#include +#include #define MAXMSG 1024 #define DWIDTH 132 @@ -1014,31 +1023,21 @@ char data_table[NBYTES] = { /* 9270 */ 193 }; -int i,j; -int width = DWIDTH; /* -w option: scrunch letters to 80 columns */ -int debug; -int trace; -char line[DWIDTH]; -char print[DWIDTH]; -char message[MAXMSG]; -int nchars; -int linen; -int x,y; -int term; -int pc; -int max; +char line[DWIDTH]; +char message[MAXMSG]; +char print[DWIDTH]; +int debug, i, j, linen, max, nchars, pc, term, trace, x, y; +int width = DWIDTH; /* -w option: scrunch letters to 80 columns */ +int main(argc, argv) int argc; char **argv; { - extern char *optarg; - extern int optind; int ch; - char *strcpy(), *strcat(); while ((ch = getopt(argc, argv, "w:td")) != EOF) - switch((char)ch) { + switch(ch) { case 'w': width = atoi(optarg); if (width <= 0) @@ -1058,30 +1057,11 @@ main(argc, argv) argc -= optind; argv += optind; - for (i=0; i= NCHARS || + asc_ptr[(u_char) message[i]] == 0) { + warnx("The character '%c' is not in my character set", + message[i]); j++; } - if (j) exit(1); + if (j) + exit(1); if (trace) printf("Message '%s' is OK\n",message); /* Now have message. Print it one character at a time. */ - for (i=0; i NBYTES) { + while (!term) { + if (pc < 0 || pc > NBYTES) { printf("bad pc: %d\n",pc); exit(1); } @@ -1154,13 +1137,13 @@ main(argc, argv) x = x & 63; while (x--) { if (print[linen++]) { - for (j=0; j<=max; j++) + for (j=0; j <= max; j++) if (print[j]) putchar(line[j]); putchar('\n'); } } - for (j=0; j