From 65f05ce618fc79466d7ea9810361289c6119abdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D0=BD=D0=B8=D1=86=D0=BA=D0=B8=D0=B9=20=D0=92=D0=B0?= =?UTF-8?q?=20=D0=B4=D0=B8=D0=BC?= Date: Sun, 10 Jan 2016 19:14:17 +0600 Subject: mobile: Fix for "Added runtime selection of gps device" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'gps host HOST:PORT' line in the config file now is generated correctly. So that it is parsed correctly when loading the config on next startup. Also the gpsd port now is parsed as it should without a colon. Written-by: Яницкий Ва дим Signed-off-by: Sylvain Munaut --- src/host/layer23/src/mobile/vty_interface.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c index 5782a173..4e5c8645 100644 --- a/src/host/layer23/src/mobile/vty_interface.c +++ b/src/host/layer23/src/mobile/vty_interface.c @@ -1073,10 +1073,10 @@ DEFUN(cfg_gps_host, cfg_gps_host_cmd, "gps host HOST:PORT", { char* colon = strstr(argv[0], ":"); if (colon != NULL) { - memcpy(g.gpsd_host, argv[0], colon - argv[0] - 1); + memcpy(g.gpsd_host, argv[0], colon - argv[0]); g.gpsd_host[colon - argv[0]] = '\0'; - memcpy(g.gpsd_port, colon, strlen(colon)); - g.gpsd_port[strlen(colon)] = '\0'; + memcpy(g.gpsd_port, colon+1, strlen(colon+1)); + g.gpsd_port[strlen(colon+1)] = '\0'; } else { snprintf(g.gpsd_host, ARRAY_SIZE(g.gpsd_host), "%s", argv[0]); g.gpsd_host[ARRAY_SIZE(g.gpsd_host) - 1] = '\0'; @@ -1499,8 +1499,7 @@ static int config_write(struct vty *vty) struct osmocom_ms *ms; #ifdef _HAVE_GPSD - vty_out(vty, "gpsd host %s%s", g.gpsd_host, VTY_NEWLINE); - vty_out(vty, "gpsd port %s%s", g.gpsd_port, VTY_NEWLINE); + vty_out(vty, "gps host %s:%s%s", g.gpsd_host, g.gpsd_port, VTY_NEWLINE); #endif vty_out(vty, "gps device %s%s", g.device, VTY_NEWLINE); if (g.baud) -- cgit v1.2.3