Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Mar 1999 15:56:59 -0700
From:      lyndon@orthanc.ab.ca
To:        Poul-Henning Kamp <phk@FreeBSD.ORG>
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/7868 
Message-ID:  <199903282257.PAA67745@thingfish.v-wave.com>
In-Reply-To: Your message of "Thu, 17 Sep 1998 02:00:58 PDT." <199809170900.CAA25695@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
  Old Synopsis: Morse Code Fixups
  New Synopsis: [almost patch]Morse Code Fixups

  State-Changed-From-To: open-suspended
  State-Changed-By: phk
  State-Changed-When: Thu Sep 17 02:00:26 PDT 1998
  State-Changed-Why: 
  the patch doesn't apply cleanly in -current

Here's a revised patch (against todays head). It will need a
feature test for the Alpha architecture if that doesn't support
/dev/speaker.

===================================================================
RCS file: morse/Makefile,v
retrieving revision 1.1
diff -u -r1.1 morse/Makefile
--- morse/Makefile	1999/03/28 22:48:55	1.1
+++ morse/Makefile	1999/03/28 22:49:50
@@ -3,8 +3,4 @@
 PROG=	morse
 NOMAN=	noman
 
-.if ${MACHINE_ARCH} == "i386"
-CFLAGS += -DSPEAKER=\"/dev/speaker\"
-.endif
-
 .include <bsd.prog.mk>
===================================================================
RCS file: morse/morse.c,v
retrieving revision 1.1
diff -u -r1.1 morse/morse.c
--- morse/morse.c	1999/03/28 22:40:40	1.1
+++ morse/morse.c	1999/03/28 22:46:50
@@ -32,8 +32,8 @@
  */
 
 /*
- * Taught to send *real* morse by Lyndon Nerenberg (VE7TCP/VE6BBM)
- * <lyndon@orthanc.com>
+ * Taught to send *real* morse by Lyndon Nerenberg (VE6BBM)
+ * <lyndon@orthanc.ab.ca>
  */
 
 #ifndef lint
@@ -52,7 +52,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef SPEAKER
+#include <sys/param.h>
+#ifdef __FreeBSD__
 #include <machine/speaker.h>
 #include <fcntl.h>
 #endif
@@ -195,7 +196,7 @@
 #define FREQUENCY 600
 static int      freq = FREQUENCY;
 
-#ifdef SPEAKER
+#ifdef __FreeBSD__
 #define DASH_LEN 3
 #define CHAR_SPACE 3
 #define WORD_SPACE (7 - CHAR_SPACE - 1)
@@ -244,10 +245,10 @@
 	if (pflag && (freq == 0))
 		freq = FREQUENCY;
 
-#ifdef SPEAKER
+#ifdef __FreeBSD__
 	if (pflag) {
-		if ((spkr = open(SPEAKER, O_WRONLY, 0)) == -1) {
-			perror(SPEAKER);
+		if ((spkr = open("/dev/speaker", O_WRONLY, 0)) == -1) {
+			perror("/dev/speaker");
 			exit(1);
 		}
 		dot_clock = wpm / 2.4;		/* dots/sec */
@@ -256,7 +257,9 @@
 						/* the dot rate */
 		dot_clock = dot_clock * 100;	/* scale for ioctl */
 	}
-#endif
+#else /* ! __FreeBSD__ */
+	errx(1, "audio not supported on this platform");
+#endif /* ! __FreeBSD__ */
 	argc -= optind;
 	argv += optind;
 
@@ -320,14 +323,14 @@
 		printf(" %s", s);
 	else
 		for (; *s; ++s)
-			printf(" %s", *s == '.' ? "dit" : "dah");
+			printf(" %s", *s == '.' ? *(s+1) == '\0' ? "dit" : "di" : "dah");
 	printf("\n");
 }
 
 void
 play(const char *s)
 {
-#ifdef SPEAKER
+#ifdef __FreeBSD__
 	const char *c;
 
 	for (c = s; *c != '\0'; c++) {
@@ -363,5 +366,5 @@
 	sound.frequency = 0;
 	sound.duration = dot_clock * CHAR_SPACE;
 	ioctl(spkr, SPKRTONE, &sound);
-#endif
+#endif /* __FreeBSD__ */
 }
===================================================================
RCS file: bcd/bcd.6,v
retrieving revision 1.1
diff -u -r1.1 bcd/bcd.6
--- bcd/bcd.6	1999/03/28 22:51:15	1.1
+++ bcd/bcd.6	1999/03/28 22:52:31
@@ -133,10 +133,12 @@
 .Sh HISTORY
 Sound support for
 .Nm morse
-added by Lyndon Nerenberg (VE7TCP/VE6BBM) <lyndon@orthanc.com>.
+added by Lyndon Nerenberg (VE6BBM) <lyndon@orthanc.ab.ca>.
 .Sh BUGS
 Does only understand a few European characters (namely German and
 French), but neither Asian ones, or the continental landline code.
+.Pp
+Weighted sending isn't supported.
 .Pp
 Sends a bit slower than it should due to system overhead. Some people
 would call this a feature.




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903282257.PAA67745>