[Midnightbsd-cvs] src [11893] trunk/games/morse/morse.c: reformat

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Jul 17 20:56:07 EDT 2018


Revision: 11893
          http://svnweb.midnightbsd.org/src/?rev=11893
Author:   laffer1
Date:     2018-07-17 20:56:07 -0400 (Tue, 17 Jul 2018)
Log Message:
-----------
reformat

Modified Paths:
--------------
    trunk/games/morse/Makefile
    trunk/games/morse/morse.6
    trunk/games/morse/morse.c

Property Changed:
----------------
    trunk/games/morse/morse.6

Modified: trunk/games/morse/Makefile
===================================================================
--- trunk/games/morse/Makefile	2018-07-18 00:55:51 UTC (rev 11892)
+++ trunk/games/morse/Makefile	2018-07-18 00:56:07 UTC (rev 11893)
@@ -1,12 +1,8 @@
+# $MidnightBSD$
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
-# $FreeBSD: src/games/morse/Makefile,v 1.7.14.1 2005/11/16 10:50:10 ru Exp $
-# $MidnightBSD$
+# $FreeBSD: stable/10/games/morse/Makefile 203479 2010-02-04 07:08:06Z imp $
 
 PROG=	morse
 MAN=	morse.6
 
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
-CFLAGS += -DSPEAKER=\"/dev/speaker\"
-.endif
-
 .include <bsd.prog.mk>

Modified: trunk/games/morse/morse.6
===================================================================
--- trunk/games/morse/morse.6	2018-07-18 00:55:51 UTC (rev 11892)
+++ trunk/games/morse/morse.6	2018-07-18 00:56:07 UTC (rev 11893)
@@ -1,39 +1,35 @@
-." Copyright (c) 2000 Alexey Zelkin.  All rights reserved.
-." Copyright (c) 1988, 1991, 1993
-."	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
-." are met:
-." 1. Redistributions of source code must retain the above copyright
-."    notice, this list of conditions and the following disclaimer.
-." 2. Redistributions in binary form must reproduce the above copyright
-."    notice, this list of conditions and the following disclaimer in the
-."    documentation and/or other materials provided with the distribution.
-." 3. All advertising materials mentioning features or use of this software
-."    must display the following acknowledgement:
-."	This product includes software developed by the University of
-."	California, Berkeley and its contributors.
-." 4. Neither the name of the University nor the names of its contributors
-."    may be used to endorse or promote products derived from this software
-."    without specific prior written permission.
-."
-." THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-." IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-." ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-." FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-." DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-." OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-." HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-." LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-." OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-." SUCH DAMAGE.
-."
-."	@(#)bcd.6	8.1 (Berkeley) 5/31/93
-." $FreeBSD: src/games/morse/morse.6,v 1.17 2005/06/07 21:43:16 ru Exp $
-." $MidnightBSD$
-."
+.\" $MidnightBSD$
+.\" Copyright (c) 2000 Alexey Zelkin.  All rights reserved.
+.\" Copyright (c) 1988, 1991, 1993
+.\"	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
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"	@(#)bcd.6	8.1 (Berkeley) 5/31/93
+.\" $FreeBSD: stable/10/games/morse/morse.6 307403 2016-10-16 22:02:50Z sevan $
+.\"
 .Dd June 7, 2005
 .Dt MORSE 6
 .Os
@@ -128,7 +124,7 @@
 .Ql =
 for
 .Em BT ,
