+
+// for Pleng
+// Goal: normally menu will quit when an app is invoked, but there are cases when some folks
+// may configure their system and want mmenu to live instead (save on restart time, don't care
+// about RAM, using a multitasking tray/window manager setup...), so instead of 'exit and emit'
+// here we just run the app directly and cross fingers!
+void emit_and_run ( char *buffer ) {
+
+ // run the bloody thing
+ int f;
+
+ if ( ( f = fork() ) < 0 ) {
+ // error forking
+ } else if ( f > 0 ) {
+ // parent
+ } else {
+ // child, do it
+ execl ( "/bin/sh", "/bin/sh", "-c", buffer + strlen(MM_RUN) + 1, (char*) NULL );
+ }
+
+ return;
+}
+
+// this code was swiped from pnd_utility pnd_exec_no_wait_1 as it became a little too minimenu-specific to remain there
+void exec_raw_binary ( char *fullpath ) {
+ int i;
+
+ if ( ( i = fork() ) < 0 ) {
+ printf ( "ERROR: Couldn't fork()\n" );
+ return;
+ }
+
+ if ( i ) {
+ return; // parent process, don't care
+ }
+
+ // child process, do something
+ execl ( "/bin/sh", "/bin/sh", "-c", fullpath, (char*) NULL );
+ //execl ( fullpath, fullpath, (char*) NULL );
+
+ // error invoking something, and we're the child process, so just die before all hell breaks lose with us thinking we're the (second!) parent on return!
+ exit ( -1 );
+
+ // getting here is an error
+ //printf ( "Error attempting to run %s\n", fullpath );
+
+ return;
+}