I this part of code, instructs my program (which make screenshots) to spawn a command and quit (close) itself. This can be used to switch to a program using a key in my program, such as to spawn "gimp" or another image editor that a user would like to use it.
case SWITCH_TO:
if( arg ) {
char commandline[ 256 ];
snprintf( commandline, sizeof (commandline), "%s &", arg );
system( commandline );
cmd->quit = 1;
}
break;
For example using:
program-command SWITCH_TO "gimp"
will have my program call system( "gimp &" ), quit (close) itself and run gimp.
program-command SWITCH_TO "fotoxx"
will have my program call system( "fotoxx &" ), quit (close) itself and run fotoxx.
I want my program to check if "commandline" is valid (application found in $PATH) and if not, command "program-command SWITCH_TO" not run and not close my program ("cmd->quit = 1" do this, close program).
Thanks