int my_systeml (int flags, const char *shell, ...) { GPtrArray *args_array; int status = 0; va_list vargs; char *one_arg; args_array = g_ptr_array_new (); va_start (vargs, shell); while ((one_arg = va_arg (vargs, char *)) != NULL) g_ptr_array_add (args_array, one_arg); va_end (vargs); g_ptr_array_add (args_array, NULL); status = my_systemv_flags (flags, shell, (char *const *) args_array->pdata); g_ptr_array_free (args_array, TRUE); return status; }
void do_executev (const char *shell, int flags, char *const argv[]) { #ifdef ENABLE_SUBSHELL vfs_path_t *new_dir_vpath = NULL; #endif /* ENABLE_SUBSHELL */ vfs_path_t *old_vfs_dir_vpath = NULL; if (!vfs_current_is_local ()) old_vfs_dir_vpath = vfs_path_clone (vfs_get_raw_current_dir ()); if (mc_global.mc_run_mode == MC_RUN_FULL) save_cwds_stat (); pre_exec (); if (mc_global.tty.console_flag != '\0') handle_console (CONSOLE_RESTORE); if (!mc_global.tty.use_subshell && *argv != NULL && (flags & EXECUTE_INTERNAL) == 0) { printf ("%s%s\n", mc_prompt, *argv); fflush (stdout); } #ifdef ENABLE_SUBSHELL if (mc_global.tty.use_subshell && (flags & EXECUTE_INTERNAL) == 0) { do_update_prompt (); /* We don't care if it died, higher level takes care of this */ invoke_subshell (*argv, VISIBLY, old_vfs_dir_vpath != NULL ? NULL : &new_dir_vpath); } else #endif /* ENABLE_SUBSHELL */ my_systemv_flags (flags, shell, argv); if ((flags & EXECUTE_INTERNAL) == 0) { if ((pause_after_run == pause_always || (pause_after_run == pause_on_dumb_terminals && !mc_global.tty.xterm_flag && mc_global.tty.console_flag == '\0')) && quit == 0 #ifdef ENABLE_SUBSHELL && subshell_state != RUNNING_COMMAND #endif /* ENABLE_SUBSHELL */ ) { printf (_("Press any key to continue...")); fflush (stdout); tty_raw_mode (); get_key_code (0); printf ("\r\n"); fflush (stdout); } if (mc_global.tty.console_flag != '\0' && output_lines != 0 && mc_global.keybar_visible) { putchar ('\n'); fflush (stdout); } } if (mc_global.tty.console_flag != '\0') handle_console (CONSOLE_SAVE); edition_post_exec (); #ifdef ENABLE_SUBSHELL if (new_dir_vpath != NULL) { do_possible_cd (new_dir_vpath); vfs_path_free (new_dir_vpath); } #endif /* ENABLE_SUBSHELL */ if (old_vfs_dir_vpath != NULL) { mc_chdir (old_vfs_dir_vpath); vfs_path_free (old_vfs_dir_vpath); } if (mc_global.mc_run_mode == MC_RUN_FULL) { update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_xterm_title_path (); } do_refresh (); use_dash (TRUE); }