GString* to_execute = g_string_new ("");
gboolean result;
g_string_printf (to_execute, "%s '%s' '%i' '%i' '%s' '%s'",
- command, uzbl.state.config_file, (int) getpid() ,
- (int) uzbl.xwin, uzbl.comm.fifo_path, uzbl.comm.socket_path);
+ command, (uzbl.state.config_file ? uzbl.state.config_file : "(null)"),
+ (int) getpid(), (int) uzbl.xwin, uzbl.comm.fifo_path,
+ uzbl.comm.socket_path);
g_string_append_printf (to_execute, " '%s' '%s'",
- uzbl.state.uri, "TODO title here");
+ uzbl.state.uri, uzbl.gui.main_title);
- if(args) {
- g_string_append_printf (to_execute, " %s", args);
- }
- result = g_spawn_command_line_async (to_execute->str, NULL);
- printf("Called %s. Result: %s\n", to_execute->str, (result ? "TRUE" : "FALSE" ));
- g_string_free (to_execute, TRUE);
- return result;
- }
+ if(args) g_string_append_printf (to_execute, " %s", args);
- static gboolean
- run_command_sync(const char *command, const char *args, char **stdout) {
- //command <uzbl conf> <uzbl pid> <uzbl win id> <uzbl fifo file> <uzbl socket file> [args]
- GString* to_execute = g_string_new ("");
- gboolean result;
- g_string_printf (to_execute, "%s '%s' '%i' '%i' '%s' '%s'", command, uzbl.state.config_file, (int) getpid() , (int) uzbl.xwin, uzbl.comm.fifo_path, uzbl.comm.socket_path);
- g_string_append_printf (to_execute, " '%s' '%s'", uzbl.state.uri, uzbl.gui.main_title);
- if(args) {
- g_string_append_printf (to_execute, " %s", args);
- }
- result = g_spawn_command_line_sync (to_execute->str, stdout, NULL, NULL, NULL);
+ if (sync) {
+ result = g_spawn_command_line_sync (to_execute->str, stdout, NULL, NULL, NULL);
+ } else result = g_spawn_command_line_async (to_execute->str, NULL);
printf("Called %s. Result: %s\n", to_execute->str, (result ? "TRUE" : "FALSE" ));
g_string_free (to_execute, TRUE);
return result;