Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2003 13:00:23 -0800 (PST)
From:      Lyndon Nerenberg {VE6BBM} <lyndon@orthanc.ab.ca>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/7868 [almost patch]Morse Code Fixups
Message-ID:  <200303142100.h2EL0NTP039348@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/7868; it has been noted by GNATS.

From: Lyndon Nerenberg {VE6BBM} <lyndon@orthanc.ab.ca>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: bin/7868 [almost patch]Morse Code Fixups
Date: Fri, 14 Mar 2003 13:54:27 -0700

 Attached is an updated patch that applies 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:48:52
 @@ -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:48:52
 @@ -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:48:53
 @@ -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) {
 @@ -393,7 +399,7 @@
  		printf(" %s", s);
  	else
  		for (; *s; ++s)
 -			printf(" %s", *s == '.' ? "dit" : "dah");
 +			printf(" %s", *s == '.' ? *(s+1) == '\0' ? "dit" : "di" : "dah");
  	printf("\n");
  }
  

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?200303142100.h2EL0NTP039348>