From 30d011b5fa6d982d19d74d2a5e442a99f94a6caa Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 24 Jan 2005 19:40:35 +0000 Subject: [PATCH] Assume we have srand48()/lrand48(). --- HISTORY | 2 +- Makefile | 9 +-------- morse.c | 36 +++--------------------------------- morse.spec | 13 +++++++------ 4 files changed, 12 insertions(+), 48 deletions(-) diff --git a/HISTORY b/HISTORY index de716b1..4234cca 100644 --- a/HISTORY +++ b/HISTORY @@ -38,7 +38,7 @@ Eric S. Raymond , January 2005: Changed ERROR_FREQUENCY to runtime -x option. Changed ERROR_VOLUME to runtime -X option. Dropped BSD signal and tty support, it's all POSIX now. - Wrote the manual page. + QSO assumes that srand48/lrand48 is available, so morse will too. Wrote the manual page. Updated all code to use ANSI prototypes. diff --git a/Makefile b/Makefile index 288e3a3..5af8cba 100644 --- a/Makefile +++ b/Makefile @@ -19,22 +19,15 @@ #DEVICE = Linux DEVICE = OSS -# -# For alternate random number generator, add either -DUSELRAND for lrand48(), -# or -DUSERAND for (ugh) rand(). Default is -DUSERANDOM for random(). -#DEFINES = -DUSELRAND -#DEFINES = - VERS=$(shell sed > 9) + (long) (time (NULL))) >> 4) + (((lrand48() >> 9) + (long) (time (NULL))) >> 4) & 0x00FFFFFF); randnum = randnum - randexp * (int) (randnum / randexp); if ((randnum >= 1.) && (linepos != 0)) dowords ((int) ' '); @@ -1855,7 +1825,7 @@ static long norepeat; */ do { - ranspot = ((RANDOM () >> 4) % sum + norepeat) % sum; + ranspot = ((lrand48() >> 4) % sum + norepeat) % sum; sum2 = 0; for (ii = 0; ii < TWOFIFTYSIX - 1; ii++) diff --git a/morse.spec b/morse.spec index a83db22..8ad0a29 100644 --- a/morse.spec +++ b/morse.spec @@ -8,12 +8,13 @@ URL: http://catb.org/~esr/morse/ Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-root -%description -morse is a training program for aspiring radio hams. It can generate -random tests or simulated QSOs resembling those used in the ARRL test -(a QSO generator is included). There are a plethora of options to -vary the training method. In one mode, it will take text input from -standard input and render it as more beeps. +%description +morse is a Morse-code training program for aspiring radio hams. It +can generate random tests or simulated QSOs resembling those used in +the ARRL test (a QSO generator is included). There are a plethora of +options to vary the training method. In one of the simpler modes, +this program will take text from standard input and render it as +Morse-code beeps. %prep %setup -q -- 2.43.0