Skip to content

Commit

Permalink
Add -d and -t flags to usage. Add usage().
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Charnier authored and Philippe Charnier committed Mar 26, 2000
1 parent 66f8a9c commit eb257e6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
25 changes: 18 additions & 7 deletions usr.bin/banner/banner.6
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,34 @@
.Nd print large banner on printer
.Sh SYNOPSIS
.Nm banner
.Op Fl w Ar n
.Op Fl d
.Op Fl t
.Op Fl w Ar width
.Ar message ...
.Sh DESCRIPTION
.Nm Banner
prints a large, high quality banner on the standard output.
If the message is omitted, it prompts for and reads one line of its
standard input.
If
.Fl w
is given, the output is changed from a width of 132 to
.Ar n ,
suitable for a narrow terminal.
.Pp
The output should be printed on paper of the appropriate width,
with no breaks between the pages.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl d
Enable debug.
.It Fl t
Enable trace.
.It Fl w Ar width
Change the output from a width of 132 to
.Ar width ,
suitable for a narrow terminal.
.El
.Sh BUGS
Several ASCII characters are not defined, notably <, >, [, ], \\,
Several
.Tn ASCII
characters are not defined, notably <, >, [, ], \\,
^, _, {, }, |, and ~.
Also, the characters ", ', and & are funny looking (but in a useful way.)
.Pp
Expand Down
14 changes: 11 additions & 3 deletions usr.bin/banner/banner.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,8 @@ 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 */

static void usage __P((void));

int
main(argc, argv)
int argc;
Expand All @@ -1049,8 +1051,7 @@ main(argc, argv)
break;
case '?':
default:
(void)fprintf(stderr, "usage: banner [-w width]\n");
exit(1);
usage();
}
argc -= optind;
argv += optind;
Expand Down Expand Up @@ -1109,7 +1110,7 @@ main(argc, argv)
for (i = 0; i < nchars; i++)
if ((u_char) message[i] >= NCHARS ||
asc_ptr[(u_char) message[i]] == 0) {
warnx("The character '%c' is not in my character set",
warnx("the character '%c' is not in my character set",
message[i]);
j++;
}
Expand Down Expand Up @@ -1169,3 +1170,10 @@ main(argc, argv)
free(message);
exit(0);
}

static void
usage()
{
fprintf(stderr, "usage: banner [-d] [-t] [-w width] message ...\n");
exit(1);
}

0 comments on commit eb257e6

Please sign in to comment.