eventmap: use Yen (Fn-l) to switch layers as F12 conflicts
[pandora-libraries.git] / lib / pnd_apps.c
index fd5d566..92a4b7a 100644 (file)
@@ -40,6 +40,10 @@ unsigned char pnd_apps_exec_disco ( char *pndrun, pnd_disco_t *app,
     return ( 0 );
   }
 
+  if ( options & PND_EXEC_OPTION_INFO && ! reserved ) {
+    return ( 0 );
+  }
+
   // determine path to pnd-file
   sprintf ( fullpath, "%s/%s", app -> object_path, app -> object_filename );
 
@@ -52,14 +56,25 @@ unsigned char pnd_apps_exec_disco ( char *pndrun, pnd_disco_t *app,
   argv [ f++ ] = "-p";
   argv [ f++ ] = fullpath;
   argv [ f++ ] = "-e";
-  argv [ f++ ] = app -> exec;
+  if ( options & PND_EXEC_OPTION_INFO ) {
+    argv [ f++ ] = ((pnd_apps_exec_info_t*)reserved) -> viewer;
+  } else {
+    argv [ f++ ] = app -> exec;
+  }
   if ( app -> startdir ) {
     argv [ f++ ] = "-s";
     argv [ f++ ] = app -> startdir;
   }
-  if ( app -> execargs ) {
-    argv [ f++ ] = "-a";
-    argv [ f++ ] = app -> execargs;
+  if ( options & PND_EXEC_OPTION_INFO ) {
+    if ( ((pnd_apps_exec_info_t*)reserved) -> args ) {
+      argv [ f++ ] = "-a";
+      argv [ f++ ] = ((pnd_apps_exec_info_t*)reserved) -> args;
+    }
+  } else {
+    if ( app -> execargs ) {
+      argv [ f++ ] = "-a";
+      argv [ f++ ] = app -> execargs;
+    }
   }
   if ( app -> appdata_dirname ) {
     argv [ f++ ] = "-b";
@@ -68,9 +83,14 @@ unsigned char pnd_apps_exec_disco ( char *pndrun, pnd_disco_t *app,
     argv [ f++ ] = "-b";
     argv [ f++ ] = app -> unique_id;
   }
-  if ( app -> clockspeed ) {
-    argv [ f++ ] = "-c";
-    argv [ f++ ] = app -> clockspeed;
+
+  if ( options & PND_EXEC_OPTION_INFO ) {
+    // we don't need to overclock for showing info :) do we? crazy active .js pages maybe?
+  } else {
+    if ( app -> clockspeed ) {
+      argv [ f++ ] = "-c";
+      argv [ f++ ] = app -> clockspeed;
+    }
   }
 
   // skip -a (arguments) for now
@@ -117,10 +137,27 @@ unsigned char pnd_apps_exec_disco ( char *pndrun, pnd_disco_t *app,
       if ( quotenext ) {
        quotenext = 0;
       } else {
+       // deprecated; need to handle spaces in some additional args
+       //   if ( strcmp ( argv [ i ], "-a" ) == 0 ) {
        // if this is for -a, we need to wrap with quotes
-       if ( strcmp ( argv [ i ], "-a" ) == 0 ) {
+       // ivanovic:
+       // to allow spaces in filenames we have to add quotes around most terms!
+       // terms with quotes:
+       // -a additional arguments
+       // -p fullpath to pnd
+       // -e name of execuatable inside the pnd
+       // -s startdir
+       // -b name for the appdir
+
+       if ( ( strcmp ( argv [ i ], "-a" ) == 0 ) ||
+            ( strcmp ( argv [ i ], "-p" ) == 0 ) ||
+            ( strcmp ( argv [ i ], "-e" ) == 0 ) ||
+            ( strcmp ( argv [ i ], "-s" ) == 0 ) ||
+            ( strcmp ( argv [ i ], "-b" ) == 0 ) )
+       {
          quotenext = 1;
        }
+
       }
 
     } // for
@@ -144,7 +181,7 @@ unsigned char pnd_apps_exec_disco ( char *pndrun, pnd_disco_t *app,
   } else {
     // child, do it
     execv ( pndrun, argv );
-  } 
+  }
 
   // by definition, either error occurred or we are the original application.
 
@@ -252,3 +289,4 @@ unsigned char pnd_get_appdata_path ( char *fullpath, char *unique_id, char *r_pa
 
   return ( 1 );
 }
+