tag 509842 patch
quit

Hi Radu,

first, I see that you've fixed debian bug #533536 in SVN, thanks for
that!

next, I wonder what your thoughts are on Bug #509842
( http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=509842 ).

I've attached a patch which adds support to inotifywatch for
outputting the table on SIGUSR1, could you please include it?

Cheers,
Ryan

-- 
_________________________
Ryan Niebur
[email protected]
diff --git a/src/inotifywatch.c b/src/inotifywatch.c
index fe0d738..cb412d6 100644
--- a/src/inotifywatch.c
+++ b/src/inotifywatch.c
@@ -75,15 +75,26 @@ void handle_signal( int signal __attribute__((unused)) ) {
        done = true;
 }
 
+int print_info();
+
+void print_info_now( int signal __attribute__((unused)) ) {
+    print_info();
+    printf("\n");
+}
+
+int events;
+int sort;
+int zero;
+
 int main(int argc, char ** argv)
 {
-       int events = 0;
+       events = 0;
        int timeout = 0;
        int verbose = 0;
-       int zero = 0;
+       zero = 0;
        int recursive = 0;
        char * fromfile = 0;
-       int sort = -1;
+       sort = -1;
        done = false;
        char * regex = NULL;
        char * iregex = NULL;
@@ -183,6 +194,7 @@ int main(int argc, char ** argv)
                signal( SIGALRM, handle_signal );
                alarm( timeout );
        }
+        signal( SIGUSR1, print_info_now );
 
        inotifytools_initialize_stats();
        // Now wait till we get event
@@ -256,8 +268,12 @@ int main(int argc, char ** argv)
                }
 
        } while ( !done );
+        return print_info();
+}
 
-       num_watches = inotifytools_get_num_watches();
+int print_info() {
+        unsigned int num_watches = 0;
+        num_watches = inotifytools_get_num_watches();
 
        if ( !inotifytools_get_stat_total( 0 ) ) {
                fprintf( stderr, "No events occurred.\n" );

Attachment: signature.asc
Description: Digital signature

Reply via email to