# for various hardware and software reasons. You may be better off using
# morseOSS than morseLinux.
#
+# Running on Mac OS X:
+# (1) Use X11. The user must, as with any X11 client, set the DISPLAY
+# variable, and have the X server running. Finally, the X11 output
+# preferences dialog should have "Use system alert effect" unchecked;
+# otherwise, the system alert (settable, but unlikely to be useful to
+# copy code in any event) will be used instead of the X beep.
+#
# Adding a new device is as simple as creating a new implementation of the
# beep.h interface. See beep*.c for examples. Please send any additions
# to the authors!
int yourchar;
float randexp, randnum;
extern time_t time ();
+struct sigaction handler;
if (argc == 1 && isatty (fileno (stdin)))
{
printf (" Set the total number of words (groups) to generate.\n");
printf ("-C \'STRING\' (default all available characters)\n");
printf (" Select characters to send from this STRING only.\n");
- printf ("-w words_per_minute (default %g)\n-f frequency_in_hertz (default %g)\n-v volume (zero to one, rather nonlinear, default %g)\n",
- WORDS_PER_MINUTE, FREQUENCY, VOLUME);
- printf ("-g alternate_frequency (default %g)\n (toggles via control-G in input FILE at a word break)\n", FREQUENCY2);
+ printf ("-w words_per_minute (default %g)\n", WORDS_PER_MINUTE);
+ printf ("-f frequency_in_hertz (default %g)\n", FREQUENCY);
+ printf ("-v volume (zero to one, rather nonlinear, default %g)\n",
+ VOLUME);
+ printf ("-g alternate_frequency (default %g)\n", FREQUENCY2);
+ printf (" (toggles via control-G in input FILE at a word break)\n");
printf ("-F Farnsworth_character_words_per_minute\n");
printf ("-e leave off the <SK> sound at the end\n");
printf ("-c complain about illegal characters instead of just ignoring them\n");
time(&starttime);
- sigset (SIGINT, die);
- sigset (SIGTERM, die);
- sigset (SIGQUIT, die);
- sigset (SIGTSTP, suspend);
+ handler.sa_handler = die;
+ handler.sa_mask = handler.sa_flags = 0;
+ sigaction (SIGINT, &handler, NULL);
+ sigaction (SIGTERM, &handler, NULL);
+ sigaction (SIGQUIT, &handler, NULL);
+ handler.sa_handler = suspend;
+ sigaction (SIGTSTP, &handler, NULL);
if (testing || typeaway)
{
#include <sys/ioctl.h>
#include <fcntl.h>
-#include <termio.h>
-struct termio oldtermgtty;
-struct termio termgtty;
+#include <termios.h>
+struct termios oldtermgtty;
+struct termios termgtty;
static char *terminal = "/dev/tty";
static int termfd;
static int termopen = 0;
/* get parameters and open terminal */
termfd = open (terminal, O_RDWR | O_NDELAY, 0);
- ioctl (termfd, TCGETA, &termgtty);
+ tcgetattr(termfd, &termgtty);
oldtermgtty = termgtty;
if (typeaway != LETMESEE)
termgtty.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
termgtty.c_lflag &= ~ICANON;
termgtty.c_cc[VMIN] = 1;
termgtty.c_cc[VTIME] = 0;
- ioctl (termfd, TCSETAW, &termgtty);
+ tcsetattr(termfd, TCSADRAIN, &termgtty);
termopen = 1;
}
static void
closeterminal (void)
{
- ioctl (termfd, TCSETAW, &oldtermgtty);
+ tcsetattr(termfd, TCSADRAIN, &oldtermgtty);
close (termfd);
}
static void
suspend (int sig)
{
- sigset (SIGTSTP, suspend);
+#ifdef SIGTSTP
+ sigset (SIGTSTP, suspend); */
+#endif /* SIGTSTP */
cleanup ();
kill (getpid (), SIGSTOP);
if (termopen)