]> git.deb.at Git - pkg/beep.git/blobdiff - beep.c
Add package description suggestions (closes: #630161)
[pkg/beep.git] / beep.c
diff --git a/beep.c b/beep.c
index 814a0b31f245ca22c83c4ce2bd4a5246b0358fb0..452fc08376393f6cde807911fea3fc37e61c9f9c 100644 (file)
--- a/beep.c
+++ b/beep.c
@@ -48,7 +48,7 @@
 #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.  "
@@ -108,11 +108,11 @@ void do_beep(int freq) {
   } 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));
   }
 }
@@ -121,10 +121,10 @@ void do_beep(int freq) {
 /* 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) {
@@ -142,7 +142,7 @@ void handle_signal(int signum) {
 /* 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);
@@ -276,10 +276,9 @@ void play_beep(beep_parms_t parms) {
   if(console_device)
     console_fd = open(console_device, O_WRONLY);
   else
-    if((console_fd = open("/dev/input/event0", O_WRONLY)) == -1)
-      if((console_fd = open("/dev/tty0", O_WRONLY)) == -1)
-       console_fd = open("/dev/vc/0", O_WRONLY);
-      
+    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");
@@ -298,7 +297,7 @@ void play_beep(beep_parms_t parms) {
     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.    */
@@ -363,6 +362,6 @@ int main(int argc, char **argv) {
 
   if(console_device)
     free(console_device);
-    
+
   return EXIT_SUCCESS;
 }