pndnotifyd: fix some crashes
[pandora-libraries.git] / test / dbusnotifytest.c
1
2 #include <stdio.h> // for stdio
3 #include <unistd.h> // for exit()
4 #include <stdlib.h> // for exit()
5 #include <time.h> // for time
6
7 #include "pnd_conf.h"
8 #include "pnd_dbusnotify.h"
9
10 int main ( int argc, char *argv[] ) {
11   pnd_dbusnotify_handle h;
12
13   h = pnd_dbusnotify_init();
14
15   time_t start = time ( NULL );
16
17   while ( time ( NULL ) - start < 20 ) {
18     printf ( "Tick %u\n", (unsigned int) ( time ( NULL ) - start ) );
19
20     if ( pnd_dbusnotify_rediscover_p ( h ) ) {
21       printf ( "Event!\n" );
22     }
23
24     fflush ( stdout );
25     sleep ( 1 );
26
27   } // while
28
29   pnd_dbusnotify_shutdown ( h );
30
31   return ( 0 );
32 }