summaryrefslogtreecommitdiffstats
path: root/morse/morse.c
diff options
context:
space:
mode:
Diffstat (limited to 'morse/morse.c')
-rw-r--r--morse/morse.c33
1 files changed, 20 insertions, 13 deletions
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 <sys/cdefs.h>
#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 <stdio.h>
#include <ctype.h>
+#include <stdio.h>
+#include <unistd.h>
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);