[Gnucash-changes] r13192 - gnucash/trunk - Pass argc by reference instead of value so g_option_parse_context can

David Hampton hampton at cvs.gnucash.org
Fri Feb 10 00:44:09 EST 2006


Author: hampton
Date: 2006-02-10 00:44:08 -0500 (Fri, 10 Feb 2006)
New Revision: 13192
Trac: http://svn.gnucash.org/trac/changeset/13192

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/bin/gnucash-bin.c
Log:
Pass argc by reference instead of value so g_option_parse_context can
update it.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-02-10 04:17:38 UTC (rev 13191)
+++ gnucash/trunk/ChangeLog	2006-02-10 05:44:08 UTC (rev 13192)
@@ -1,5 +1,8 @@
 2006-02-09  David Hampton  <hampton at employees.org>
 
+	* src/bin/gnucash-bin.c: Pass argc by reference instead of value
+	so g_option_parse_context can update it.
+
 	* src/bin/gnucash-bin.c: Don't initialize the display at option
 	parsing time.  This way --add-price-quotes can run from a cron
 	job.

Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2006-02-10 04:17:38 UTC (rev 13191)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2006-02-10 05:44:08 UTC (rev 13192)
@@ -203,7 +203,7 @@
  */
 
 static void 
-gnucash_command_line(int argc, char **argv)
+gnucash_command_line(int *argc, char **argv)
 {
     char *p;
     int debugging = 0;
@@ -251,7 +251,7 @@
     /* Pretend that argv[0] is "gnucash" */
     if ((p = strstr(argv[0], "-bin"))) *p = '\0';
 
-    pc = poptGetContext(NULL, argc, (const char **)argv, options, 0);
+    pc = poptGetContext(NULL, *argc, (const char **)argv, options, 0);
     poptSetOtherOptionHelp(pc, "[OPTIONS...] [datafile]");
     
     while ((rc = poptGetNextOpt(pc)) > 0);
@@ -307,10 +307,10 @@
     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);
+    g_option_context_parse (context, argc, &argv, &error);
     g_option_context_free (context);
 
-    if (argc > 0)
+    if (*argc > 0)
       file_to_load = argv[1];
 #endif
 
@@ -484,12 +484,9 @@
 
     gnc_module_system_init();
     envt_override();
-    gnucash_command_line(argc, argv);
+    gnucash_command_line(&argc, argv);
     gnc_print_unstable_message();
 
-    /* argv may have changed */
-    for (argc = 0; argv[argc]; argc++) ;
-
     if (add_quotes_file) {
         /* This option needs to run without a display, so we can't
            initialize any GUI libraries.  */



More information about the gnucash-changes mailing list