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
|
||||
|
||||
/* Command-line option variables */
|
||||
static int gnucash_show_version;
|
||||
static const char *add_quotes_file;
|
||||
static int nofile;
|
||||
static const char *file_to_load;
|
||||
// static int loglevel;
|
||||
static gchar **log_flags;
|
||||
static gchar *log_to_filename;
|
||||
static int gnucash_show_version = 0;
|
||||
static const char *add_quotes_file = NULL;
|
||||
static int nofile = 0;
|
||||
static const char *file_to_load = NULL;
|
||||
static gchar **log_flags = NULL;
|
||||
static gchar *log_to_filename = NULL;
|
||||
|
||||
static void
|
||||
gnc_print_unstable_message(void)
|
||||
@ -263,19 +262,28 @@ gnucash_command_line(int *argc, char **argv)
|
||||
context = g_option_context_new (" [datafile]");
|
||||
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
|
||||
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);
|
||||
if (error)
|
||||
g_error_free(error);
|
||||
|
||||
if (*argc > 0)
|
||||
file_to_load = argv[1];
|
||||
|
||||
if (gnucash_show_version) {
|
||||
if (is_development_version)
|
||||
{
|
||||
/* Translators: %s is the version number */
|
||||
g_print(_("GnuCash %s development version"), VERSION);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Translators: %s is the version number */
|
||||
g_print(_("GnuCash %s"), VERSION);
|
||||
}
|
||||
g_print("\n");
|
||||
/* Translators: 1st %s is the build date; 2nd %s is the SVN
|
||||
revision number */
|
||||
|
Loading…
Reference in New Issue
Block a user