#include <ctype.h>
#include <signal.h>
#include "beep.h"
-/* Define USG for termio a la System V. */
-#ifdef __hpux
-#define USG
-#endif
-#define FREQUENCY 800.
-#define FREQUENCY2 602.
-#define VOLUME .5
-#define WORDS_PER_MINUTE 20.
+#define FREQUENCY 800.0
+#define FREQUENCY2 602.0
+#define VOLUME 0.5
+#define ERROR_VOLUME 0.5
+#define WORDS_PER_MINUTE 20.0
#define MAX_BEHINDNESS 0
+#define ERROR_FREQUENCY 2000.0
static int whichfrequ = 0;
static float frequency1 = FREQUENCY;
static int keepquiet = 0;
static int dynamicspeed = 0;
static int charbychar = 0;
+static int international = 0;
+static int allprosigns = 0;
+static int allpunctuation = 1;
static int tryagaincount = 1;
-static float words_per_minute;
+static float words_per_minute = WORDS_PER_MINUTE;
+static float error_frequency = ERROR_FREQUENCY;
+static float error_volume = ERROR_VOLUME;
static float fwords_per_minute;
static int randomletters = 0;
#define LETMESEE 2
printf (" (implies -t)\n");
printf ("-d Dynamically speed up or slow down depending on how you are doing.\n");
printf (" (if also -s, then -d _only speeds up_!)\n");
+ printf ("-A Add ISO 8850-1 (Latin-1) signs to test set.\n");
+ printf ("-B Add uncommon punctuation to test set.\n");
+ printf ("-S Add uncommon prosigns to test set.\n");
+ printf ("-X Set error volume. Defaults to %g.\n", ERROR_VOLUME);
+ printf (" Error volume 0 means use console speaker.\n");
+ printf ("-x Set frequency of error tone, default 2000.0Hz\n");
printf ("\n");
printf ("\n");
printf ("\n");
code[(int) '/'] = "-..-.";
code[(int) '-'] = "-....-";
-#ifdef ALLPUNCTUATION
+ if (allpunctuation) {
/* Not so commonly used punctuation marks */
code[(int) ')'] = "-.--.-";
code[(int) '\"'] = ".-..-.";
code[(int) ';'] = "-.-.-.";
code[(int) '$'] = "...-..-";
code[(int) '!'] = "-.-.--";
-#endif
+ }
/* Commonly used procedure signs ("prosigns") */
code[(int) '+'] = ".-.-."; /* <AR> end of message */
code[(int) '('] = "-.--."; /* <KN> over-specified station only */
code[(int) '%'] = "...-.-"; /* <SK> end of contact, known also as <VA> */
-#ifdef ALLPROSIGNS
+ if (allprosigns) {
/* Not so commonly used procedure signs ("prosigns") */
code[(int) '^'] = ".-.-"; /* <AA> new line, the same as :a, ae */
code[(int) '#'] = "-...-.-";/* <BK> invite receiving station to transmit */
code[(int) '&'] = "-.-.-"; /* <KA> attention */
code[(int) '@'] = "...-."; /* <SN> understood */
-#endif
+ }
-#ifdef ALLINTERNATIONAL
+ if (international) {
/* Not so commonly used international extensions (ISO 8859-1) */
code[(int) ((unsigned char)'\344')] = ".-.-"; /* :a (also for ae), the same as <AA> */
if (code[(int) '^'] != NULL) code[(int) '^'] = NULL;
code[(int) ((unsigned char)'\374')] = "..--"; /* :u (also for ue) */
code[(int) ((unsigned char)'\376')] = ".--.."; /* ]p (thorn, overstrike ] with p) */
code[(int) ((unsigned char)'\247')] = ".-.-.."; /* paragraph */
-#endif
+ }
for (ii = 0; ii < TWOFIFTYSIX; ii++)
{
words_per_minute = WORDS_PER_MINUTE;
fwords_per_minute = -1.;
- /* ABDGHJKLMOPQSUVWXYZhjkouxyz are still available */
- while ((ch = getopt (argc, argv, "ABC:E:F:IM:N:R:Tabcdef:g:ilmn:p:qrstv:w:")) != EOF)
+ /* DGHJKLMOPQUVWYZhjkouyz are still available */
+ while ((ch = getopt (argc, argv, "ABC:E:F:IM:N:R:STXabcdef:g:ilmn:p:qrstv:w:x:")) != EOF)
switch ((char) ch)
{
+ case 'A':
+ international = 1;
+ break;
+ case 'B':
+ allpunctuation = 1;
+ break;
case 'C':
for (ii = 0; ii < strlen(optarg); ii++)
{
timeout *= 60;
if (timeout < 1) timeout = -1;
break;
+ case 'S':
+ allprosigns = 1;
+ break;
case 'T':
testing = 1;
showtesting = 1;
break;
+ case 'X':
+ sscanf (optarg, "%f", &error_volume);
+ break;
case 'a':
wordsafter = 1;
break;
case 'w':
sscanf (optarg, "%f", &words_per_minute);
break;
+ case 'x':
+ sscanf (optarg, "%f", &error_frequency);
+ break;
default:
fprintf (stderr, "Type \"morse\" without arguments to get self-doc!\n");
exit (1);