summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/mobile/vty_interface.c
diff options
context:
space:
mode:
authorЯницкий Ва дим <axilirator@gmail.com>2016-01-10 19:14:17 +0600
committerSylvain Munaut <tnt@246tNt.com>2016-01-18 21:08:45 +0100
commit65f05ce618fc79466d7ea9810361289c6119abdb (patch)
tree5fe8f3cc4d17934bb753070eb5ce6f259df3d981 /src/host/layer23/src/mobile/vty_interface.c
parentef0d8ec31d3560e5f272042a3fea618e0ab1be8c (diff)
mobile: Fix for "Added runtime selection of gps device"
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: Яницкий Ва дим <axilirator@gmail.com> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/host/layer23/src/mobile/vty_interface.c')
-rw-r--r--src/host/layer23/src/mobile/vty_interface.c9
1 files 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)