#define CLOCK_TICK_RATE 1193180
#endif
-#define VERSION_STRING "beep-1.2.2"
+#define VERSION_STRING "beep-1.3"
char *copyright =
"Copyright (C) Johnathan Nightingale, 2002. "
"Use and Distribution subject to GPL. "
} else {
/* BEEP_TYPE_EVDEV */
struct input_event e;
-
+
e.type = EV_SND;
e.code = SND_TONE;
e.value = freq;
-
+
write(console_fd, &e, sizeof(struct input_event));
}
}
/* If we get interrupted, it would be nice to not leave the speaker beeping in
perpetuity. */
void handle_signal(int signum) {
-
+
if(console_device)
free(console_device);
-
+
switch(signum) {
case SIGINT:
if(console_fd >= 0) {
/* print usage and exit */
void usage_bail(const char *executable_name) {
printf("Usage:\n%s [-f freq] [-l length] [-r reps] [-d delay] "
- "[-D delay] [-s] [-c] [-e device]\n",
+ "[-D delay] [-s] [-c] [--verbose | --debug] [-e device]\n",
executable_name);
printf("%s [Options...] [-n] [--new] [Options...] ... \n", executable_name);
printf("%s [-h] [--help]\n", executable_name);
else
if((console_fd = open("/dev/tty0", O_WRONLY)) == -1)
console_fd = open("/dev/vc/0", O_WRONLY);
-
+
if(console_fd == -1) {
fprintf(stderr, "Could not open %s for writing\n",
console_device != NULL ? console_device : "/dev/tty0 or /dev/vc/0");
do_beep(parms.freq);
/* Look ma, I'm not ansi C compatible! */
usleep(1000*parms.length); /* wait... */
- do_beep(0);
+ do_beep(0); /* stop beep */
if(parms.end_delay || (i+1 < parms.reps))
usleep(1000*parms.delay); /* wait... */
} /* repeat. */
if(console_device)
free(console_device);
-
+
return EXIT_SUCCESS;
}