mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Ticket #2754: mceedit can't run w/o file as parameter.
Also fixed segfault while run `mc -v ""`. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
91f6468215
commit
529a7ba24c
@ -636,6 +636,9 @@ regex_command (const vfs_path_t * filename_vpath, const char *action, int *move_
|
||||
int include_target_len;
|
||||
int have_type = 0; /* Flag used by regex_check_type() */
|
||||
|
||||
if (filename_vpath == NULL)
|
||||
return 0;
|
||||
|
||||
/* Check for the special View:%d parameter */
|
||||
if (strncmp (action, "View:", 5) == 0)
|
||||
{
|
||||
|
@ -951,19 +951,23 @@ mc_maybe_editor_or_viewer (void)
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
case MC_RUN_EDITOR:
|
||||
{
|
||||
vfs_path_t *param_vpath;
|
||||
vfs_path_t *vpath = NULL;
|
||||
|
||||
param_vpath = vfs_path_from_str (mc_run_param0);
|
||||
ret = edit_file (param_vpath, mc_args__edit_start_line);
|
||||
vfs_path_free (param_vpath);
|
||||
if (mc_run_param0 != NULL && *mc_run_param0 != '\0')
|
||||
vpath = vfs_path_from_str (mc_run_param0);
|
||||
|
||||
ret = edit_file (vpath, mc_args__edit_start_line);
|
||||
vfs_path_free (vpath);
|
||||
}
|
||||
break;
|
||||
#endif /* USE_INTERNAL_EDIT */
|
||||
case MC_RUN_VIEWER:
|
||||
{
|
||||
vfs_path_t *vpath;
|
||||
vfs_path_t *vpath = NULL;
|
||||
|
||||
if (mc_run_param0 != NULL && *mc_run_param0 != '\0')
|
||||
vpath = prepend_cwd_on_local (mc_run_param0);
|
||||
|
||||
vpath = prepend_cwd_on_local (mc_run_param0);
|
||||
view_file (vpath, 0, 1);
|
||||
vfs_path_free (vpath);
|
||||
ret = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user