From owner-freebsd-bugs Sun Mar 28 14:57:31 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from thingfish.v-wave.com (thingfish.v-wave.com [24.108.17.129]) by hub.freebsd.org (Postfix) with ESMTP id 357A715730; Sun, 28 Mar 1999 14:57:23 -0800 (PST) (envelope-from lyndon@thingfish.v-wave.com) Received: from thingfish.v-wave.com (localhost.orthanc.ab.ca [127.0.0.1] (may be forged)) by thingfish.v-wave.com (2.1/8.9.1/Execmail 2.1) with ESMTP id PAA67745; Sun, 28 Mar 1999 15:57:03 -0700 (MST) Message-Id: <199903282257.PAA67745@thingfish.v-wave.com> X-Mailer: exmh version 2.0.2 2/24/98 To: Poul-Henning Kamp Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/7868 In-reply-to: Your message of "Thu, 17 Sep 1998 02:00:58 PDT." <199809170900.CAA25695@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 28 Mar 1999 15:56:59 -0700 From: lyndon@orthanc.ab.ca Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 =================================================================== 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) - * + * Taught to send *real* morse by Lyndon Nerenberg (VE6BBM) + * */ #ifndef lint @@ -52,7 +52,8 @@ #include #include -#ifdef SPEAKER +#include +#ifdef __FreeBSD__ #include #include #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) . +added by Lyndon Nerenberg (VE6BBM) . .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