|
@@ -30,12 +30,12 @@
|
|
|
|
|
|
#include "lib/global.h"
|
|
#include "lib/global.h"
|
|
#include "lib/tty/tty.h"
|
|
#include "lib/tty/tty.h"
|
|
-#include "lib/tty/color.h" /* command_line_colors */
|
|
|
|
|
|
+#include "lib/tty/color.h" /* command_line_colors */
|
|
#include "lib/strutil.h"
|
|
#include "lib/strutil.h"
|
|
|
|
|
|
#include "src/main.h"
|
|
#include "src/main.h"
|
|
#include "src/textconf.h"
|
|
#include "src/textconf.h"
|
|
-#include "subshell.h" /* use_subshell */
|
|
|
|
|
|
+#include "subshell.h" /* use_subshell */
|
|
|
|
|
|
#include "src/args.h"
|
|
#include "src/args.h"
|
|
|
|
|
|
@@ -74,7 +74,7 @@ char *mc_args__netfs_logfile = NULL;
|
|
/* keymap file */
|
|
/* keymap file */
|
|
char *mc_args__keymap_file = NULL;
|
|
char *mc_args__keymap_file = NULL;
|
|
|
|
|
|
-/* Debug level*/
|
|
|
|
|
|
+/* Debug level */
|
|
int mc_args__debug_level = 0;
|
|
int mc_args__debug_level = 0;
|
|
|
|
|
|
|
|
|
|
@@ -97,38 +97,33 @@ static const GOptionEntry argument_main_table[] = {
|
|
"version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
|
"version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
|
&mc_args__version,
|
|
&mc_args__version,
|
|
N_("Displays the current version"),
|
|
N_("Displays the current version"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
/* options for wrappers */
|
|
/* options for wrappers */
|
|
{
|
|
{
|
|
"datadir", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
|
"datadir", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
|
&mc_args__show_datadirs,
|
|
&mc_args__show_datadirs,
|
|
N_("Print data directory"),
|
|
N_("Print data directory"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
{
|
|
{
|
|
"printwd", 'P', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
|
"printwd", 'P', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
|
&mc_args__last_wd_file,
|
|
&mc_args__last_wd_file,
|
|
N_("Print last working directory to specified file"),
|
|
N_("Print last working directory to specified file"),
|
|
- "<file>"
|
|
|
|
- },
|
|
|
|
|
|
+ "<file>"},
|
|
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
{
|
|
{
|
|
"subshell", 'U', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
|
"subshell", 'U', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
|
&use_subshell,
|
|
&use_subshell,
|
|
N_("Enables subshell support (default)"),
|
|
N_("Enables subshell support (default)"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
{
|
|
{
|
|
"nosubshell", 'u', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
|
"nosubshell", 'u', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
|
&mc_args__nouse_subshell,
|
|
&mc_args__nouse_subshell,
|
|
N_("Disables subshell support"),
|
|
N_("Disables subshell support"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
#endif
|
|
#endif
|
|
|
|
|
|
/* debug options */
|
|
/* debug options */
|
|
@@ -137,15 +132,13 @@ static const GOptionEntry argument_main_table[] = {
|
|
"ftplog", 'l', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
|
"ftplog", 'l', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
|
&mc_args__netfs_logfile,
|
|
&mc_args__netfs_logfile,
|
|
N_("Log ftp dialog to specified file"),
|
|
N_("Log ftp dialog to specified file"),
|
|
- "<file>"
|
|
|
|
- },
|
|
|
|
|
|
+ "<file>"},
|
|
#ifdef ENABLE_VFS_SMB
|
|
#ifdef ENABLE_VFS_SMB
|
|
{
|
|
{
|
|
"debuglevel", 'D', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_INT,
|
|
"debuglevel", 'D', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_INT,
|
|
&mc_args__debug_level,
|
|
&mc_args__debug_level,
|
|
N_("Set debug level"),
|
|
N_("Set debug level"),
|
|
- "<integer>"
|
|
|
|
- },
|
|
|
|
|
|
+ "<integer>"},
|
|
#endif /* ENABLE_VFS_SMB */
|
|
#endif /* ENABLE_VFS_SMB */
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -154,15 +147,13 @@ static const GOptionEntry argument_main_table[] = {
|
|
"view", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
|
"view", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
|
&view_one_file,
|
|
&view_one_file,
|
|
N_("Launches the file viewer on a file"),
|
|
N_("Launches the file viewer on a file"),
|
|
- "<file>"
|
|
|
|
- },
|
|
|
|
|
|
+ "<file>"},
|
|
|
|
|
|
{
|
|
{
|
|
"edit", 'e', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
|
"edit", 'e', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
|
&edit_one_file,
|
|
&edit_one_file,
|
|
N_("Edits one file"),
|
|
N_("Edits one file"),
|
|
- "<file>"
|
|
|
|
- },
|
|
|
|
|
|
+ "<file>"},
|
|
|
|
|
|
{NULL}
|
|
{NULL}
|
|
};
|
|
};
|
|
@@ -176,55 +167,49 @@ static const GOptionEntry argument_terminal_table[] = {
|
|
"xterm", 'x', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
"xterm", 'x', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
&mc_args__force_xterm,
|
|
&mc_args__force_xterm,
|
|
N_("Forces xterm features"),
|
|
N_("Forces xterm features"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
{
|
|
{
|
|
"nomouse", 'd', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
"nomouse", 'd', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
&mc_args__nomouse,
|
|
&mc_args__nomouse,
|
|
N_("Disable mouse support in text version"),
|
|
N_("Disable mouse support in text version"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
#ifdef HAVE_SLANG
|
|
#ifdef HAVE_SLANG
|
|
{
|
|
{
|
|
"termcap", 't', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
"termcap", 't', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
&SLtt_Try_Termcap,
|
|
&SLtt_Try_Termcap,
|
|
N_("Tries to use termcap instead of terminfo"),
|
|
N_("Tries to use termcap instead of terminfo"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
#endif
|
|
#endif
|
|
|
|
|
|
{
|
|
{
|
|
"slow", 's', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
"slow", 's', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
&mc_args__slow_terminal,
|
|
&mc_args__slow_terminal,
|
|
N_("To run on slow terminals"),
|
|
N_("To run on slow terminals"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
{
|
|
{
|
|
"stickchars", 'a', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
"stickchars", 'a', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
&mc_args__ugly_line_drawing,
|
|
&mc_args__ugly_line_drawing,
|
|
N_("Use stickchars to draw"),
|
|
N_("Use stickchars to draw"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
{
|
|
{
|
|
"resetsoft", 'k', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
"resetsoft", 'k', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
|
&reset_hp_softkeys,
|
|
&reset_hp_softkeys,
|
|
N_("Resets soft keys on HP terminals"),
|
|
N_("Resets soft keys on HP terminals"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
{
|
|
{
|
|
"keymap", 'K', ARGS_TERM_OPTIONS, G_OPTION_ARG_STRING,
|
|
"keymap", 'K', ARGS_TERM_OPTIONS, G_OPTION_ARG_STRING,
|
|
&mc_args__keymap_file,
|
|
&mc_args__keymap_file,
|
|
N_("Load definitions of key bindings from specified file"),
|
|
N_("Load definitions of key bindings from specified file"),
|
|
- "<file>"
|
|
|
|
- },
|
|
|
|
|
|
+ "<file>"},
|
|
|
|
|
|
{NULL}
|
|
{NULL}
|
|
};
|
|
};
|
|
|
|
+
|
|
#undef ARGS_TERM_OPTIONS
|
|
#undef ARGS_TERM_OPTIONS
|
|
|
|
|
|
GOptionGroup *color_group;
|
|
GOptionGroup *color_group;
|
|
@@ -236,32 +221,29 @@ static const GOptionEntry argument_color_table[] = {
|
|
"nocolor", 'b', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE,
|
|
"nocolor", 'b', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE,
|
|
&mc_args__disable_colors,
|
|
&mc_args__disable_colors,
|
|
N_("Requests to run in black and white"),
|
|
N_("Requests to run in black and white"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
{
|
|
{
|
|
"color", 'c', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE,
|
|
"color", 'c', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE,
|
|
&mc_args__force_colors,
|
|
&mc_args__force_colors,
|
|
N_("Request to run in color mode"),
|
|
N_("Request to run in color mode"),
|
|
- NULL
|
|
|
|
- },
|
|
|
|
|
|
+ NULL},
|
|
|
|
|
|
{
|
|
{
|
|
"colors", 'C', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
|
"colors", 'C', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
|
&command_line_colors,
|
|
&command_line_colors,
|
|
N_("Specifies a color configuration"),
|
|
N_("Specifies a color configuration"),
|
|
- "<string>"
|
|
|
|
- },
|
|
|
|
|
|
+ "<string>"},
|
|
|
|
|
|
{
|
|
{
|
|
"skin", 'S', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
|
"skin", 'S', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
|
&mc_args__skin,
|
|
&mc_args__skin,
|
|
N_("Show mc with specified skin"),
|
|
N_("Show mc with specified skin"),
|
|
- "<string>"
|
|
|
|
- },
|
|
|
|
|
|
+ "<string>"},
|
|
|
|
|
|
- {NULL}
|
|
|
|
|
|
+ { NULL }
|
|
};
|
|
};
|
|
|
|
+
|
|
#undef ARGS_COLOR_OPTIONS
|
|
#undef ARGS_COLOR_OPTIONS
|
|
|
|
|
|
static gchar *mc_args__loc__colors_string = NULL;
|
|
static gchar *mc_args__loc__colors_string = NULL;
|
|
@@ -273,81 +255,80 @@ static gchar *mc_args__loc__usage_string = NULL;
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
static void
|
|
static void
|
|
-mc_args_clean_temp_help_strings(void)
|
|
|
|
|
|
+mc_args_clean_temp_help_strings (void)
|
|
{
|
|
{
|
|
- g_free(mc_args__loc__colors_string);
|
|
|
|
|
|
+ g_free (mc_args__loc__colors_string);
|
|
mc_args__loc__colors_string = NULL;
|
|
mc_args__loc__colors_string = NULL;
|
|
|
|
|
|
- g_free(mc_args__loc__footer_string);
|
|
|
|
|
|
+ g_free (mc_args__loc__footer_string);
|
|
mc_args__loc__footer_string = NULL;
|
|
mc_args__loc__footer_string = NULL;
|
|
|
|
|
|
- g_free(mc_args__loc__header_string);
|
|
|
|
|
|
+ g_free (mc_args__loc__header_string);
|
|
mc_args__loc__header_string = NULL;
|
|
mc_args__loc__header_string = NULL;
|
|
|
|
|
|
- g_free(mc_args__loc__usage_string);
|
|
|
|
|
|
+ g_free (mc_args__loc__usage_string);
|
|
mc_args__loc__usage_string = NULL;
|
|
mc_args__loc__usage_string = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
static GOptionGroup *
|
|
static GOptionGroup *
|
|
-mc_args_new_color_group(void)
|
|
|
|
|
|
+mc_args_new_color_group (void)
|
|
{
|
|
{
|
|
/*
|
|
/*
|
|
* FIXME: undocumented keywords: viewunderline, editnormal, editbold,
|
|
* FIXME: undocumented keywords: viewunderline, editnormal, editbold,
|
|
* and editmarked. To preserve translations, lines should be split.
|
|
* and editmarked. To preserve translations, lines should be split.
|
|
*/
|
|
*/
|
|
|
|
|
|
- mc_args__loc__colors_string = g_strdup_printf("%s%s",
|
|
|
|
- /* TRANSLATORS: don't translate keywords and names of colors */
|
|
|
|
- _( "--colors KEYWORD={FORE},{BACK}\n\n"
|
|
|
|
- "{FORE} and {BACK} can be omitted, and the default will be used\n"
|
|
|
|
- "\n" "Keywords:\n"
|
|
|
|
- " Global: errors, reverse, gauge, input, viewunderline\n"
|
|
|
|
- " File display: normal, selected, marked, markselect\n"
|
|
|
|
- " Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus, errdhotnormal,\n"
|
|
|
|
- " errdhotfocus\n"
|
|
|
|
- " Menus: menunormal, menuhot, menusel, menuhotsel, menuinactive\n"
|
|
|
|
- " Editor: editnormal, editbold, editmarked, editwhitespace,\n"
|
|
|
|
- " editlinestate\n"),
|
|
|
|
- /* TRANSLATORS: don't translate keywords and names of colors */
|
|
|
|
- _( " Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"
|
|
|
|
- "\n" "Colors:\n"
|
|
|
|
- " black, gray, red, brightred, green, brightgreen, brown,\n"
|
|
|
|
- " yellow, blue, brightblue, magenta, brightmagenta, cyan,\n"
|
|
|
|
- " brightcyan, lightgray and white\n\n")
|
|
|
|
- );
|
|
|
|
|
|
+ mc_args__loc__colors_string = g_strdup_printf ("%s%s",
|
|
|
|
+ /* TRANSLATORS: don't translate keywords and names of colors */
|
|
|
|
+ _("--colors KEYWORD={FORE},{BACK}\n\n"
|
|
|
|
+ "{FORE} and {BACK} can be omitted, and the default will be used\n"
|
|
|
|
+ "\n" "Keywords:\n"
|
|
|
|
+ " Global: errors, reverse, gauge, input, viewunderline\n"
|
|
|
|
+ " File display: normal, selected, marked, markselect\n"
|
|
|
|
+ " Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus, errdhotnormal,\n"
|
|
|
|
+ " errdhotfocus\n"
|
|
|
|
+ " Menus: menunormal, menuhot, menusel, menuhotsel, menuinactive\n"
|
|
|
|
+ " Editor: editnormal, editbold, editmarked, editwhitespace,\n"
|
|
|
|
+ " editlinestate\n"),
|
|
|
|
+ /* TRANSLATORS: don't translate keywords and names of colors */
|
|
|
|
+ _
|
|
|
|
+ (" Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"
|
|
|
|
+ "\n" "Colors:\n"
|
|
|
|
+ " black, gray, red, brightred, green, brightgreen, brown,\n"
|
|
|
|
+ " yellow, blue, brightblue, magenta, brightmagenta, cyan,\n"
|
|
|
|
+ " brightcyan, lightgray and white\n\n"));
|
|
|
|
|
|
return g_option_group_new ("color", mc_args__loc__colors_string,
|
|
return g_option_group_new ("color", mc_args__loc__colors_string,
|
|
- _("Color options"),NULL, NULL);
|
|
|
|
|
|
+ _("Color options"), NULL, NULL);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
static gchar *
|
|
static gchar *
|
|
-mc_args_add_usage_info(void)
|
|
|
|
|
|
+mc_args_add_usage_info (void)
|
|
{
|
|
{
|
|
- mc_args__loc__usage_string = g_strdup_printf("[%s] %s\n %s - %s\n",
|
|
|
|
- _("+number"),
|
|
|
|
- _("[this_dir] [other_panel_dir]"),
|
|
|
|
- _("+number"),
|
|
|
|
- _("Set initial line number for the internal editor")
|
|
|
|
- );
|
|
|
|
|
|
+ mc_args__loc__usage_string = g_strdup_printf ("[%s] %s\n %s - %s\n",
|
|
|
|
+ _("+number"),
|
|
|
|
+ _("[this_dir] [other_panel_dir]"),
|
|
|
|
+ _("+number"),
|
|
|
|
+ _
|
|
|
|
+ ("Set initial line number for the internal editor"));
|
|
return mc_args__loc__usage_string;
|
|
return mc_args__loc__usage_string;
|
|
}
|
|
}
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
static void
|
|
static void
|
|
-mc_args_add_extended_info_to_help(void)
|
|
|
|
|
|
+mc_args_add_extended_info_to_help (void)
|
|
{
|
|
{
|
|
- mc_args__loc__footer_string = g_strdup_printf("%s",
|
|
|
|
- _
|
|
|
|
- ("\n"
|
|
|
|
- "Please send any bug reports (including the output of `mc -V')\n"
|
|
|
|
- "to mc-devel@gnome.org\n")
|
|
|
|
- );
|
|
|
|
|
|
+ mc_args__loc__footer_string = g_strdup_printf ("%s",
|
|
|
|
+ _
|
|
|
|
+ ("\n"
|
|
|
|
+ "Please send any bug reports (including the output of `mc -V')\n"
|
|
|
|
+ "to mc-devel@gnome.org\n"));
|
|
mc_args__loc__header_string = g_strdup_printf (_("GNU Midnight Commander %s\n"), VERSION);
|
|
mc_args__loc__header_string = g_strdup_printf (_("GNU Midnight Commander %s\n"), VERSION);
|
|
|
|
|
|
#if GLIB_CHECK_VERSION(2,12,0)
|
|
#if GLIB_CHECK_VERSION(2,12,0)
|
|
@@ -360,27 +341,29 @@ mc_args_add_extended_info_to_help(void)
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
static gboolean
|
|
static gboolean
|
|
-mc_args_process(void)
|
|
|
|
|
|
+mc_args_process (void)
|
|
{
|
|
{
|
|
- if (mc_args__version){
|
|
|
|
- show_version ();
|
|
|
|
- return FALSE;
|
|
|
|
|
|
+ if (mc_args__version)
|
|
|
|
+ {
|
|
|
|
+ show_version ();
|
|
|
|
+ return FALSE;
|
|
}
|
|
}
|
|
- if (mc_args__show_datadirs){
|
|
|
|
- printf ("%s (%s)\n", mc_home, mc_home_alt);
|
|
|
|
- return FALSE;
|
|
|
|
|
|
+ if (mc_args__show_datadirs)
|
|
|
|
+ {
|
|
|
|
+ printf ("%s (%s)\n", mc_home, mc_home_alt);
|
|
|
|
+ return FALSE;
|
|
}
|
|
}
|
|
|
|
|
|
if (mc_args__force_colors)
|
|
if (mc_args__force_colors)
|
|
- mc_args__disable_colors = FALSE;
|
|
|
|
|
|
+ mc_args__disable_colors = FALSE;
|
|
|
|
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
|
if (mc_args__nouse_subshell)
|
|
if (mc_args__nouse_subshell)
|
|
- use_subshell = 0;
|
|
|
|
|
|
+ use_subshell = 0;
|
|
|
|
|
|
if (mc_args__nouse_subshell)
|
|
if (mc_args__nouse_subshell)
|
|
- use_subshell = 0;
|
|
|
|
-#endif /* HAVE_SUBSHELL_SUPPORT */
|
|
|
|
|
|
+ use_subshell = 0;
|
|
|
|
+#endif /* HAVE_SUBSHELL_SUPPORT */
|
|
|
|
|
|
return TRUE;
|
|
return TRUE;
|
|
}
|
|
}
|
|
@@ -388,18 +371,19 @@ mc_args_process(void)
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
static gchar *
|
|
static gchar *
|
|
-mc_args__convert_help_to_syscharset(const gchar *charset, const gchar *error_message, const gchar *help_str)
|
|
|
|
|
|
+mc_args__convert_help_to_syscharset (const gchar * charset, const gchar * error_message,
|
|
|
|
+ const gchar * help_str)
|
|
{
|
|
{
|
|
- GString *buffer = g_string_new("");
|
|
|
|
- GIConv conv = g_iconv_open ( charset, "UTF-8");
|
|
|
|
- gchar *full_help_str = g_strdup_printf("%s\n\n%s\n",error_message,help_str);
|
|
|
|
|
|
+ GString *buffer = g_string_new ("");
|
|
|
|
+ GIConv conv = g_iconv_open (charset, "UTF-8");
|
|
|
|
+ gchar *full_help_str = g_strdup_printf ("%s\n\n%s\n", error_message, help_str);
|
|
|
|
|
|
str_convert (conv, full_help_str, buffer);
|
|
str_convert (conv, full_help_str, buffer);
|
|
|
|
|
|
- g_free(full_help_str);
|
|
|
|
|
|
+ g_free (full_help_str);
|
|
g_iconv_close (conv);
|
|
g_iconv_close (conv);
|
|
|
|
|
|
- return g_string_free(buffer, FALSE);
|
|
|
|
|
|
+ return g_string_free (buffer, FALSE);
|
|
}
|
|
}
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
@@ -409,80 +393,82 @@ mc_args__convert_help_to_syscharset(const gchar *charset, const gchar *error_mes
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
|
|
|
|
gboolean
|
|
gboolean
|
|
-mc_args_handle(int *argc, char ***argv, const gchar *translation_domain)
|
|
|
|
|
|
+mc_args_handle (int *argc, char ***argv, const gchar * translation_domain)
|
|
{
|
|
{
|
|
GError *error = NULL;
|
|
GError *error = NULL;
|
|
- const gchar *_system_codepage = str_detect_termencoding();
|
|
|
|
|
|
+ const gchar *_system_codepage = str_detect_termencoding ();
|
|
|
|
|
|
#ifdef ENABLE_NLS
|
|
#ifdef ENABLE_NLS
|
|
if (!str_isutf8 (_system_codepage))
|
|
if (!str_isutf8 (_system_codepage))
|
|
- bind_textdomain_codeset ("mc", "UTF-8");
|
|
|
|
|
|
+ bind_textdomain_codeset ("mc", "UTF-8");
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- context = g_option_context_new (mc_args_add_usage_info());
|
|
|
|
|
|
+ context = g_option_context_new (mc_args_add_usage_info ());
|
|
|
|
|
|
g_option_context_set_ignore_unknown_options (context, FALSE);
|
|
g_option_context_set_ignore_unknown_options (context, FALSE);
|
|
|
|
|
|
- mc_args_add_extended_info_to_help();
|
|
|
|
|
|
+ mc_args_add_extended_info_to_help ();
|
|
|
|
|
|
- main_group = g_option_group_new ("main", _("Main options"),
|
|
|
|
- _("Main options"),NULL, NULL);
|
|
|
|
|
|
+ main_group = g_option_group_new ("main", _("Main options"), _("Main options"), NULL, NULL);
|
|
|
|
|
|
g_option_group_add_entries (main_group, argument_main_table);
|
|
g_option_group_add_entries (main_group, argument_main_table);
|
|
g_option_context_set_main_group (context, main_group);
|
|
g_option_context_set_main_group (context, main_group);
|
|
- g_option_group_set_translation_domain(main_group, translation_domain);
|
|
|
|
|
|
+ g_option_group_set_translation_domain (main_group, translation_domain);
|
|
|
|
|
|
|
|
|
|
terminal_group = g_option_group_new ("terminal", _("Terminal options"),
|
|
terminal_group = g_option_group_new ("terminal", _("Terminal options"),
|
|
- _("Terminal options"),NULL, NULL);
|
|
|
|
|
|
+ _("Terminal options"), NULL, NULL);
|
|
|
|
|
|
g_option_group_add_entries (terminal_group, argument_terminal_table);
|
|
g_option_group_add_entries (terminal_group, argument_terminal_table);
|
|
g_option_context_add_group (context, terminal_group);
|
|
g_option_context_add_group (context, terminal_group);
|
|
- g_option_group_set_translation_domain(terminal_group, translation_domain);
|
|
|
|
|
|
+ g_option_group_set_translation_domain (terminal_group, translation_domain);
|
|
|
|
|
|
|
|
|
|
- color_group = mc_args_new_color_group();
|
|
|
|
|
|
+ color_group = mc_args_new_color_group ();
|
|
|
|
|
|
g_option_group_add_entries (color_group, argument_color_table);
|
|
g_option_group_add_entries (color_group, argument_color_table);
|
|
g_option_context_add_group (context, color_group);
|
|
g_option_context_add_group (context, color_group);
|
|
- g_option_group_set_translation_domain(color_group, translation_domain);
|
|
|
|
|
|
+ g_option_group_set_translation_domain (color_group, translation_domain);
|
|
|
|
|
|
- if (! g_option_context_parse (context, argc, argv, &error)) {
|
|
|
|
- if (error != NULL)
|
|
|
|
- {
|
|
|
|
- gchar *full_help_str;
|
|
|
|
- gchar *help_str;
|
|
|
|
|
|
+ if (!g_option_context_parse (context, argc, argv, &error))
|
|
|
|
+ {
|
|
|
|
+ if (error != NULL)
|
|
|
|
+ {
|
|
|
|
+ gchar *full_help_str;
|
|
|
|
+ gchar *help_str;
|
|
|
|
|
|
#if GLIB_CHECK_VERSION(2,14,0)
|
|
#if GLIB_CHECK_VERSION(2,14,0)
|
|
- help_str = g_option_context_get_help (context, TRUE, NULL);
|
|
|
|
|
|
+ help_str = g_option_context_get_help (context, TRUE, NULL);
|
|
#else
|
|
#else
|
|
- help_str = g_strdup("");
|
|
|
|
|
|
+ help_str = g_strdup ("");
|
|
#endif
|
|
#endif
|
|
- if ( !str_isutf8 (_system_codepage))
|
|
|
|
- full_help_str = mc_args__convert_help_to_syscharset(_system_codepage,error->message, help_str);
|
|
|
|
- else
|
|
|
|
- full_help_str = g_strdup_printf("%s\n\n%s\n",error->message,help_str);
|
|
|
|
-
|
|
|
|
- fprintf(stderr, "%s",full_help_str);
|
|
|
|
-
|
|
|
|
- g_free(help_str);
|
|
|
|
- g_free(full_help_str);
|
|
|
|
- g_error_free (error);
|
|
|
|
- }
|
|
|
|
- g_option_context_free (context);
|
|
|
|
- mc_args_clean_temp_help_strings();
|
|
|
|
- return FALSE;
|
|
|
|
|
|
+ if (!str_isutf8 (_system_codepage))
|
|
|
|
+ full_help_str =
|
|
|
|
+ mc_args__convert_help_to_syscharset (_system_codepage, error->message,
|
|
|
|
+ help_str);
|
|
|
|
+ else
|
|
|
|
+ full_help_str = g_strdup_printf ("%s\n\n%s\n", error->message, help_str);
|
|
|
|
+
|
|
|
|
+ fprintf (stderr, "%s", full_help_str);
|
|
|
|
+
|
|
|
|
+ g_free (help_str);
|
|
|
|
+ g_free (full_help_str);
|
|
|
|
+ g_error_free (error);
|
|
|
|
+ }
|
|
|
|
+ g_option_context_free (context);
|
|
|
|
+ mc_args_clean_temp_help_strings ();
|
|
|
|
+ return FALSE;
|
|
}
|
|
}
|
|
|
|
|
|
g_option_context_free (context);
|
|
g_option_context_free (context);
|
|
- mc_args_clean_temp_help_strings();
|
|
|
|
|
|
+ mc_args_clean_temp_help_strings ();
|
|
|
|
|
|
#ifdef ENABLE_NLS
|
|
#ifdef ENABLE_NLS
|
|
if (!str_isutf8 (_system_codepage))
|
|
if (!str_isutf8 (_system_codepage))
|
|
- bind_textdomain_codeset ("mc", _system_codepage);
|
|
|
|
|
|
+ bind_textdomain_codeset ("mc", _system_codepage);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- return mc_args_process();
|
|
|
|
|
|
+ return mc_args_process ();
|
|
}
|
|
}
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------------------------------------- */
|