Date: Fri, 14 Mar 2003 13:18:14 -0700
From: Lyndon Nerenberg {VE6BBM} <lyndon@orthanc.ab.ca>
To: freebsd-bugs@freebsd.org
Subject: Re: bin/7868: morse(6) fixups
Message-ID: <200303142018.h2EKIEKU065233@orthanc.ab.ca>
index | next in thread | raw e-mail
Here is an updated patch against 5.0-RELEASE.
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/games/morse/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile 2001/03/26 14:20:58 1.7
+++ Makefile 2003/03/14 20:17:23
@@ -4,8 +4,4 @@
PROG= morse
MAN= morse.6
-.if ${MACHINE_ARCH} == "i386"
-CFLAGS += -DSPEAKER=\"/dev/speaker\"
-.endif
-
.include <bsd.prog.mk>
Index: morse.6
===================================================================
RCS file: /home/ncvs/src/games/morse/morse.6,v
retrieving revision 1.10
diff -u -r1.10 morse.6
--- morse.6 2001/08/07 15:48:28 1.10
+++ morse.6 2003/03/14 20:17:23
@@ -135,7 +135,8 @@
.Sh FILES
.Bl -tag -width /dev/speaker -compact
.It Pa /dev/speaker
-speaker device file
+.Xr speaker 4
+device file
.El
.Sh ENVIRONMENT
If your
@@ -158,7 +159,7 @@
Sound support for
.Nm
added by
-.An Lyndon Nerenberg (VE7TCP/VE6BBM) Aq lyndon@orthanc.com .
+.An Lyndon Nerenberg (VE6BBM) Aq lyndon@orthanc.ab.ca .
.Pp
Ability to key an external device added by
.An J\(:org Wunsch
Index: morse.c
===================================================================
RCS file: /home/ncvs/src/games/morse/morse.c,v
retrieving revision 1.14
diff -u -r1.14 morse.c
--- morse.c 2001/06/26 01:43:52 1.14
+++ morse.c 2003/03/14 20:17:23
@@ -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
@@ -63,9 +63,13 @@
#include <termios.h>
#include <unistd.h>
-#ifdef SPEAKER
-#include <machine/speaker.h>
-#endif
+#include <sys/param.h>
+#if defined(__FreeBSD__) && defined(__i386__) /* spkr(4) exists only on */
+ /* Intel platforms. */
+# define SPEAKER
+# include <machine/speaker.h>
+# include <fcntl.h>
+#endif /* __FreeBSD__ && __i386__ */
struct morsetab {
char inchar;
@@ -276,17 +280,19 @@
if ((pflag || device) && (freq == 0))
freq = FREQUENCY;
-#ifdef SPEAKER
if (pflag) {
- if ((spkr = open(SPEAKER, O_WRONLY, 0)) == -1) {
- perror(SPEAKER);
+#ifdef SPEAKER
+ if ((spkr = open("/dev/speaker", O_WRONLY, 0)) == -1) {
+ perror("/dev/speaker");
exit(1);
}
+#else /* ! SPEAKER */
+ errx(1, "speaker device not supported on this platform");
+#endif /* ! SPEAKER */
} else
-#endif
if (device) {
if ((line = open(device, O_WRONLY | O_NONBLOCK)) == -1) {
- perror("open tty line");
+ perror(device);
exit(1);
}
if (tcgetattr(line, &otty) == -1) {
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303142018.h2EKIEKU065233>
