X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=minimenu%2Fmmenu.c;h=78313f5018ac2f577bdd837d0949230703eb23ee;hb=e7c888f5321c521e6b5b4d0fab3237b8373147af;hp=6ff5babaae407122af157a378d0f4ae8150ea8f0;hpb=e60400f406ec9f5eddf6fa23da85fdb092e2ec30;p=pandora-libraries.git diff --git a/minimenu/mmenu.c b/minimenu/mmenu.c index 6ff5bab..78313f5 100644 --- a/minimenu/mmenu.c +++ b/minimenu/mmenu.c @@ -24,15 +24,19 @@ * c) user performsn some operation (set clock, copy files, whatever) -> probably stays within the menu */ -#include -#include -#include -#include -#include -#include +#include /* for FILE etc */ +#include /* for malloc */ +#include /* for unlink */ +#include /* for PATH_MAX */ #include #include +#define __USE_GNU /* for strcasestr */ +#include /* for making ftw.h happy */ +#include +#include #include +#include +#include // for sigaction #include "pnd_logger.h" #include "pnd_pxml.h" @@ -42,6 +46,11 @@ #include "pnd_discovery.h" #include "pnd_locate.h" #include "pnd_device.h" +#include "pnd_pndfiles.h" +#include "../lib/pnd_pathiter.h" +#include "pnd_notify.h" +#include "pnd_dbusnotify.h" +#include "pnd_apps.h" #include "mmenu.h" #include "mmwrapcmd.h" @@ -50,13 +59,26 @@ #include "mmcat.h" #include "mmui.h" -pnd_box_handle *g_active_apps = NULL; +pnd_box_handle g_active_apps = NULL; unsigned int g_active_appcount = 0; char g_username [ 128 ]; // since we have to wait for login (!!), store username here pnd_conf_handle g_conf = 0; +pnd_conf_handle g_desktopconf = 0; char *pnd_run_script = NULL; -char *g_skinpath = NULL; +unsigned char g_x11_present = 1; // >0 if X is present +unsigned char g_catmap = 0; // if 1, we're doing category mapping +unsigned char g_pvwcache = 0; // if 1, we're trying to do preview caching +unsigned char g_autorescan = 1; // default to auto rescan + +pnd_dbusnotify_handle dbh = 0; // if >0, dbusnotify is active +pnd_notify_handle nh = 0; // if >0, inotify is active + +char g_skin_selected [ 100 ] = "default"; +char *g_skinpath = NULL; // where 'skin_selected' is located .. the fullpath including skin-dir-name +pnd_conf_handle g_skinconf = NULL; + +void sigquit_handler ( int n ); int main ( int argc, char *argv[] ) { int logall = -1; // -1 means normal logging rules; >=0 means log all! @@ -154,12 +176,70 @@ int main ( int argc, char *argv[] ) { emit_and_quit ( MM_QUIT ); } + g_desktopconf = pnd_conf_fetch_by_id ( pnd_conf_desktop, PND_CONF_SEARCHPATH ); + + if ( ! g_desktopconf ) { + pnd_log ( pndn_error, "ERROR: Couldn't fetch desktop conf file\n" ); + emit_and_quit ( MM_QUIT ); + } + + /* set up quit signal handler + */ + sigset_t ss; + sigemptyset ( &ss ); + + struct sigaction siggy; + siggy.sa_handler = sigquit_handler; + siggy.sa_mask = ss; /* implicitly blocks the origin signal */ + siggy.sa_flags = SA_RESTART; /* don't need anything */ + sigaction ( SIGQUIT, &siggy, NULL ); + + /* category conf file + */ + { + char *locater = pnd_locate_filename ( pnd_conf_get_as_char ( g_conf, "categories.catmap_searchpath" ), + pnd_conf_get_as_char ( g_conf, "categories.catmap_confname" ) ); + + if ( locater ) { + pnd_log ( pndn_rem, "Found category conf at '%s'\n", locater ); + pnd_conf_handle h = pnd_conf_fetch_by_path ( locater ); + if ( h ) { + // lets just merge the skin conf onto the regular conf, so it just magicly works + pnd_box_append ( g_conf, h ); + } + } else { + pnd_log ( pndn_debug, "No additional category conf file found.\n" ); + } + + } // cat conf + // redo log filter pnd_log_set_filter ( pnd_conf_get_as_int_d ( g_conf, "minimenu.loglevel", pndn_error ) ); /* setup */ + // X11? + if ( pnd_conf_get_as_char ( g_conf, "minimenu.x11_present_sh" ) ) { + FILE *fx = popen ( pnd_conf_get_as_char ( g_conf, "minimenu.x11_present_sh" ), "r" ); + char buffer [ 100 ]; + if ( fx ) { + if ( fgets ( buffer, 100, fx ) ) { + if ( atoi ( buffer ) ) { + g_x11_present = 1; + pnd_log ( pndn_rem, "X11 seems to be present [pid %u]\n", atoi(buffer) ); + } else { + g_x11_present = 0; + pnd_log ( pndn_rem, "X11 seems NOT to be present\n" ); + } + } else { + g_x11_present = 0; + pnd_log ( pndn_rem, "X11 seems NOT to be present\n" ); + } + pclose ( fx ); + } + } // x11? + // pnd_run.sh pnd_run_script = pnd_locate_filename ( pnd_conf_get_as_char ( g_conf, "minimenu.pndrun" ), "pnd_run.sh" ); @@ -172,28 +252,67 @@ int main ( int argc, char *argv[] ) { pnd_log ( pndn_rem, "Found pnd_run.sh at '%s'\n", pnd_run_script ); - // figure out skin path - if ( ! pnd_conf_get_as_char ( g_conf, MMENU_ARTPATH ) || - ! pnd_conf_get_as_char ( g_conf, "minimenu.font" ) - ) - { - pnd_log ( pndn_error, "ERROR: Couldn't set up skin!\n" ); - emit_and_quit ( MM_QUIT ); + // auto rescan? + if ( pnd_conf_get_as_int ( g_conf, "minimenu.auto_rescan" ) != PND_CONF_BADNUM ) { + g_autorescan = pnd_conf_get_as_int ( g_conf, "minimenu.auto_rescan" ); + } + pnd_log ( pndn_debug, "application rescan is set to: %s\n", g_autorescan ? "auto" : "manual" ); + + // figure out what skin is selected (or default) + FILE *f; + char *s = strdup ( pnd_conf_get_as_char ( g_conf, "minimenu.skin_selected" ) ); + s = pnd_expand_tilde ( s ); + if ( ( f = fopen ( s, "r" ) ) ) { + char buffer [ 100 ]; + if ( fgets ( buffer, 100, f ) ) { + // see if that dir can be located + if ( strchr ( buffer, '\n' ) ) { + * strchr ( buffer, '\n' ) = '\0'; + } + char *found = pnd_locate_filename ( pnd_conf_get_as_char ( g_conf, "minimenu.skin_searchpath" ), buffer ); + if ( found ) { + strncpy ( g_skin_selected, buffer, 100 ); + g_skinpath = strdup ( found ); + } else { + pnd_log ( pndn_warning, "Couldn't locate skin named '%s' so falling back.\n", buffer ); + } + } + fclose ( f ); } + free ( s ); - g_skinpath = pnd_locate_filename ( pnd_conf_get_as_char ( g_conf, MMENU_ARTPATH ), - pnd_conf_get_as_char ( g_conf, "minimenu.font" ) ); + if ( g_skinpath ) { + pnd_log ( pndn_rem, "Skin is selected: '%s'\n", g_skin_selected ); + } else { + pnd_log ( pndn_rem, "Skin falling back to: '%s'\n", g_skin_selected ); + + char *found = pnd_locate_filename ( pnd_conf_get_as_char ( g_conf, "minimenu.skin_searchpath" ), + g_skin_selected ); + if ( found ) { + g_skinpath = strdup ( found ); + } else { + pnd_log ( pndn_error, "Couldn't locate skin named '%s'.\n", g_skin_selected ); + emit_and_quit ( MM_QUIT ); + } - if ( ! g_skinpath ) { - pnd_log ( pndn_error, "ERROR: Couldn't locate skin font!\n" ); - emit_and_quit ( MM_QUIT ); } + pnd_log ( pndn_rem, "Skin path determined to be: '%s'\n", g_skinpath ); - g_skinpath = strdup ( g_skinpath ); // so we don't lose it next pnd_locate + // lets see if this skin-path actually has a skin conf + { + char fullpath [ PATH_MAX ]; + sprintf ( fullpath, "%s/%s", g_skinpath, pnd_conf_get_as_char ( g_conf, "minimenu.skin_confname" ) ); + g_skinconf = pnd_conf_fetch_by_path ( fullpath ); + } - * strstr ( g_skinpath, pnd_conf_get_as_char ( g_conf, "minimenu.font" ) ) = '\0'; + // figure out skin path if we didn't get it already + if ( ! g_skinconf ) { + pnd_log ( pndn_error, "ERROR: Couldn't set up skin!\n" ); + emit_and_quit ( MM_QUIT ); + } - pnd_log ( pndn_debug, "Looks like skin is at '%s'\n", g_skinpath ); + // lets just merge the skin conf onto the regular conf, so it just magicly works + pnd_box_append ( g_conf, g_skinconf ); // attempt to set up UI if ( ! ui_setup() ) { @@ -204,43 +323,244 @@ int main ( int argc, char *argv[] ) { // show load screen ui_loadscreen(); + // store flag if we're doing preview caching or not + if ( pnd_conf_get_as_int_d ( g_conf, "previewpic.do_cache", 0 ) ) { + g_pvwcache = 1; + } + // set up static image cache if ( ! ui_imagecache ( g_skinpath ) ) { pnd_log ( pndn_error, "ERROR: Couldn't set up static UI image cache!\n" ); emit_and_quit ( MM_QUIT ); } + // create all cat + if ( pnd_conf_get_as_int_d ( g_conf, "categories.do_all_cat", 1 ) ) { + category_push ( g_x11_present ? CATEGORY_ALL " (X11)" : CATEGORY_ALL " (No X11)", NULL /*app*/, 0, NULL /* fspath */ ); + } + + // set up category mappings + if ( pnd_conf_get_as_int_d ( g_conf, "categories.map_on", 0 ) ) { + g_catmap = category_map_setup(); + } + /* inhale applications, icons, categories, etc */ + applications_scan(); + + /* actual work now + */ + unsigned char block = 1; + + if ( g_autorescan ) { + block = 0; + + // set up notifications + dbh = pnd_dbusnotify_init(); + pnd_log ( pndn_debug, "Setting up dbusnotify\n" ); + //setup_notifications(); + + } // set up rescan + + while ( 1 ) { // forever! + + // show the menu, or changes thereof + ui_render(); + + // wait for input or time-based events (like animations) + // deal with inputs + ui_process_input ( block /* block */ ); + + // did a rescan event trigger? + if ( g_autorescan ) { + unsigned char watch_dbus = 0; + unsigned char watch_inotify = 0; + + if ( dbh ) { + watch_dbus = pnd_dbusnotify_rediscover_p ( dbh ); + } + + if ( nh ) { + watch_inotify = pnd_notify_rediscover_p ( nh ); + } + + if ( watch_dbus || watch_inotify ) { + pnd_log ( pndn_debug, "dbusnotify detected SD event\n" ); + applications_free(); + applications_scan(); + } + + } // rescan? + + // sleep? block? + usleep ( 5000 ); + + } // while + + return ( 0 ); +} + +void emit_and_quit ( char *s ) { + printf ( "%s\n", s ); + pnd_dbusnotify_shutdown ( dbh ); + if ( nh ) { + pnd_notify_shutdown ( nh ); + } + exit ( 0 ); +} + +static unsigned int is_dir_empty ( char *fullpath ) { + DIR *d = opendir ( fullpath ); + + if ( ! d ) { + return ( 0 ); // not empty, since we don't know + } + + struct dirent *de = readdir ( d ); + + while ( de ) { + + if ( strcmp ( de -> d_name, "." ) == 0 ) { + // irrelevent + } else if ( strcmp ( de -> d_name, ".." ) == 0 ) { + // irrelevent + } else { + // something else came in, so dir must not be empty + closedir ( d ); + return ( 0 ); + } + + de = readdir ( d ); + } + + closedir ( d ); + + return ( 1 ); // dir is empty +} + +void applications_free ( void ) { + + // free up all our category apprefs, but keep the preview and icon cache's.. + category_freeall(); + + // free up old disco_t + if ( g_active_apps ) { + pnd_disco_t *p = pnd_box_get_head ( g_active_apps ); + pnd_disco_t *n; + while ( p ) { + n = pnd_box_get_next ( p ); + pnd_disco_destroy ( p ); + p = n; + } + pnd_box_delete ( g_active_apps ); + } + + return; +} + +void applications_scan ( void ) { // show disco screen ui_discoverscreen ( 1 /* clear screen */ ); // determine current app list, cache icons - pnd_log ( pndn_debug, "Looking for pnd applications here: %s\n", pnd_conf_get_as_char ( g_conf, MMENU_APP_SEARCHPATH ) ); - g_active_apps = pnd_disco_search ( pnd_conf_get_as_char ( g_conf, MMENU_APP_SEARCHPATH ), NULL ); // ignore overrides for now + // - ignore overrides for now + + g_active_apps = 0; + pnd_box_handle merge_apps = 0; + + // desktop apps? + if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.desktop_apps", 1 ) ) { + pnd_log ( pndn_debug, "Looking for pnd applications here: %s\n", + pnd_conf_get_as_char ( g_desktopconf, "desktop.searchpath" ) ); + g_active_apps = pnd_disco_search ( pnd_conf_get_as_char ( g_desktopconf, "desktop.searchpath" ), NULL ); + } + + // menu apps? + if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.menu_apps", 1 ) ) { + pnd_log ( pndn_debug, "Looking for pnd applications here: %s\n", + pnd_conf_get_as_char ( g_desktopconf, "menu.searchpath" ) ); + merge_apps = pnd_disco_search ( pnd_conf_get_as_char ( g_desktopconf, "menu.searchpath" ), NULL ); + } + + // merge lists + if ( merge_apps ) { + if ( g_active_apps ) { + // got menu apps, and got desktop apps, merge + pnd_box_append ( g_active_apps, merge_apps ); + } else { + // got menu apps, had no desktop apps, so just assign + g_active_apps = merge_apps; + } + } + + // aux apps? + char *aux_apps = NULL; + merge_apps = 0; + aux_apps = pnd_conf_get_as_char ( g_conf, "minimenu.aux_searchpath" ); + if ( aux_apps && aux_apps [ 0 ] ) { + pnd_log ( pndn_debug, "Looking for pnd applications here: %s\n", aux_apps ); + merge_apps = pnd_disco_search ( aux_apps, NULL ); + } + + // merge aux apps + if ( merge_apps ) { + if ( g_active_apps ) { + pnd_box_append ( g_active_apps, merge_apps ); + } else { + g_active_apps = merge_apps; + } + } + + // do it g_active_appcount = pnd_box_get_size ( g_active_apps ); unsigned char maxwidth, maxheight; - maxwidth = pnd_conf_get_as_int_d ( g_conf, MMENU_DISP_ICON_MAX_WIDTH, 50 ); - maxheight = pnd_conf_get_as_int_d ( g_conf, MMENU_DISP_ICON_MAX_HEIGHT, 50 ); + maxwidth = pnd_conf_get_as_int_d ( g_conf, "grid.icon_max_width", 50 ); + maxheight = pnd_conf_get_as_int_d ( g_conf, "grid.icon_max_height", 50 ); // show cache screen ui_cachescreen ( 1 /* clear screen */, NULL ); pnd_log ( pndn_debug, "Found pnd applications, and caching icons:\n" ); pnd_disco_t *iter = pnd_box_get_head ( g_active_apps ); + unsigned int itercount = 0; while ( iter ) { //pnd_log ( pndn_debug, " App: '%s'\n", IFNULL(iter->title_en,"No Name") ); // update cachescreen - ui_cachescreen ( 1 /* clear screen */, IFNULL(iter->title_en,"No Name") ); + // ... every 5 filenames, just to avoid slowing it too much + if ( itercount % 5 == 0 ) { + ui_cachescreen ( 0 /* clear screen */, IFNULL(iter->title_en,"No Name") ); + } - // cache the icon - if ( iter -> pnd_icon_pos && - ! cache_icon ( iter, maxwidth, maxheight ) ) - { - pnd_log ( pndn_warning, " Couldn't load icon: '%s'\n", IFNULL(iter->title_en,"No Name") ); + // if an ovr was flagged by libpnd, lets go inhale it just so we've got the + // notes handy, since notes are not handled by libpnd proper + pnd_conf_handle ovrh = 0; + if ( iter -> object_flags & PND_DISCO_FLAG_OVR ) { + char ovrfile [ PATH_MAX ]; + char *fixpxml; + sprintf ( ovrfile, "%s/%s", iter -> object_path, iter -> object_filename ); + fixpxml = strcasestr ( ovrfile, PND_PACKAGE_FILEEXT ); + strcpy ( fixpxml, PXML_SAMEPATH_OVERRIDE_FILEEXT ); + + ovrh = pnd_conf_fetch_by_path ( ovrfile ); + +#if 0 + if ( ovrh ) { + pnd_log ( pndn_debug, "Found ovr file for %s # %u\n", iter -> object_filename, iter -> subapp_number ); + } +#endif + + } // ovr + + // cache the icon, unless deferred + if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.load_icons_later", 0 ) == 0 ) { + if ( iter -> pnd_icon_pos && + ! cache_icon ( iter, maxwidth, maxheight ) ) + { + pnd_log ( pndn_warning, " Couldn't load icon: '%s'\n", IFNULL(iter->title_en,"No Name") ); + } } // cache the preview --> SHOULD DEFER @@ -253,81 +573,133 @@ int main ( int argc, char *argv[] ) { } } // preview now? - // push to All category - // we do this first, so first category is always All - if ( ! category_push ( CATEGORY_ALL, iter ) ) { - pnd_log ( pndn_warning, " Couldn't categorize to All: '%s'\n", IFNULL(iter -> title_en, "No Name") ); - } - - // push the categories + // push the categories .. or suppress application // + if ( ( pnd_pxml_get_x11 ( iter -> option_no_x11 ) != pnd_pxml_x11_required ) || + ( pnd_pxml_get_x11 ( iter -> option_no_x11 ) == pnd_pxml_x11_required && g_x11_present == 1 ) + ) + { - // main categories - if ( iter -> main_category && pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat", 1 ) ) { - if ( ! category_push ( iter -> main_category, iter ) ) { - pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> main_category, IFNULL(iter -> title_en, "No Name") ); - } - } + // push to All category + // we do this first, so first category is always All + if ( pnd_conf_get_as_int_d ( g_conf, "categories.do_all_cat", 1 ) ) { + category_push ( g_x11_present ? CATEGORY_ALL " (X11)" : CATEGORY_ALL " (No X11)", iter, ovrh, NULL /* fspath */ ); + } // all? - if ( iter -> main_category1 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat1", 0 ) ) { - if ( ! category_push ( iter -> main_category1, iter ) ) { - pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> main_category1, IFNULL(iter -> title_en, "No Name") ); - } - } + // main categories + category_meta_push ( iter -> main_category, NULL /* no parent cat */, iter, ovrh, pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat", 1 ) ); + category_meta_push ( iter -> main_category1, iter -> main_category, iter, ovrh, pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat1", 0 ) ); + category_meta_push ( iter -> main_category2, iter -> main_category, iter, ovrh, pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat2", 0 ) ); + // alt categories + category_meta_push ( iter -> alt_category, NULL /* no parent cat */, iter, ovrh, pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat", 0 ) ); + category_meta_push ( iter -> alt_category1, iter -> alt_category, iter, ovrh, pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat1", 0 ) ); + category_meta_push ( iter -> alt_category2, iter -> alt_category, iter, ovrh, pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat2", 0 ) ); - if ( iter -> main_category2 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_maincat2", 0 ) ) { - if ( ! category_push ( iter -> main_category2, iter ) ) { - pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> main_category2, IFNULL(iter -> title_en, "No Name") ); - } - } + } // register with categories or filter out - // alt categories - if ( iter -> alt_category && pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat", 0 ) ) { - if ( ! category_push ( iter -> alt_category, iter ) ) { - pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> alt_category, IFNULL(iter -> title_en, "No Name") ); - } - } + // next + iter = pnd_box_get_next ( iter ); + itercount++; + } // while - if ( iter -> alt_category1 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat1", 0 ) ) { - if ( ! category_push ( iter -> alt_category1, iter ) ) { - pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> alt_category1, IFNULL(iter -> title_en, "No Name") ); + // sort (some) categories + category_sort(); + + // set up filesystem browser tabs + if ( pnd_conf_get_as_int_d ( g_conf, "filesystem.do_browser", 0 ) ) { + char *searchpath = pnd_conf_get_as_char ( g_conf, "filesystem.tab_searchpaths" ); + + SEARCHPATH_PRE + { + char *c, *tabname; + c = strrchr ( buffer, '/' ); + if ( c && (*(c+1)!='\0') ) { + tabname = c; + } else { + tabname = buffer; } - } - if ( iter -> alt_category2 && pnd_conf_get_as_int_d ( g_conf, "tabs.top_altcat2", 0 ) ) { - if ( ! category_push ( iter -> alt_category2, iter ) ) { - pnd_log ( pndn_warning, " Couldn't categorize to %s: '%s'\n", iter -> alt_category2, IFNULL(iter -> title_en, "No Name") ); + // check if dir is empty; if so, skip it. + if ( ! is_dir_empty ( buffer ) ) { + category_push ( tabname /* tab name */, NULL /* app */, 0 /* override */, buffer /* fspath */ ); } + } + SEARCHPATH_POST - // next - iter = pnd_box_get_next ( iter ); - } // while + } // set up fs browser tabs // dump categories //category_dump(); - /* actual work now - */ + // let deferred icon cache go now + ui_post_scan(); - while ( 1 ) { // forever! + return; +} - // show the menu, or changes thereof - ui_render ( CHANGED_NOTHING ); +void sigquit_handler ( int n ) { + pnd_log ( pndn_rem, "SIGQUIT received; graceful exit.\n" ); + emit_and_quit ( MM_QUIT ); +} - // wait for input or time-based events (like animations) - // deal with inputs - ui_process_input ( 1 /* block */ ); +void setup_notifications ( void ) { - // sleep? block? - usleep ( 5000 ); + // figure out notify path + char *configpath; + char *notifypath = NULL; - } // while + configpath = pnd_conf_query_searchpath(); - return ( 0 ); -} + pnd_conf_handle apph; -void emit_and_quit ( char *s ) { - printf ( "%s\n", s ); - exit ( 0 ); + apph = pnd_conf_fetch_by_id ( pnd_conf_apps, configpath ); + + if ( apph ) { + + notifypath = pnd_conf_get_as_char ( apph, PND_APPS_NOTIFY_KEY ); + + if ( ! notifypath ) { + notifypath = PND_APPS_NOTIFYPATH; + } + + } + + // given notify path.. ripped from pndnotifyd :( + char *searchpath = notifypath; + + // if this is first time through, we can just set it up; for subsequent times + // through, we need to close existing fd and re-open it, since we're too lame + // to store the list of watches and 'rm' them +#if 1 + if ( nh ) { + pnd_notify_shutdown ( nh ); + nh = 0; + } +#endif + + // set up a new set of notifies + if ( ! nh ) { + nh = pnd_notify_init(); + } + + if ( ! nh ) { + pnd_log ( pndn_rem, "INOTIFY failed to init.\n" ); + exit ( -1 ); + } + +#if 0 + pnd_log ( pndn_rem, "INOTIFY is up.\n" ); +#endif + + SEARCHPATH_PRE + { + + pnd_log ( pndn_rem, "Watching path '%s' and its descendents.\n", buffer ); + pnd_notify_watch_path ( nh, buffer, PND_NOTIFY_RECURSE ); + + } + SEARCHPATH_POST + + return; }