/* 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.
* 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,
//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 );
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