From owner-freebsd-bugs Tue Sep 8 20:10:13 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA07999 for freebsd-bugs-outgoing; Tue, 8 Sep 1998 20:10:13 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA07912 for ; Tue, 8 Sep 1998 20:10:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id UAA04078; Tue, 8 Sep 1998 20:10:01 -0700 (PDT) Received: from thingfish.v-wave.com (thingfish.v-wave.com [24.108.17.129]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA06468 for ; Tue, 8 Sep 1998 20:05:28 -0700 (PDT) (envelope-from lyndon@thingfish.v-wave.com) Received: (from lyndon@localhost) by thingfish.v-wave.com (8.9.1/8.9.1) id VAA02319; Tue, 8 Sep 1998 21:05:14 -0600 (MDT) Message-Id: <199809090305.VAA02319@thingfish.v-wave.com> Date: Tue, 8 Sep 1998 21:05:14 -0600 (MDT) From: lyndon@orthanc.ab.ca Reply-To: lyndon@orthanc.ab.ca To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/7868: Morse Code Fixups Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 7868 >Category: bin >Synopsis: Morse Code Fixups >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 8 20:10:01 PDT 1998 >Last-Modified: >Originator: >Organization: The Frobozz Magic Homing Pigeon Company >Release: FreeBSD 2.2.7-STABLE i386 >Environment: >Description: * Make audio support conditional on __FreeBSD__ instead of via explicit CFLAGS setting in the Makefile. * Fixed the output grammar to properly speak non-terminal dits. >How-To-Repeat: >Fix: In /usr/src/games/morse: =================================================================== RCS file: Makefile,v retrieving revision 1.1 diff -u -r1.1 Makefile --- Makefile 1998/09/09 02:39:40 1.1 +++ Makefile 1998/09/09 02:40:16 @@ -2,6 +2,5 @@ PROG= morse NOMAN= noman -CFLAGS += -DSPEAKER=\"/dev/speaker\" .include =================================================================== RCS file: morse.c,v retrieving revision 1.1 diff -u -r1.1 morse.c --- morse.c 1998/09/09 02:39:47 1.1 +++ morse.c 1998/09/09 02:50:00 @@ -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 @@ -50,10 +50,10 @@ #include #include #include - -#ifdef SPEAKER -#include -#include +#include +#ifdef __FreeBSD__ +# include +# include #endif struct morsetab { @@ -194,7 +194,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) @@ -243,10 +243,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 */ @@ -255,7 +255,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; @@ -319,14 +321,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++) { >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message