1 Index: beep-1.2.2/beep.c
2 ===================================================================
3 --- beep-1.2.2.orig/beep.c
5 @@ -83,6 +83,7 @@ typedef struct beep_parms_t {
6 so that beep can be tucked appropriately into a text-
9 + int verbose; /* verbose output? */
10 struct beep_parms_t *next; /* in case -n/--new is used. */
13 @@ -110,7 +111,7 @@ void handle_signal(int signum) {
14 /* print usage and exit */
15 void usage_bail(const char *executable_name) {
16 printf("Usage:\n%s [-f freq] [-l length] [-r reps] [-d delay] "
17 - "[-D delay] [-s] [-c]\n",
18 + "[-D delay] [-s] [-c] [--verbose | --debug]\n",
20 printf("%s [Options...] [-n] [--new] [Options...] ... \n", executable_name);
21 printf("%s [-h] [--help]\n", executable_name);
22 @@ -131,6 +132,7 @@ void usage_bail(const char *executable_n
23 * "-D <delay in ms>" (similar to -d, but delay after last repetition as well)
24 * "-s" (beep after each line of input from stdin, echo line to stdout)
25 * "-c" (beep after each char of input from stdin, echo char to stdout)
26 + * "--verbose/--debug"
30 @@ -141,9 +143,11 @@ void usage_bail(const char *executable_n
31 void parse_command_line(int argc, char **argv, beep_parms_t *result) {
34 - struct option opt_list[4] = {{"help", 0, NULL, 'h'},
35 + struct option opt_list[6] = {{"help", 0, NULL, 'h'},
36 {"version", 0, NULL, 'V'},
37 {"new", 0, NULL, 'n'},
38 + {"verbose", 0, NULL, 'X'},
39 + {"debug", 0, NULL, 'X'},
41 while((c = getopt_long(argc, argv, "f:l:r:d:D:schvVn", opt_list, NULL))
43 @@ -204,9 +208,13 @@ void parse_command_line(int argc, char *
44 result->next->delay = DEFAULT_DELAY;
45 result->next->end_delay = DEFAULT_END_DELAY;
46 result->next->stdin_beep = DEFAULT_STDIN_BEEP;
47 + result->next->verbose = result->verbose;
48 result->next->next = NULL;
49 result = result->next; /* yes, I meant to do that. */
51 + case 'X' : /* --debug / --verbose */
52 + result->verbose = 1;
54 case 'h' : /* notice that this is also --help */
57 @@ -217,6 +225,11 @@ void parse_command_line(int argc, char *
58 void play_beep(beep_parms_t parms) {
59 int i; /* loop counter */
61 + if(parms.verbose == 1)
62 + fprintf(stderr, "[DEBUG] %d times %d ms beeps (%d delay between, "
63 + "%d delay after) @ %.2f Hz\n",
64 + parms.reps, parms.length, parms.delay, parms.end_delay, parms.freq);
66 /* try to snag the console */
67 if((console_fd = open("/dev/console", O_WRONLY)) == -1) {
68 fprintf(stderr, "Could not open /dev/console for writing.\n");
69 @@ -253,6 +266,7 @@ int main(int argc, char **argv) {
70 parms->delay = DEFAULT_DELAY;
71 parms->end_delay = DEFAULT_END_DELAY;
72 parms->stdin_beep = DEFAULT_STDIN_BEEP;
76 signal(SIGINT, handle_signal);