From b4a56b0ad7d1689e935db1f0f29f6cdfb65961fd Mon Sep 17 00:00:00 2001 From: lukem Date: Fri, 10 Oct 1997 16:38:40 +0000 Subject: WARNSify --- morse/morse.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'morse') diff --git a/morse/morse.c b/morse/morse.c index a9045018..a23e7fa5 100644 --- a/morse/morse.c +++ b/morse/morse.c @@ -1,4 +1,4 @@ -/* $NetBSD: morse.c,v 1.3 1995/03/23 08:35:24 cgd Exp $ */ +/* $NetBSD: morse.c,v 1.4 1997/10/10 16:38:40 lukem Exp $ */ /* * Copyright (c) 1988, 1993 @@ -33,22 +33,23 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1988, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: morse.c,v 1.3 1995/03/23 08:35:24 cgd Exp $"; +__RCSID("$NetBSD: morse.c,v 1.4 1997/10/10 16:38:40 lukem Exp $"); #endif #endif /* not lint */ -#include #include +#include +#include static char *digit[] = { @@ -92,18 +93,21 @@ static char "--..", }; +int main __P((int, char *[])); +void morse __P((int)); +void show __P((char *)); + static int sflag; +int main(argc, argv) int argc; char **argv; { - extern char *optarg; - extern int optind; - register int ch; - register char *p; + int ch; + char *p; - while ((ch = getopt(argc, argv, "s")) != EOF) + while ((ch = getopt(argc, argv, "s")) != -1) switch((char)ch) { case 's': sflag = 1; @@ -123,10 +127,12 @@ main(argc, argv) } while (*++argv); else while ((ch = getchar()) != EOF) morse(ch); + exit(0); } +void morse(c) - register int c; + int c; { if (isalpha(c)) show(alph[c - (isupper(c) ? 'A' : 'a')]); @@ -140,8 +146,9 @@ morse(c) show(" ...\n"); } +void show(s) - register char *s; + char *s; { if (sflag) printf(" %s", s); -- cgit v1.2.3-56-ge451