-.Ql &(
+.Ql \&(
 for
 .Em KN
 and
@@ -173,7 +169,8 @@
 .Sh FILES
 .Bl -tag -width ".Pa /dev/speaker" -compact
 .It Pa /dev/speaker
-speaker device file
+.Xr speaker 4
+device file
 .El
 .Sh SEE ALSO
 .Xr speaker 4
@@ -181,10 +178,10 @@
 Sound support for
 .Nm
 added by
-.An Lyndon Nerenberg (VE7TCP/VE6BBM) Aq lyndon at orthanc.com .
+.An Lyndon Nerenberg (VE6BBM) Aq Mt lyndon at orthanc.ca .
 .Pp
 Ability to key an external device added by
-.An J(:org Wunsch
+.An J\(:org Wunsch
 (DL8DTL).
 .Pp
 Farnsworth support for


Property changes on: trunk/games/morse/morse.6
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/games/morse/morse.c
===================================================================
--- trunk/games/morse/morse.c	2018-07-18 00:55:51 UTC (rev 11892)
+++ trunk/games/morse/morse.c	2018-07-18 00:56:07 UTC (rev 11893)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1988, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -10,11 +11,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -32,8 +29,8 @@
  */
 
 /*
- * Taught to send *real* morse by Lyndon Nerenberg (VE7TCP/VE6BBM)
- * <lyndon at orthanc.com>
+ * Taught to send *real* morse by Lyndon Nerenberg (VE6BBM)
+ * <lyndon at orthanc.ca>
  */
 
 #ifndef lint
@@ -47,7 +44,7 @@
 static char sccsid[] = "@(#)morse.c	8.1 (Berkeley) 5/31/93";
 #endif
 static const char rcsid[] =
- "$FreeBSD: src/games/morse/morse.c,v 1.20.2.1 2005/11/16 10:50:10 ru Exp $";
+ "$FreeBSD: stable/10/games/morse/morse.c 230131 2012-01-15 13:23:01Z uqs $";
 #endif /* not lint */
 
 #include <sys/time.h>
@@ -63,13 +60,16 @@
 #include <termios.h>
 #include <unistd.h>
 
+/* Always use the speaker, let the open fail if -p is selected */
+#define SPEAKER "/dev/speaker"
+
 #ifdef SPEAKER
 #include <dev/speaker/speaker.h>
 #endif
 
 struct morsetab {
-	char            inchar;
-	char           *morse;
+	const char      inchar;
+	const char     *morse;
 };
 
 static const struct morsetab mtab[] = {
@@ -144,120 +144,125 @@
 	{'\0', ""}
 };
 
-
+/*
+ * Code-points for some Latin1 chars in ISO-8859-1 encoding.
+ * UTF-8 encoded chars in the comments.
+ */
 static const struct morsetab iso8859_1tab[] = {
-	{'\xE1', ".--.-"},
-	{'\xE0', ".--.-"},
-	{'\xE2', ".--.-"},
-	{'\xE4', ".-.-"},
-	{'\xE7', "-.-.."},
-	{'\xE9', "..-.."},
-	{'\xE8', "..-.."},
-	{'\xEA', "-..-."},
-	{'\xF6', "---."},
-	{'\xFC', "..--"},
+	{'\340', ".--.-"},	/* à */
+	{'\341', ".--.-"},	/* á */
+	{'\342', ".--.-"},	/* â */
+	{'\344', ".-.-"},	/* ä */
+	{'\347', "-.-.."},	/* ç */
+	{'\350', "..-.."},	/* è */
+	{'\351', "..-.."},	/* é */
+	{'\352', "-..-."},	/* ê */
+	{'\366', "---."},	/* ö */
+	{'\374', "..--"},	/* ü */
 
 	{'\0', ""}
 };
 
+/*
+ * Code-points for some Greek chars in ISO-8859-7 encoding.
+ * UTF-8 encoded chars in the comments.
+ */
 static const struct morsetab iso8859_7tab[] = {
 	/*
-	 * The greek alphabet; you'll need an 8859-7 font in order
-	 * to see the actual characters.
 	 * This table does not implement:
 	 * - the special sequences for the seven diphthongs,
 	 * - the punctuation differences.
 	 * Implementing these features would introduce too many
 	 * special-cases in the program's main loop.
-	 * The diphtong sequences are:
+	 * The diphthong sequences are:
 	 * alpha iota		.-.-
 	 * alpha upsilon	..--
 	 * epsilon upsilon	---.
 	 * eta upsilon		...-
-	 * omikron iota		---..
-	 * omikron upsilon	..-
+	 * omicron iota		---..
+	 * omicron upsilon	..-
 	 * upsilon iota		.---
 	 * The different punctuation symbols are:
 	 * ;	..-.-
 	 * !	--..--
 	 */
-	{'\xE1', ".-"},	/* alpha */
-	{'\xDC', ".-"},	/* alpha with acute */
-	{'\xE2', "-..."},	/* beta */
-	{'\xE3', "--."},	/* gamma */
-	{'\xE4', "-.."},	/* delta */
-	{'\xE5', "."},	/* epsilon */
-	{'\xDD', "."},	/* epsilon with acute */
-	{'\xE6', "--.."},	/* zeta */
-	{'\xE7', "...."},	/* eta */
-	{'\xDE', "...."},	/* eta with acute */
-	{'\xE8', "-.-."},	/* theta */
-	{'\xE9', ".."},	/* iota */
-	{'\xDF', ".."},	/* iota with acute */
-	{'\xFA', ".."},	/* iota with diairesis */
-	{'\xC0', ".."},	/* iota with acute and diairesis */
-	{'\xEA', "-.-"},	/* kappa */
-	{'\xEB', ".-.."},	/* lamda */
-	{'\xEC', "--"},	/* mu */
-	{'\xED', "-."},	/* nu */
-	{'\xEE', "-..-"},	/* xi */
-	{'\xEF', "---"},	/* omicron */
-	{'\xFC', "---"},	/* omicron with acute */
-	{'\xF0', ".--."},	/* pi */
-	{'\xF1', ".-."},	/* rho */
-	{'\xF3', "..."},	/* sigma */
-	{'\xF2', "..."},	/* final sigma */
-	{'\xF4', "-"},	/* tau */
-	{'\xF5', "-.--"},	/* upsilon */
-	{'\xFD', "-.--"},	/* upsilon with acute */
-	{'\xFB', "-.--"},	/* upsilon and diairesis */
-	{'\xE0', "-.--"},	/* upsilon with acute and diairesis */
-	{'\xF6', "..-."},	/* phi */
-	{'\xF7', "----"},	/* chi */
-	{'\xF8', "--.-"},	/* psi */
-	{'\xF9', ".--"},	/* omega */
-	{'\xFE', ".--"},	/* omega with acute */
+	{'\341', ".-"},		/* α, alpha */
+	{'\334', ".-"},		/* ά, alpha with acute */
+	{'\342', "-..."},	/* β, beta */
+	{'\343', "--."},	/* γ, gamma */
+	{'\344', "-.."},	/* δ, delta */
+	{'\345', "."},		/* ε, epsilon */
+	{'\335', "."},		/* έ, epsilon with acute */
+	{'\346', "--.."},	/* ζ, zeta */
+	{'\347', "...."},	/* η, eta */
+	{'\336', "...."},	/* ή, eta with acute */
+	{'\350', "-.-."},	/* θ, theta */
+	{'\351', ".."},		/* ι, iota */
+	{'\337', ".."},		/* ί, iota with acute */
+	{'\372', ".."},		/* ϊ, iota with diaeresis */
+	{'\300', ".."},		/* ΐ, iota with acute and diaeresis */
+	{'\352', "-.-"},	/* κ, kappa */
+	{'\353', ".-.."},	/* λ, lambda */
+	{'\354', "--"},		/* μ, mu */
+	{'\355', "-."},		/* ν, nu */
+	{'\356', "-..-"},	/* ξ, xi */
+	{'\357', "---"},	/* ο, omicron */
+	{'\374', "---"},	/* ό, omicron with acute */
+	{'\360', ".--."},	/* π, pi */
+	{'\361', ".-."},	/* ρ, rho */
+	{'\363', "..."},	/* σ, sigma */
+	{'\362', "..."},	/* ς, final sigma */
+	{'\364', "-"},		/* τ, tau */
+	{'\365', "-.--"},	/* υ, upsilon */
+	{'\375', "-.--"},	/* ύ, upsilon with acute */
+	{'\373', "-.--"},	/* ϋ, upsilon and diaeresis */
+	{'\340', "-.--"},	/* ΰ, upsilon with acute and diaeresis */
+	{'\366', "..-."},	/* φ, phi */
+	{'\367', "----"},	/* χ, chi */
+	{'\370', "--.-"},	/* ψ, psi */
+	{'\371', ".--"},	/* ω, omega */
+	{'\376', ".--"},	/* ώ, omega with acute */
 
 	{'\0', ""}
 };
 
+/*
+ * Code-points for the Cyrillic alphabet in KOI8-R encoding.
+ * UTF-8 encoded chars in the comments.
+ */
 static const struct morsetab koi8rtab[] = {
-	/*
-	 * the cyrillic alphabet; you'll need a KOI8R font in order
-	 * to see the actual characters
-	 */
-	{'\xC1', ".-"},		/* a */
-	{'\xC2', "-..."},	/* be */
-	{'\xD7', ".--"},	/* ve */
-	{'\xC7', "--."},	/* ge */
-	{'\xC4', "-.."},	/* de */
-	{'\xC5', "."},		/* ye */
-	{'\xA3', "."},         	/* yo, the same as ye */
-	{'\xD6', "...-"},	/* she */
-	{'\xDA', "--.."},	/* ze */
-	{'\xC9', ".."},		/* i */
-	{'\xCA', ".---"},	/* i kratkoye */
-	{'\xCB', "-.-"},	/* ka */
-	{'\xCC', ".-.."},	/* el */
-	{'\xCD', "--"},		/* em */
-	{'\xCE', "-."},		/* en */
-	{'\xCF', "---"},	/* o */
-	{'\xD0', ".--."},	/* pe */
-	{'\xD2', ".-."},	/* er */
-	{'\xD3', "..."},	/* es */
-	{'\xD4', "-"},		/* te */
-	{'\xD5', "..-"},	/* u */
-	{'\xC6', "..-."},	/* ef */
-	{'\xC8', "...."},	/* kha */
-	{'\xC3', "-.-."},	/* ce */
-	{'\xDE', "---."},	/* che */
-	{'\xDB', "----"},	/* sha */
-	{'\xDD', "--.-"},	/* shcha */
-	{'\xD9', "-.--"},	/* yi */
-	{'\xD8', "-..-"},	/* myakhkij znak */
-	{'\xDC', "..-.."},	/* ae */
-	{'\xC0', "..--"},	/* yu */
-	{'\xD1', ".-.-"},	/* ya */
+	{'\301', ".-"},		/* а, a */
+	{'\302', "-..."},	/* б, be */
+	{'\327', ".--"},	/* в, ve */
+	{'\307', "--."},	/* г, ge */
+	{'\304', "-.."},	/* д, de */
+	{'\305', "."},		/* е, ye */
+	{'\243', "."},		/* ё, yo, the same as ye */
+	{'\326', "...-"},	/* ж, she */
+	{'\332', "--.."},	/* з, ze */
+	{'\311', ".."},		/* и, i */
+	{'\312', ".---"},	/* й, i kratkoye */
+	{'\313', "-.-"},	/* к, ka */
+	{'\314', ".-.."},	/* л, el */
+	{'\315', "--"},		/* м, em */
+	{'\316', "-."},		/* н, en */
+	{'\317', "---"},	/* о, o */
+	{'\320', ".--."},	/* п, pe */
+	{'\322', ".-."},	/* р, er */
+	{'\323', "..."},	/* с, es */
+	{'\324', "-"},		/* т, te */
+	{'\325', "..-"},	/* у, u */
+	{'\306', "..-."},	/* ф, ef */
+	{'\310', "...."},	/* х, kha */
+	{'\303', "-.-."},	/* ц, ce */
+	{'\336', "---."},	/* ч, che */
+	{'\333', "----"},	/* ш, sha */
+	{'\335', "--.-"},	/* щ, shcha */
+	{'\331', "-.--"},	/* ы, yi */
+	{'\330', "-..-"},	/* ь, myakhkij znak */
+	{'\334', "..-.."},	/* э, ae */
+	{'\300', "..--"},	/* ю, yu */
+	{'\321', ".-.-"},	/* я, ya */
 
 	{'\0', ""}
 };
@@ -306,9 +311,9 @@
 
 	while ((ch = getopt(argc, argv, GETOPTOPTS)) != -1)
 		switch ((char) ch) {
- 		case 'c':
- 			cpm = atoi(optarg);
- 			break;
+		case 'c':
+			cpm = atoi(optarg);
+			break;
 		case 'd':
 			device = optarg;
 			break;
@@ -483,7 +488,8 @@
 		printf(" %s\n", s);
 	} else {
 		for (; *s; ++s)
-			printf(" %s", *s == '.' ? "dit" : "dah");
+			printf(" %s", *s == '.' ? *(s + 1) == '\0' ? "dit" :
+			    "di" : "dah");
 		printf("\n");
 	}
 }



More information about the Midnightbsd-cvs mailing list