static void tree_copy (WTree * tree, const char *default_dest) { char msg[BUF_MEDIUM]; char *dest; if (tree->selected_ptr == NULL) return; g_snprintf (msg, sizeof (msg), _("Copy \"%s\" directory to:"), str_trunc (vfs_path_as_str (tree->selected_ptr->name), 50)); dest = input_expand_dialog (Q_ ("DialogTitle|Copy"), msg, MC_HISTORY_FM_TREE_COPY, default_dest, INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_CD); if (dest != NULL && *dest != '\0') { file_op_context_t *ctx; file_op_total_context_t *tctx; ctx = file_op_context_new (OP_COPY); tctx = file_op_total_context_new (); file_op_context_create_ui (ctx, FALSE, FILEGUI_DIALOG_MULTI_ITEM); tctx->ask_overwrite = FALSE; copy_dir_dir (tctx, ctx, vfs_path_as_str (tree->selected_ptr->name), dest, TRUE, FALSE, FALSE, NULL); file_op_total_context_destroy (tctx); file_op_context_destroy (ctx); } g_free (dest); }
void symlink_dialog (const vfs_path_t * existing_vpath, const vfs_path_t * new_vpath, char **ret_existing, char **ret_new) { quick_widget_t quick_widgets[] = { /* *INDENT-OFF* */ QUICK_LABELED_INPUT (N_("Existing filename (filename symlink will point to):"), input_label_above, vfs_path_as_str (existing_vpath), "input-2", ret_existing, NULL, FALSE, FALSE, INPUT_COMPLETE_FILENAMES), QUICK_SEPARATOR (FALSE), QUICK_LABELED_INPUT (N_("Symbolic link filename:"), input_label_above, vfs_path_as_str (new_vpath), "input-1", ret_new, NULL, FALSE, FALSE, INPUT_COMPLETE_FILENAMES), QUICK_BUTTONS_OK_CANCEL, QUICK_END /* *INDENT-ON* */ }; quick_dialog_t qdlg = { -1, -1, 64, N_("Symbolic link"), "[File Menu]", quick_widgets, NULL, NULL }; if (quick_dialog (&qdlg) == B_CANCEL) { *ret_new = NULL; *ret_existing = NULL; } }
/* *INDENT-OFF* */ END_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ /* @Test */ /* *INDENT-OFF* */ START_TEST (test_mc_mkstemps) /* *INDENT-ON* */ { /* given */ vfs_path_t *pname_vpath = NULL; char *begin_pname; int fd; /* when */ fd = mc_mkstemps (&pname_vpath, "mctest-", NULL); begin_pname = g_build_filename (mc_tmpdir (), "mctest-", NULL); /* then */ close (fd); mctest_assert_int_ne (fd, -1); fail_unless (g_file_test (vfs_path_as_str (pname_vpath), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR), "\nNo such file: %s\n", vfs_path_as_str (pname_vpath)); unlink (vfs_path_as_str (pname_vpath)); fail_unless (strncmp (vfs_path_as_str (pname_vpath), begin_pname, strlen (begin_pname)) == 0, "\nstart of %s should be equal to %s\n", vfs_path_as_str (pname_vpath), begin_pname); vfs_path_free (pname_vpath); }
static int compare_files (const vfs_path_t * vpath1, const vfs_path_t * vpath2, off_t size) { int file1; int result = -1; /* Different by default */ if (size == 0) return 0; file1 = open (vfs_path_as_str (vpath1), O_RDONLY); if (file1 >= 0) { int file2; file2 = open (vfs_path_as_str (vpath2), O_RDONLY); if (file2 >= 0) { #ifdef HAVE_MMAP char *data1; /* Ugly if jungle */ data1 = mmap (0, size, PROT_READ, MAP_FILE | MAP_PRIVATE, file1, 0); if (data1 != (char *) -1) { char *data2; data2 = mmap (0, size, PROT_READ, MAP_FILE | MAP_PRIVATE, file2, 0); if (data2 != (char *) -1) { rotate_dash (TRUE); result = memcmp (data1, data2, size); munmap (data2, size); } munmap (data1, size); } #else /* Don't have mmap() :( Even more ugly :) */ char buf1[BUFSIZ], buf2[BUFSIZ]; int n1, n2; rotate_dash (TRUE); do { while ((n1 = read (file1, buf1, sizeof (buf1))) == -1 && errno == EINTR) ; while ((n2 = read (file2, buf2, sizeof (buf2))) == -1 && errno == EINTR) ; } while (n1 == n2 && n1 == sizeof (buf1) && memcmp (buf1, buf2, sizeof (buf1)) == 0); result = (n1 != n2) || memcmp (buf1, buf2, n1); #endif /* !HAVE_MMAP */ close (file2); } close (file1); } rotate_dash (FALSE); return result; }
static void tree_move (WTree * tree, const char *default_dest) { char msg[BUF_MEDIUM]; char *dest; struct stat buf; file_op_context_t *ctx; file_op_total_context_t *tctx; vfs_path_t *dest_vpath = NULL; if (tree->selected_ptr == NULL) return; g_snprintf (msg, sizeof (msg), _("Move \"%s\" directory to:"), str_trunc (vfs_path_as_str (tree->selected_ptr->name), 50)); dest = input_expand_dialog (Q_ ("DialogTitle|Move"), msg, MC_HISTORY_FM_TREE_MOVE, default_dest, INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_CD); if (dest == NULL || *dest == '\0') goto ret; dest_vpath = vfs_path_from_str (dest); if (mc_stat (dest_vpath, &buf)) { message (D_ERROR, MSG_ERROR, _("Cannot stat the destination\n%s"), unix_error_string (errno)); goto ret; } if (!S_ISDIR (buf.st_mode)) { file_error (_("Destination \"%s\" must be a directory\n%s"), dest); goto ret; } ctx = file_op_context_new (OP_MOVE); tctx = file_op_total_context_new (); file_op_context_create_ui (ctx, FALSE, FILEGUI_DIALOG_ONE_ITEM); move_dir_dir (tctx, ctx, vfs_path_as_str (tree->selected_ptr->name), dest); file_op_total_context_destroy (tctx); file_op_context_destroy (ctx); ret: vfs_path_free (dest_vpath); g_free (dest); }
static gboolean execute_prepare_with_vfs_arg (const vfs_path_t * filename_vpath, vfs_path_t ** localcopy_vpath, time_t * mtime) { struct stat st; /* Simplest case, this file is local */ if ((filename_vpath == NULL && vfs_file_is_local (vfs_get_raw_current_dir ())) || vfs_file_is_local (filename_vpath)) return TRUE; /* FIXME: Creation of new files on VFS is not supported */ if (filename_vpath == NULL) return FALSE; *localcopy_vpath = mc_getlocalcopy (filename_vpath); if (*localcopy_vpath == NULL) { message (D_ERROR, MSG_ERROR, _("Cannot fetch a local copy of %s"), vfs_path_as_str (filename_vpath)); return FALSE; } mc_stat (*localcopy_vpath, &st); *mtime = st.st_mtime; return TRUE; }
void mcview_toggle_magic_mode (mcview_t * view) { char *filename, *command; dir_list *dir; int *dir_idx; mcview_altered_magic_flag = 1; view->magic_mode = !view->magic_mode; /* reinit view */ filename = g_strdup (vfs_path_as_str (view->filename_vpath)); command = g_strdup (view->command); dir = view->dir; dir_idx = view->dir_idx; view->dir = NULL; view->dir_idx = NULL; mcview_done (view); mcview_init (view); mcview_load (view, command, filename, 0); view->dir = dir; view->dir_idx = dir_idx; g_free (filename); g_free (command); view->dpy_bbar_dirty = TRUE; view->dirty++; }
static int my_mkdir_rec (const vfs_path_t * s_vpath, mode_t mode) { vfs_path_t *q; int result; if (mc_mkdir (s_vpath, mode) == 0) return 0; if (errno != ENOENT) return (-1); /* FIXME: should check instead if s_vpath is at the root of that filesystem */ if (!vfs_file_is_local (s_vpath)) return (-1); if (strcmp (vfs_path_as_str (s_vpath), PATH_SEP_STR) == 0) { errno = ENOTDIR; return (-1); } q = vfs_path_append_new (s_vpath, "..", NULL); result = my_mkdir_rec (q, mode); vfs_path_free (q); if (result == 0) result = mc_mkdir (s_vpath, mode); return result; }
static void tree_rmdir (void *data) { WTree *tree = data; file_op_context_t *ctx; file_op_total_context_t *tctx; if (!tree->selected_ptr) return; if (confirm_delete) { char *buf; int result; buf = g_strdup_printf (_("Delete %s?"), vfs_path_as_str (tree->selected_ptr->name)); result = query_dialog (Q_ ("DialogTitle|Delete"), buf, D_ERROR, 2, _("&Yes"), _("&No")); g_free (buf); if (result != 0) return; } ctx = file_op_context_new (OP_DELETE); tctx = file_op_total_context_new (); file_op_context_create_ui (ctx, FALSE, FILEGUI_DIALOG_ONE_ITEM); if (erase_dir (tctx, ctx, tree->selected_ptr->name) == FILE_CONT) tree_forget (tree); file_op_total_context_destroy (tctx); file_op_context_destroy (ctx); }
void hotlist_cmd (void) { char *target; target = hotlist_show (LIST_HOTLIST); if (!target) return; if (get_current_type () == view_tree) tree_chdir (the_tree, target); else { vfs_path_t *deprecated_vpath; char *cmd; deprecated_vpath = vfs_path_from_str_flags (target, VPF_USE_DEPRECATED_PARSER); cmd = g_strconcat ("cd ", vfs_path_as_str (deprecated_vpath), (char *) NULL); vfs_path_free (deprecated_vpath); do_cd_command (cmd); g_free (cmd); } g_free (target); }
static void exec_extension_view (void *target, char *cmd, const vfs_path_t * filename_vpath, int start_line) { int def_hex_mode = mcview_default_hex_mode, changed_hex_mode = 0; int def_nroff_flag = mcview_default_nroff_flag, changed_nroff_flag = 0; mcview_altered_hex_mode = 0; mcview_altered_nroff_flag = 0; if (def_hex_mode != mcview_default_hex_mode) changed_hex_mode = 1; if (def_nroff_flag != mcview_default_nroff_flag) changed_nroff_flag = 1; if (target == NULL) mcview_viewer (cmd, filename_vpath, start_line); else mcview_load ((mcview_t *) target, cmd, vfs_path_as_str (filename_vpath), start_line); if (changed_hex_mode && !mcview_altered_hex_mode) mcview_default_hex_mode = def_hex_mode; if (changed_nroff_flag && !mcview_altered_nroff_flag) mcview_default_nroff_flag = def_nroff_flag; dialog_switch_process_pending (); }
gboolean mcview_viewer (const char *command, const vfs_path_t * file_vpath, int start_line, off_t search_start, off_t search_end) { gboolean succeeded; WView *lc_mcview; WDialog *view_dlg; /* Create dialog and widgets, put them on the dialog */ view_dlg = dlg_create (FALSE, 0, 0, 1, 1, WPOS_FULLSCREEN, FALSE, NULL, mcview_dialog_callback, NULL, "[Internal File Viewer]", NULL); widget_want_tab (WIDGET (view_dlg), TRUE); lc_mcview = mcview_new (0, 0, LINES - 1, COLS, FALSE); add_widget (view_dlg, lc_mcview); add_widget (view_dlg, buttonbar_new (TRUE)); view_dlg->get_title = mcview_get_title; succeeded = mcview_load (lc_mcview, command, vfs_path_as_str (file_vpath), start_line, search_start, search_end); if (succeeded) dlg_run (view_dlg); else dlg_stop (view_dlg); if (widget_get_state (WIDGET (view_dlg), WST_CLOSED)) dlg_destroy (view_dlg); return succeeded; }
gboolean mcview_viewer (const char *command, const vfs_path_t * file_vpath, int start_line) { gboolean succeeded; mcview_t *lc_mcview; WDialog *view_dlg; /* Create dialog and widgets, put them on the dialog */ view_dlg = dlg_create (FALSE, 0, 0, LINES, COLS, NULL, mcview_dialog_callback, NULL, "[Internal File Viewer]", NULL, DLG_WANT_TAB); lc_mcview = mcview_new (0, 0, LINES - 1, COLS, FALSE); add_widget (view_dlg, lc_mcview); add_widget (view_dlg, buttonbar_new (TRUE)); view_dlg->get_title = mcview_get_title; succeeded = mcview_load (lc_mcview, command, vfs_path_as_str (file_vpath), start_line); if (succeeded) dlg_run (view_dlg); else view_dlg->state = DLG_CLOSED; if (view_dlg->state == DLG_CLOSED) dlg_destroy (view_dlg); return succeeded; }
char * tree_box (const char *current_dir) { WTree *mytree; WDialog *dlg; Widget *wd; char *val = NULL; WButtonBar *bar; (void) current_dir; /* Create the components */ dlg = dlg_create (TRUE, 0, 0, LINES - 9, COLS - 20, dialog_colors, tree_callback, NULL, "[Directory Tree]", _("Directory tree"), DLG_CENTER); wd = WIDGET (dlg); mytree = tree_new (2, 2, wd->lines - 6, wd->cols - 5, FALSE); add_widget_autopos (dlg, mytree, WPOS_KEEP_ALL, NULL); add_widget_autopos (dlg, hline_new (wd->lines - 4, 1, -1), WPOS_KEEP_BOTTOM, NULL); bar = buttonbar_new (TRUE); add_widget (dlg, bar); /* restore ButtonBar coordinates after add_widget() */ WIDGET (bar)->x = 0; WIDGET (bar)->y = LINES - 1; if (dlg_run (dlg) == B_ENTER) { const vfs_path_t *selected_name; selected_name = tree_selected_name (mytree); val = g_strdup (vfs_path_as_str (selected_name)); } dlg_destroy (dlg); return val; }
/* *INDENT-OFF* */ END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ /* @Test(dataSource = "test_vfs_path_relative_ds") */ /* *INDENT-OFF* */ START_PARAMETRIZED_TEST (test_vfs_path_relative_clone, test_vfs_path_relative_ds) /* *INDENT-ON* */ { /* given */ vfs_path_t *vpath, *cloned_vpath; vpath = vfs_path_from_str_flags (data->input_path, VPF_NO_CANON); /* when */ cloned_vpath = vfs_path_clone (vpath); /* then */ mctest_assert_int_eq (cloned_vpath->relative, TRUE); mctest_assert_str_eq (vfs_path_get_last_path_str (cloned_vpath), data->expected_last_path_in_element); mctest_assert_str_eq (vfs_path_as_str (cloned_vpath), data->expected_path); vfs_path_free (vpath); vfs_path_free (cloned_vpath); }
static void tree_chdir_sel (WTree * tree) { if (tree->is_panel) { change_panel (); if (do_cd (tree->selected_ptr->name, cd_exact)) select_item (current_panel); else message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\"\n%s"), vfs_path_as_str (tree->selected_ptr->name), unix_error_string (errno)); widget_redraw (WIDGET (current_panel)); change_panel (); show_tree (tree); } else { WDialog *h = WIDGET (tree)->owner; h->ret_value = B_ENTER; dlg_stop (h); } }
void dir_list_load (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort, const dir_sort_options_t * sort_op, const char *fltr) { DIR *dirp; struct dirent *dp; int link_to_dir, stale_link; struct stat st; file_entry_t *fentry; /* ".." (if any) must be the first entry in the list */ if (!dir_list_init (list)) return; fentry = &list->list[0]; if (dir_get_dotdot_stat (vpath, &st)) fentry->st = st; dirp = mc_opendir (vpath); if (dirp == NULL) { message (D_ERROR, MSG_ERROR, _("Cannot read directory contents")); return; } tree_store_start_check (vpath); { const char *vpath_str; vpath_str = vfs_path_as_str (vpath); /* Do not add a ".." entry to the root directory */ if ((vpath_str[0] == PATH_SEP) && (vpath_str[1] == '\0')) list->len--; } while ((dp = mc_readdir (dirp)) != NULL) { if (!handle_dirent (dp, fltr, &st, &link_to_dir, &stale_link)) continue; if (!dir_list_append (list, dp->d_name, &st, link_to_dir != 0, stale_link != 0)) goto ret; if ((list->len & 31) == 0) rotate_dash (TRUE); } dir_list_sort (list, sort, sort_op); ret: mc_closedir (dirp); tree_store_end_check (); rotate_dash (FALSE); }
static char * sftpfs_correct_file_name (const char *filename) { vfs_path_t *vpath; char *ret_value; ret_value = tilde_expand (filename); vpath = vfs_path_from_str (ret_value); g_free (ret_value); ret_value = g_strdup (vfs_path_as_str (vpath)); vfs_path_free (vpath); return ret_value; }
gboolean check_for_default (const vfs_path_t * default_file_vpath, const vfs_path_t * file_vpath) { if (!exist_file (vfs_path_as_str (file_vpath))) { file_op_context_t *ctx; file_op_total_context_t *tctx; if (!exist_file (vfs_path_as_str (default_file_vpath))) return FALSE; ctx = file_op_context_new (OP_COPY); tctx = file_op_total_context_new (); file_op_context_create_ui (ctx, 0, FALSE); copy_file_file (tctx, ctx, vfs_path_as_str (default_file_vpath), vfs_path_as_str (file_vpath)); file_op_total_context_destroy (tctx); file_op_context_destroy (ctx); } return TRUE; }
int invoke_subshell (const char *command, int how, vfs_path_t ** new_dir_vpath) { /* Make the MC terminal transparent */ tcsetattr (STDOUT_FILENO, TCSANOW, &raw_mode); /* Make the subshell change to MC's working directory */ if (new_dir_vpath != NULL) do_subshell_chdir (subshell_get_cwd_from_current_panel (), TRUE); if (command == NULL) /* The user has done "C-o" from MC */ { if (subshell_state == INACTIVE) { subshell_state = ACTIVE; /* FIXME: possibly take out this hack; the user can re-play it by hitting C-hyphen a few times! */ if (subshell_ready) write_all (mc_global.tty.subshell_pty, " \b", 2); /* Hack to make prompt reappear */ } } else /* MC has passed us a user command */ { if (how == QUIETLY) write_all (mc_global.tty.subshell_pty, " ", 1); /* FIXME: if command is long (>8KB ?) we go comma */ write_all (mc_global.tty.subshell_pty, command, strlen (command)); write_all (mc_global.tty.subshell_pty, "\n", 1); subshell_state = RUNNING_COMMAND; subshell_ready = FALSE; } feed_subshell (how, FALSE); if (new_dir_vpath != NULL && subshell_alive) { const char *pcwd; pcwd = vfs_translate_path (vfs_path_as_str (subshell_get_cwd_from_current_panel ())); if (strcmp (subshell_cwd, pcwd) != 0) *new_dir_vpath = vfs_path_from_str (subshell_cwd); /* Make MC change to the subshell's CWD */ } /* Restart the subshell if it has died by SIGHUP, SIGQUIT, etc. */ while (!subshell_alive && subshell_get_mainloop_quit () == 0 && mc_global.tty.use_subshell) init_subshell (); return subshell_get_mainloop_quit (); }
void save_panel_dir (int idx) { panel_view_mode_t type = get_display_type (idx); Widget *widget = get_panel_widget (idx); if ((type == view_listing) && (widget != NULL)) { WPanel *w = PANEL (widget); g_free (panels[idx].last_saved_dir); /* last path no needed */ /* Because path can be nonlocal */ panels[idx].last_saved_dir = g_strdup (vfs_path_as_str (w->cwd_vpath)); } }
void save_setup_cmd (void) { vfs_path_t *vpath; const char *path; vpath = vfs_path_from_str_flags (mc_config_get_path (), VPF_STRIP_HOME); path = vfs_path_as_str (vpath); if (save_setup (TRUE, TRUE)) message (D_NORMAL, _("Setup"), _("Setup saved to %s"), path); else message (D_ERROR, _("Setup"), _("Unable to save setup to %s"), path); vfs_path_free (vpath); }
/* *INDENT-OFF* */ START_PARAMETRIZED_TEST (test_vfs_path_relative, test_vfs_path_relative_ds) /* *INDENT-ON* */ { /* given */ vfs_path_t *vpath; /* when */ vpath = vfs_path_from_str_flags (data->input_path, VPF_NO_CANON); /* then */ mctest_assert_int_eq (vpath->relative, TRUE); mctest_assert_str_eq (vfs_path_get_last_path_str (vpath), data->expected_last_path_in_element); mctest_assert_str_eq (vfs_path_as_str (vpath), data->expected_path); vfs_path_free (vpath); }
static void edit_window_list (const WDialog * h) { const size_t offset = 2; /* skip menu and buttonbar */ const size_t dlg_num = g_list_length (h->widgets) - offset; int lines, cols; Listbox *listbox; GList *w; int i = 0; int rv; lines = min ((size_t) (LINES * 2 / 3), dlg_num); cols = COLS * 2 / 3; listbox = create_listbox_window (lines, cols, _("Open files"), "[Open files]"); for (w = h->widgets; w != NULL; w = g_list_next (w)) if (edit_widget_is_editor (WIDGET (w->data))) { WEdit *e = (WEdit *) w->data; char *fname; if (e->filename_vpath == NULL) fname = g_strdup_printf ("%c [%s]", e->modified ? '*' : ' ', _("NoName")); else fname = g_strdup_printf ("%c%s", e->modified ? '*' : ' ', vfs_path_as_str (e->filename_vpath)); listbox_add_item (listbox->list, LISTBOX_APPEND_AT_END, get_hotkey (i++), str_term_trim (fname, WIDGET (listbox->list)->cols - 2), NULL, FALSE); g_free (fname); } rv = g_list_position (h->widgets, h->current) - offset; listbox_select_entry (listbox->list, rv); rv = run_listbox (listbox); if (rv >= 0) { w = g_list_nth (h->widgets, rv + offset); dlg_set_top_widget (w->data); } }
char * mcview_get_title (const WDialog * h, size_t len) { const mcview_t *view = (const mcview_t *) find_widget_type (h, mcview_callback); const char *modified = view->hexedit_mode && (view->change_list != NULL) ? "(*) " : " "; const char *file_label; const char *view_filename; char *ret_str; view_filename = vfs_path_as_str (view->filename_vpath); len -= 4; file_label = view_filename != NULL ? view_filename : view->command != NULL ? view->command : ""; file_label = str_term_trim (file_label, len - str_term_width1 (_("View: "))); ret_str = g_strconcat (_("View: "), modified, file_label, (char *) NULL); return ret_str; }
static char * edit_get_title (const WDialog * h, size_t len) { const WEdit *edit = find_editor (h); const char *modified = edit->modified ? "(*) " : " "; const char *file_label; char *filename; len -= 4; if (edit->filename_vpath == NULL) filename = g_strdup (_("[NoName]")); else filename = g_strdup (vfs_path_as_str (edit->filename_vpath)); file_label = str_term_trim (filename, len - str_term_width1 (_("Edit: "))); g_free (filename); return g_strconcat (_("Edit: "), modified, file_label, (char *) NULL); }
/* *INDENT-OFF* */ START_PARAMETRIZED_TEST (test_vfs_path_append_vpath, test_vfs_path_append_vpath_ds) /* *INDENT-ON* */ { /* given */ vfs_path_t *vpath1, *vpath2, *vpath3; vpath1 = vfs_path_from_str (data->input_path1); vpath2 = vfs_path_from_str (data->input_path2); /* when */ vpath3 = vfs_path_append_vpath_new (vpath1, vpath2, NULL); /* then */ mctest_assert_int_eq (vfs_path_elements_count (vpath3), data->expected_element_count); mctest_assert_str_eq (vfs_path_as_str (vpath3), data->expected_path); vfs_path_free (vpath1); vfs_path_free (vpath2); vfs_path_free (vpath3); }
/* *INDENT-OFF* */ START_PARAMETRIZED_TEST (test_empty_mean_home, test_empty_mean_home_ds) /* *INDENT-ON* */ { /* given */ get_current_type__return_value = view_listing; do_cd__return_value = TRUE; mc_config_get_home_dir__return_value = "/home/test"; /* when */ { char *input_command; input_command = g_strdup (data->command); do_cd_command (input_command); g_free (input_command); } /* then */ mctest_assert_str_eq (mc_config_get_home_dir__return_value, vfs_path_as_str (do_cd__new_dir_vpath__captured)); mctest_assert_int_eq (do_cd__cd_type__captured, cd_parse_command); }
void file_progress_show_target (file_op_context_t * ctx, const vfs_path_t * s_vpath) { file_op_context_ui_t *ui; if (ctx == NULL || ctx->ui == NULL) return; ui = ctx->ui; if (s_vpath != NULL) { label_set_text (ui->tgt_file_label, _("Target")); label_set_text (ui->tgt_file, truncFileStringSecure (ui->op_dlg, vfs_path_as_str (s_vpath))); } else { label_set_text (ui->tgt_file_label, ""); label_set_text (ui->tgt_file, ""); } }
char * get_panel_dir_for (const WPanel * widget) { int i; for (i = 0; i < MAX_VIEWS; i++) if (PANEL (get_panel_widget (i)) == widget) break; if (i >= MAX_VIEWS) return g_strdup ("."); if (get_display_type (i) == view_listing) { vfs_path_t *cwd_vpath; cwd_vpath = PANEL (get_panel_widget (i))->cwd_vpath; return g_strdup (vfs_path_as_str (cwd_vpath)); } return g_strdup (panels[i].last_saved_dir); }