aboutsummaryrefslogtreecommitdiffstats
path: root/gg_map/gg_map.c
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-06-05 09:01:25 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2013-06-05 09:01:25 +0200
commit1370b225cc802fd41167238291d19c84f9ea0ced (patch)
tree967c10b9055ed0871f0f40ff9b0343daa4024ae2 /gg_map/gg_map.c
parentglougloud: option to specify listen interfaces / ports (diff)
downloadglouglou-1370b225cc802fd41167238291d19c84f9ea0ced.tar.xz
glouglou-1370b225cc802fd41167238291d19c84f9ea0ced.zip
gg_map: option to specify glougloud server ip / port
Diffstat (limited to 'gg_map/gg_map.c')
-rw-r--r--gg_map/gg_map.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/gg_map/gg_map.c b/gg_map/gg_map.c
index dda280c..9809977 100644
--- a/gg_map/gg_map.c
+++ b/gg_map/gg_map.c
@@ -13,6 +13,19 @@ Evas_Object *_egraph = NULL;
struct ggnet *_ggnet;
struct event_base *_ev_base;
+#if defined(__OpenBSD__)
+void __dead
+#else
+void
+#endif
+usage(void)
+{
+ extern char *__progname;
+
+ fprintf(stderr, "usage: %s [-hv] [ip [port]]\n", __progname);
+ exit(1);
+}
+
/* link between ecore loop and libevent loop */
static Eina_Bool
_cb_ecore_libevent(void *data) {
@@ -333,7 +346,34 @@ elm_main(int argc, char **argv)
Evas_Object *bx, *bx2, *ck, *sc, *seg_it, *lb;
Evas *evas;
struct gg_client *ggcli;
+ char gg_serv_ip[30] = "127.0.0.1";
+ int gg_serv_port = GLOUGLOU_ANALY_DEFAULT_PORT;
int retval = -1;
+ int loglevel = 0;
+ int op;
+
+ while ((op = getopt(argc, argv, "hv")) != -1) {
+ switch (op) {
+ case 'h':
+ usage();
+ /* NOTREACHED */
+ case 'v':
+ loglevel++;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ switch (argc - optind) {
+ case 2: gg_serv_port = atoi(argv[3]);
+ case 1: strncpy(gg_serv_ip, argv[2], sizeof(gg_serv_ip));
+ case 0:
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
win = elm_win_add(NULL, "panes", ELM_WIN_BASIC);
evas = evas_object_evas_get(win);
@@ -437,7 +477,7 @@ elm_main(int argc, char **argv)
_cb_ggnet_addgroup, _cb_ggnet_delgroup);
_ev_base = event_base_new();
- ggcli = gg_client_connect(_ev_base, "127.0.0.1", GLOUGLOU_ANALY_DEFAULT_PORT,
+ ggcli = gg_client_connect(_ev_base, gg_serv_ip, gg_serv_port,
NULL, _cb_packet, NULL);
if (!ggcli)
goto quit;