Merge branch '4524_cleanup'
[midnight-commander.git] / src / args.c
blob00c480312795e444b61626fc6022db36b2aa7edb
1 /*
2 Handle command line arguments.
4 Copyright (C) 2009-2024
5 Free Software Foundation, Inc.
7 Written by:
8 Slava Zanko <slavazanko@gmail.com>, 2009.
9 Andrew Borodin <aborodin@vmail.ru>, 2011, 2012.
11 This file is part of the Midnight Commander.
13 The Midnight Commander is free software: you can redistribute it
14 and/or modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation, either version 3 of the License,
16 or (at your option) any later version.
18 The Midnight Commander is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 #include <config.h>
28 #include <stdlib.h>
29 #include <stdio.h>
31 #include "lib/global.h"
32 #include "lib/tty/tty.h"
33 #include "lib/strutil.h"
34 #include "lib/vfs/vfs.h"
35 #include "lib/util.h" /* x_basename() */
37 #include "src/textconf.h"
39 #ifdef USE_INTERNAL_EDIT
40 #include "editor/edit.h" /* edit_arg_t */
41 #endif
43 #include "src/args.h"
45 /*** external variables **************************************************************************/
47 /*** global variables ****************************************************************************/
49 /* If true, assume we are running on an xterm terminal */
50 gboolean mc_args__force_xterm = FALSE;
52 gboolean mc_args__nomouse = FALSE;
54 /* Force colors, only used by Slang */
55 gboolean mc_args__force_colors = FALSE;
57 /* Don't load keymap from file and use default one */
58 gboolean mc_args__nokeymap = FALSE;
60 char *mc_args__last_wd_file = NULL;
62 /* when enabled NETCODE, use following file as logfile */
63 char *mc_args__netfs_logfile = NULL;
65 /* keymap file */
66 char *mc_args__keymap_file = NULL;
68 void *mc_run_param0 = NULL;
69 char *mc_run_param1 = NULL;
71 /*** file scope macro definitions ****************************************************************/
73 /*** file scope type declarations ****************************************************************/
75 /*** forward declarations (file scope functions) *************************************************/
77 static gboolean parse_mc_e_argument (const gchar * option_name, const gchar * value,
78 gpointer data, GError ** mcerror);
79 static gboolean parse_mc_v_argument (const gchar * option_name, const gchar * value,
80 gpointer data, GError ** mcerror);
82 /*** file scope variables ************************************************************************/
84 /* If true, show version info and exit */
85 static gboolean mc_args__show_version = FALSE;
87 static GOptionContext *context;
89 #ifdef ENABLE_SUBSHELL
90 static gboolean mc_args__nouse_subshell = FALSE;
91 #endif /* ENABLE_SUBSHELL */
92 static gboolean mc_args__show_datadirs = FALSE;
93 static gboolean mc_args__show_datadirs_extended = FALSE;
94 #ifdef ENABLE_CONFIGURE_ARGS
95 static gboolean mc_args__show_configure_opts = FALSE;
96 #endif
98 static GOptionGroup *main_group;
100 static const GOptionEntry argument_main_table[] = {
101 /* *INDENT-OFF* */
102 /* generic options */
104 "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
105 &mc_args__show_version,
106 N_("Displays the current version"),
107 NULL
110 /* options for wrappers */
112 "datadir", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
113 &mc_args__show_datadirs,
114 N_("Print data directory"),
115 NULL
118 /* show extended information about used data directories */
120 "datadir-info", 'F', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
121 &mc_args__show_datadirs_extended,
122 N_("Print extended info about used data directories"),
123 NULL
126 #ifdef ENABLE_CONFIGURE_ARGS
127 /* show configure options */
129 "configure-options", '\0', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
130 &mc_args__show_configure_opts,
131 N_("Print configure options"),
132 NULL
134 #endif
137 "printwd", 'P', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
138 &mc_args__last_wd_file,
139 N_("Print last working directory to specified file"),
140 N_("<file>")
143 #ifdef ENABLE_SUBSHELL
145 "subshell", 'U', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
146 &mc_global.tty.use_subshell,
147 N_("Enables subshell support (default)"),
148 NULL
152 "nosubshell", 'u', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
153 &mc_args__nouse_subshell,
154 N_("Disables subshell support"),
155 NULL
157 #endif
159 /* debug options */
160 #ifdef ENABLE_VFS_FTP
162 "ftplog", 'l', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
163 &mc_args__netfs_logfile,
164 N_("Log ftp dialog to specified file"),
165 N_("<file>")
167 #endif /* ENABLE_VFS_FTP */
170 /* handle arguments manually */
171 "view", 'v', G_OPTION_FLAG_IN_MAIN | G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
172 (gpointer) parse_mc_v_argument,
173 N_("Launches the file viewer on a file"),
174 N_("<file>")
178 /* handle arguments manually */
179 "edit", 'e', G_OPTION_FLAG_IN_MAIN | G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
180 (gpointer) parse_mc_e_argument,
181 N_("Edit files"),
182 N_("<file> ...")
185 G_OPTION_ENTRY_NULL
186 /* *INDENT-ON* */
189 static GOptionGroup *terminal_group;
190 #define ARGS_TERM_OPTIONS 0
191 static const GOptionEntry argument_terminal_table[] = {
192 /* *INDENT-OFF* */
193 /* terminal options */
195 "xterm", 'x', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
196 &mc_args__force_xterm,
197 N_("Forces xterm features"),
198 NULL
202 "no-x11", 'X', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
203 &mc_global.tty.disable_x11,
204 N_("Disable X11 support"),
205 NULL
209 "oldmouse", 'g', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
210 &mc_global.tty.old_mouse,
211 N_("Tries to use an old highlight mouse tracking"),
212 NULL
216 "nomouse", 'd', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
217 &mc_args__nomouse,
218 N_("Disable mouse support in text version"),
219 NULL
222 #ifdef HAVE_SLANG
224 "termcap", 't', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
225 &SLtt_Try_Termcap,
226 N_("Tries to use termcap instead of terminfo"),
227 NULL
229 #endif
232 "slow", 's', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
233 &mc_global.tty.slow_terminal,
234 N_("To run on slow terminals"),
235 NULL
239 "stickchars", 'a', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
240 &mc_global.tty.ugly_line_drawing,
241 N_("Use stickchars to draw"),
242 NULL
245 #ifdef HAVE_SLANG
247 "resetsoft", 'k', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
248 &reset_hp_softkeys,
249 N_("Resets soft keys on HP terminals"),
250 NULL
252 #endif
255 "keymap", 'K', ARGS_TERM_OPTIONS, G_OPTION_ARG_STRING,
256 &mc_args__keymap_file,
257 N_("Load definitions of key bindings from specified file"),
258 N_("<file>")
262 "nokeymap", '\0', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
263 &mc_args__nokeymap,
264 N_("Don't load definitions of key bindings from file, use defaults"),
265 NULL
268 G_OPTION_ENTRY_NULL
269 /* *INDENT-ON* */
272 #undef ARGS_TERM_OPTIONS
274 static GOptionGroup *color_group;
275 #define ARGS_COLOR_OPTIONS 0
276 /* #define ARGS_COLOR_OPTIONS G_OPTION_FLAG_IN_MAIN */
277 static const GOptionEntry argument_color_table[] = {
278 /* *INDENT-OFF* */
279 /* color options */
281 "nocolor", 'b', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE,
282 &mc_global.tty.disable_colors,
283 N_("Requests to run in black and white"),
284 NULL
288 "color", 'c', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE,
289 &mc_args__force_colors,
290 N_("Request to run in color mode"),
291 NULL
295 "colors", 'C', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
296 &mc_global.tty.command_line_colors,
297 N_("Specifies a color configuration"),
298 N_("<string>")
302 "skin", 'S', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
303 &mc_global.tty.skin,
304 N_("Show mc with specified skin"),
305 N_("<string>")
308 G_OPTION_ENTRY_NULL
309 /* *INDENT-ON* */
312 #undef ARGS_COLOR_OPTIONS
314 static gchar *mc_args__loc__colors_string = NULL;
315 static gchar *mc_args__loc__footer_string = NULL;
316 static gchar *mc_args__loc__header_string = NULL;
317 static gchar *mc_args__loc__usage_string = NULL;
319 /* --------------------------------------------------------------------------------------------- */
320 /*** file scope functions ************************************************************************/
321 /* --------------------------------------------------------------------------------------------- */
323 static void
324 mc_args_clean_temp_help_strings (void)
326 MC_PTR_FREE (mc_args__loc__colors_string);
327 MC_PTR_FREE (mc_args__loc__footer_string);
328 MC_PTR_FREE (mc_args__loc__header_string);
329 MC_PTR_FREE (mc_args__loc__usage_string);
332 /* --------------------------------------------------------------------------------------------- */
334 static GOptionGroup *
335 mc_args_new_color_group (void)
337 /* *INDENT-OFF* */
338 /* FIXME: to preserve translations, lines should be split. */
339 mc_args__loc__colors_string = g_strdup_printf ("%s\n%s",
340 /* TRANSLATORS: don't translate keywords */
341 _("--colors KEYWORD={FORE},{BACK},{ATTR}:KEYWORD2=...\n\n"
342 "{FORE}, {BACK} and {ATTR} can be omitted, and the default will be used\n"
343 "\n Keywords:\n"
344 " Global: errors, disabled, reverse, gauge, header\n"
345 " input, inputmark, inputunchanged, commandlinemark\n"
346 " bbarhotkey, bbarbutton, statusbar\n"
347 " File display: normal, selected, marked, markselect\n"
348 " Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus, errdhotnormal,\n"
349 " errdhotfocus\n"
350 " Menus: menunormal, menuhot, menusel, menuhotsel, menuinactive\n"
351 " Popup menus: pmenunormal, pmenusel, pmenutitle\n"
352 " Editor: editnormal, editbold, editmarked, editwhitespace, editnonprintable,\n"
353 " editlinestate, editbg, editframe, editframeactive\n"
354 " editframedrag\n"
355 " Viewer: viewnormal,viewbold, viewunderline, viewselected\n"
356 " Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"),
357 /* TRANSLATORS: don't translate color names and attributes */
358 _("Standard Colors:\n"
359 " black, gray, red, brightred, green, brightgreen, brown,\n"
360 " yellow, blue, brightblue, magenta, brightmagenta, cyan,\n"
361 " brightcyan, lightgray and white\n\n"
362 "Extended colors, when 256 colors are available:\n"
363 " color16 to color255, or rgb000 to rgb555 and gray0 to gray23\n\n"
364 "Attributes:\n"
365 " bold, italic, underline, reverse, blink; append more with '+'\n")
367 /* *INDENT-ON* */
369 return g_option_group_new ("color", mc_args__loc__colors_string,
370 _("Color options"), NULL, NULL);
374 /* --------------------------------------------------------------------------------------------- */
376 static gchar *
377 mc_args_add_usage_info (void)
379 gchar *s;
381 switch (mc_global.mc_run_mode)
383 #ifdef USE_INTERNAL_EDIT
384 case MC_RUN_EDITOR:
385 s = g_strdup_printf ("%s\n", _("[+lineno] file1[:lineno] [file2[:lineno]...]"));
386 break;
387 #endif /* USE_INTERNAL_EDIT */
388 case MC_RUN_VIEWER:
389 s = g_strdup_printf ("%s\n", _("file"));
390 break;
391 #ifdef USE_DIFF_VIEW
392 case MC_RUN_DIFFVIEWER:
393 s = g_strdup_printf ("%s\n", _("file1 file2"));
394 break;
395 #endif /* USE_DIFF_VIEW */
396 case MC_RUN_FULL:
397 default:
398 s = g_strdup_printf ("%s\n", _("[this_dir] [other_panel_dir]"));
401 mc_args__loc__usage_string = s;
403 return mc_args__loc__usage_string;
406 /* --------------------------------------------------------------------------------------------- */
408 static void
409 mc_args_add_extended_info_to_help (void)
411 mc_args__loc__footer_string = g_strdup_printf ("%s",
413 ("\n"
414 "Please send any bug reports (including the output of 'mc -V')\n"
415 "as tickets at www.midnight-commander.org\n"));
416 mc_args__loc__header_string =
417 g_strdup_printf (_("GNU Midnight Commander %s\n"), mc_global.mc_version);
419 g_option_context_set_description (context, mc_args__loc__footer_string);
420 g_option_context_set_summary (context, mc_args__loc__header_string);
423 /* --------------------------------------------------------------------------------------------- */
425 static GString *
426 mc_args__convert_help_to_syscharset (const gchar * charset, const gchar * error_message_str,
427 const gchar * help_str)
429 GString *buffer;
430 GIConv conv;
431 gchar *full_help_str;
433 buffer = g_string_new ("");
434 conv = g_iconv_open (charset, "UTF-8");
435 full_help_str = g_strdup_printf ("%s\n\n%s\n", error_message_str, help_str);
437 str_convert (conv, full_help_str, buffer);
439 g_free (full_help_str);
440 g_iconv_close (conv);
442 return buffer;
445 /* --------------------------------------------------------------------------------------------- */
447 static gboolean
448 parse_mc_e_argument (const gchar * option_name, const gchar * value, gpointer data,
449 GError ** mcerror)
451 (void) option_name;
452 (void) value;
453 (void) data;
455 mc_return_val_if_error (mcerror, FALSE);
457 mc_global.mc_run_mode = MC_RUN_EDITOR;
459 return TRUE;
462 /* --------------------------------------------------------------------------------------------- */
464 static gboolean
465 parse_mc_v_argument (const gchar * option_name, const gchar * value, gpointer data,
466 GError ** mcerror)
468 (void) option_name;
469 (void) value;
470 (void) data;
472 mc_return_val_if_error (mcerror, FALSE);
474 mc_global.mc_run_mode = MC_RUN_VIEWER;
476 return TRUE;
479 /* --------------------------------------------------------------------------------------------- */
481 #ifdef USE_INTERNAL_EDIT
483 * Get list of filenames (and line numbers) from command line, when mc called as editor
485 * @param argc count of all arguments
486 * @param argv array of strings, contains arguments
487 * @return list of edit_arg_t objects
490 static GList *
491 parse_mcedit_arguments (int argc, char **argv)
493 GList *flist = NULL;
494 int i;
495 long first_line_number = -1;
497 for (i = 0; i < argc; i++)
499 char *tmp;
500 char *end, *p;
501 edit_arg_t *arg;
503 tmp = argv[i];
506 * First, try to get line number as +lineno.
508 if (*tmp == '+')
510 long lineno;
511 char *error;
513 lineno = strtol (tmp + 1, &error, 10);
515 if (*error == '\0')
517 /* this is line number */
518 first_line_number = lineno;
519 continue;
521 /* this is file name */
525 * Check for filename:lineno, followed by an optional colon.
526 * This format is used by many programs (especially compilers)
527 * in error messages and warnings. It is supported so that
528 * users can quickly copy and paste file locations.
530 end = tmp + strlen (tmp);
531 p = end;
533 if (p > tmp && p[-1] == ':')
534 p--;
535 while (p > tmp && g_ascii_isdigit ((gchar) p[-1]))
536 p--;
538 if (tmp < p && p < end && p[-1] == ':')
540 char *fname;
541 vfs_path_t *tmp_vpath, *fname_vpath;
542 struct stat st;
544 fname = g_strndup (tmp, p - 1 - tmp);
545 tmp_vpath = vfs_path_from_str (tmp);
546 fname_vpath = vfs_path_from_str (fname);
549 * Check that the file before the colon actually exists.
550 * If it doesn't exist, create new file.
552 if (mc_stat (tmp_vpath, &st) == -1 && mc_stat (fname_vpath, &st) != -1)
554 arg = edit_arg_vpath_new (fname_vpath, atoi (p));
555 vfs_path_free (tmp_vpath, TRUE);
557 else
559 arg = edit_arg_vpath_new (tmp_vpath, 0);
560 vfs_path_free (fname_vpath, TRUE);
563 g_free (fname);
565 else
566 arg = edit_arg_new (tmp, 0);
568 flist = g_list_prepend (flist, arg);
571 if (flist == NULL)
572 flist = g_list_prepend (flist, edit_arg_new (NULL, 0));
573 else if (first_line_number != -1)
575 /* overwrite line number for first file */
576 GList *l;
578 l = g_list_last (flist);
579 ((edit_arg_t *) l->data)->line_number = first_line_number;
582 return flist;
584 #endif /* USE_INTERNAL_EDIT */
586 /* --------------------------------------------------------------------------------------------- */
587 /*** public functions ****************************************************************************/
588 /* --------------------------------------------------------------------------------------------- */
590 void
591 mc_setup_run_mode (char **argv)
593 const char *base;
595 base = x_basename (argv[0]);
597 if (strncmp (base, "mcv", 3) == 0 || strcmp (base, "view") == 0)
599 /* mcv* or view is link to mc */
600 mc_global.mc_run_mode = MC_RUN_VIEWER;
602 #ifdef USE_INTERNAL_EDIT
603 else if (strncmp (base, "mce", 3) == 0 || strcmp (base, "vi") == 0)
605 /* mce* or vi is link to mc */
606 mc_global.mc_run_mode = MC_RUN_EDITOR;
608 #endif
609 #ifdef USE_DIFF_VIEW
610 else if (strncmp (base, "mcd", 3) == 0 || strcmp (base, "diff") == 0)
612 /* mcd* or diff is link to mc */
613 mc_global.mc_run_mode = MC_RUN_DIFFVIEWER;
615 #endif /* USE_DIFF_VIEW */
618 /* --------------------------------------------------------------------------------------------- */
620 gboolean
621 mc_args_parse (int *argc, char ***argv, const char *translation_domain, GError ** mcerror)
623 const gchar *_system_codepage;
624 gboolean ok = TRUE;
626 mc_return_val_if_error (mcerror, FALSE);
628 _system_codepage = str_detect_termencoding ();
630 #ifdef ENABLE_NLS
631 if (!str_isutf8 (_system_codepage))
632 bind_textdomain_codeset ("mc", "UTF-8");
633 #endif
635 context = g_option_context_new (mc_args_add_usage_info ());
637 g_option_context_set_ignore_unknown_options (context, FALSE);
639 mc_args_add_extended_info_to_help ();
641 main_group = g_option_group_new ("main", _("Main options"), _("Main options"), NULL, NULL);
643 g_option_group_add_entries (main_group, argument_main_table);
644 g_option_context_set_main_group (context, main_group);
645 g_option_group_set_translation_domain (main_group, translation_domain);
647 terminal_group = g_option_group_new ("terminal", _("Terminal options"),
648 _("Terminal options"), NULL, NULL);
650 g_option_group_add_entries (terminal_group, argument_terminal_table);
651 g_option_context_add_group (context, terminal_group);
652 g_option_group_set_translation_domain (terminal_group, translation_domain);
654 color_group = mc_args_new_color_group ();
656 g_option_group_add_entries (color_group, argument_color_table);
657 g_option_context_add_group (context, color_group);
658 g_option_group_set_translation_domain (color_group, translation_domain);
660 if (!g_option_context_parse (context, argc, argv, mcerror))
662 if (*mcerror == NULL)
663 mc_propagate_error (mcerror, 0, "%s\n", _("Arguments parse error!"));
664 else
666 gchar *help_str;
668 help_str = g_option_context_get_help (context, TRUE, NULL);
670 if (str_isutf8 (_system_codepage))
671 mc_replace_error (mcerror, (*mcerror)->code, "%s\n\n%s\n", (*mcerror)->message,
672 help_str);
673 else
675 GString *full_help_str;
677 full_help_str =
678 mc_args__convert_help_to_syscharset (_system_codepage, (*mcerror)->message,
679 help_str);
680 mc_replace_error (mcerror, (*mcerror)->code, "%s", full_help_str->str);
681 g_string_free (full_help_str, TRUE);
683 g_free (help_str);
686 ok = FALSE;
689 g_option_context_free (context);
690 mc_args_clean_temp_help_strings ();
692 #ifdef ENABLE_NLS
693 if (!str_isutf8 (_system_codepage))
694 bind_textdomain_codeset ("mc", _system_codepage);
695 #endif
697 return ok;
700 /* --------------------------------------------------------------------------------------------- */
702 gboolean
703 mc_args_show_info (void)
705 if (mc_args__show_version)
707 show_version ();
708 return FALSE;
711 if (mc_args__show_datadirs)
713 printf ("%s (%s)\n", mc_global.sysconfig_dir, mc_global.share_data_dir);
714 return FALSE;
717 if (mc_args__show_datadirs_extended)
719 show_datadirs_extended ();
720 return FALSE;
723 #ifdef ENABLE_CONFIGURE_ARGS
724 if (mc_args__show_configure_opts)
726 show_configure_options ();
727 return FALSE;
729 #endif
731 return TRUE;
734 /* --------------------------------------------------------------------------------------------- */
736 gboolean
737 mc_setup_by_args (int argc, char **argv, GError ** mcerror)
739 char *tmp;
741 mc_return_val_if_error (mcerror, FALSE);
743 if (mc_args__force_colors)
744 mc_global.tty.disable_colors = FALSE;
746 #ifdef ENABLE_SUBSHELL
747 if (mc_args__nouse_subshell)
748 mc_global.tty.use_subshell = FALSE;
749 #endif /* ENABLE_SUBSHELL */
751 #ifdef ENABLE_VFS_FTP
752 if (mc_args__netfs_logfile != NULL)
754 vfs_path_t *vpath;
756 vpath = vfs_path_from_str ("ftp://");
757 mc_setctl (vpath, VFS_SETCTL_LOGFILE, (void *) mc_args__netfs_logfile);
758 vfs_path_free (vpath, TRUE);
760 #endif /* ENABLE_VFS_FTP */
762 tmp = (argc > 0) ? argv[1] : NULL;
764 switch (mc_global.mc_run_mode)
766 case MC_RUN_EDITOR:
767 #ifdef USE_INTERNAL_EDIT
768 mc_run_param0 = parse_mcedit_arguments (argc - 1, &argv[1]);
769 break;
770 #else
771 mc_propagate_error (mcerror, 0, "%s\n", _("MC is built without builtin editor."));
772 return FALSE;
773 #endif
775 case MC_RUN_VIEWER:
776 if (tmp == NULL)
778 mc_propagate_error (mcerror, 0, "%s\n", _("No arguments given to the viewer."));
779 return FALSE;
782 mc_run_param0 = g_strdup (tmp);
783 break;
785 #ifdef USE_DIFF_VIEW
786 case MC_RUN_DIFFVIEWER:
787 if (argc < 3)
789 mc_propagate_error (mcerror, 0, "%s\n",
790 _("Two files are required to invoke the diffviewer."));
791 return FALSE;
793 MC_FALLTHROUGH;
794 #endif /* USE_DIFF_VIEW */
796 case MC_RUN_FULL:
797 default:
798 /* set the current dir and the other dir for filemanager,
799 or two files for diff viewer */
800 if (tmp != NULL)
802 mc_run_param0 = g_strdup (tmp);
803 tmp = (argc > 1) ? argv[2] : NULL;
804 if (tmp != NULL)
805 mc_run_param1 = g_strdup (tmp);
807 break;
810 return TRUE;
813 /* --------------------------------------------------------------------------------------------- */