mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Initialize variables; detect/report errors during gnucash command-line options parsing. Formatting.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15554 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ff3405f4c8
commit
0efccfc12f
@ -66,13 +66,12 @@ static int is_development_version = FALSE;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Command-line option variables */
|
/* Command-line option variables */
|
||||||
static int gnucash_show_version;
|
static int gnucash_show_version = 0;
|
||||||
static const char *add_quotes_file;
|
static const char *add_quotes_file = NULL;
|
||||||
static int nofile;
|
static int nofile = 0;
|
||||||
static const char *file_to_load;
|
static const char *file_to_load = NULL;
|
||||||
// static int loglevel;
|
static gchar **log_flags = NULL;
|
||||||
static gchar **log_flags;
|
static gchar *log_to_filename = NULL;
|
||||||
static gchar *log_to_filename;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_print_unstable_message(void)
|
gnc_print_unstable_message(void)
|
||||||
@ -263,24 +262,33 @@ gnucash_command_line(int *argc, char **argv)
|
|||||||
context = g_option_context_new (" [datafile]");
|
context = g_option_context_new (" [datafile]");
|
||||||
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
|
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
|
||||||
g_option_context_add_group (context, gtk_get_option_group (FALSE));
|
g_option_context_add_group (context, gtk_get_option_group (FALSE));
|
||||||
g_option_context_parse (context, argc, &argv, &error);
|
if (!g_option_context_parse (context, argc, &argv, &error))
|
||||||
|
{
|
||||||
|
g_error("error parsing command line args: %s", error->message);
|
||||||
|
}
|
||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
|
if (error)
|
||||||
|
g_error_free(error);
|
||||||
|
|
||||||
if (*argc > 0)
|
if (*argc > 0)
|
||||||
file_to_load = argv[1];
|
file_to_load = argv[1];
|
||||||
|
|
||||||
if (gnucash_show_version) {
|
if (gnucash_show_version) {
|
||||||
if (is_development_version)
|
if (is_development_version)
|
||||||
/* Translators: %s is the version number */
|
{
|
||||||
g_print(_("GnuCash %s development version"), VERSION);
|
/* Translators: %s is the version number */
|
||||||
else
|
g_print(_("GnuCash %s development version"), VERSION);
|
||||||
/* Translators: %s is the version number */
|
}
|
||||||
g_print(_("GnuCash %s"), VERSION);
|
else
|
||||||
g_print("\n");
|
{
|
||||||
/* Translators: 1st %s is the build date; 2nd %s is the SVN
|
/* Translators: %s is the version number */
|
||||||
revision number */
|
g_print(_("GnuCash %s"), VERSION);
|
||||||
|
}
|
||||||
|
g_print("\n");
|
||||||
|
/* Translators: 1st %s is the build date; 2nd %s is the SVN
|
||||||
|
revision number */
|
||||||
g_print(_("Built %s from r%s"), GNUCASH_BUILD_DATE, GNUCASH_SVN_REV);
|
g_print(_("Built %s from r%s"), GNUCASH_BUILD_DATE, GNUCASH_SVN_REV);
|
||||||
g_print("\n");
|
g_print("\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user