From 6e40531b7e674b6cf20ff9d43c3068071de6e0a8 Mon Sep 17 00:00:00 2001 From: skeezix Date: Wed, 25 Feb 2009 13:17:45 -0500 Subject: [PATCH] Switched -u to -n for pnd_run Made -u optional, now requires a flag ORed in to get it Made rel_startdir optional Made a few args required --- include/pnd_apps.h | 6 ++++-- lib/pnd_apps.c | 28 +++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/include/pnd_apps.h b/include/pnd_apps.h index 117e9fe..e24dfd7 100644 --- a/include/pnd_apps.h +++ b/include/pnd_apps.h @@ -29,6 +29,8 @@ extern "C" { /* pnd_apps_exec() is used to blindly launch an app, be it a .pnd file bundle or a plain executable * (shell, bin, whatever.) pndrun specifies the full path to the pnd_run sh script, which should be * found using searchpaths and locates.. see locatetest.c for a sample + * pnd_run, fullpath, unique_id, rel_exec required + * rel_startdir, clockspeed, options are optional * NOTE: Use pnd_locate function to locate the pnd_run, for example * NOTE: if specified, clock speed will be set prior to invoking the script, and set back on exit * NOTE: No values can be except clockspeed; a 0 clockspeed means 'leave alone'. Set startdoir to "." instead of NULL. @@ -39,8 +41,8 @@ extern "C" { * example: options = PND_EXEC_OPTION_BLOCK | PND_EXEC_OPTION_2; */ #define PND_EXEC_OPTION_NIL 0 -#define PND_EXEC_OPTION_BLOCK 1 -#define PND_EXEC_OPTION_FUTURE 2 +#define PND_EXEC_OPTION_BLOCK 1 /* wait till children complete; note, children might fork on their own.. */ +#define PND_EXEC_OPTION_NOUNION 2 /* request pnd_run not use a union, just do the mount/run */ #define PND_EXEC_OPTION_FUTURE2 4 unsigned char pnd_apps_exec ( char *pndrun, char *fullpath, char *unique_id, diff --git a/lib/pnd_apps.c b/lib/pnd_apps.c index 8ed92f9..4a2cf94 100644 --- a/lib/pnd_apps.c +++ b/lib/pnd_apps.c @@ -20,6 +20,22 @@ unsigned char pnd_apps_exec ( char *pndrun, char *fullpath, char *unique_id, //printf ( "Entering pnd_apps_exec\n" ); + if ( ! pndrun ) { + return ( 0 ); + } + + if ( ! fullpath ) { + return ( 0 ); + } + + if ( ! unique_id ) { + return ( 0 ); + } + + if ( ! rel_exec ) { + return ( 0 ); + } + #if 0 printf ( " runscript: %s\n", pndrun ); printf ( " path: %s\n", fullpath ); @@ -37,14 +53,20 @@ unsigned char pnd_apps_exec ( char *pndrun, char *fullpath, char *unique_id, argv [ f++ ] = fullpath; argv [ f++ ] = "-e"; argv [ f++ ] = rel_exec; - argv [ f++ ] = "-s"; - argv [ f++ ] = rel_startdir; + if ( rel_startdir ) { + argv [ f++ ] = "-s"; + argv [ f++ ] = rel_startdir; + } // skip -a (arguments) for now //argv [ f++ ] = "-b"; //argv [ f++ ] = baename; - argv [ f++ ] = "-u"; // no union for now + if ( options & PND_EXEC_OPTION_NOUNION ) { + argv [ f++ ] = "-n"; // no union for now + } + + // finish argv [ f++ ] = NULL; // for execv // debug -- 2.39.2