Permalink
Browse files

- Added the --port/-p command line option to select a port; so that y…

…ou can run

  the app if the standard port 9000 is in use already.

SVN Rev: 3332
  • Loading branch information...
derickr committed Aug 6, 2010
1 parent 4d57b3f commit ced4d54398120db21d3037780f416ac2d6ed173f
Showing with 27 additions and 0 deletions.
  1. +27 −0 src/main.c
View
@@ -13,6 +13,7 @@
#include "callbacks.h"
#include "support.h"
#include "globals.h"
+#include "getopt.h"
GtkWidget *MainWindow;
GtkWidget *AddBreakPointWindow;
@@ -65,6 +66,32 @@ int main (int argc, char *argv[])
}
break_on_warning = gconf_engine_get_bool(conf, "/apps/gtkdbgp/break_on_warning", NULL);
gconf_engine_set_bool(conf, "/apps/gtkdbgp/break_on_warning", break_on_warning, NULL);
+
+ /* Do command line arguments */
+ {
+ int c;
+ int option_index = 0;
+
+ while(1) {
+ static struct option long_options[] = {
+ {"port", required_argument, 0, 'p'},
+ {0, 0, 0, 0}
+ };
+
+ c = getopt_long(argc, argv, "p:", long_options, &option_index);
+ if (c == -1) {
+ break;
+ }
+
+ switch(c) {
+ case 'p':
+ port = strtol(optarg, NULL, 10);
+ gconf_engine_set_int(conf, "/apps/gtkdbgp/port", port, NULL);
+ break;
+ }
+ }
+ }
+
gconf_engine_unref(conf);
gtk_set_locale();

0 comments on commit ced4d54

Please sign in to comment.