From 799b08214dffc3c86e30c4547acd9015078a18ac Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Wed, 31 Dec 2014 00:11:24 -0500 Subject: Add location_t type with lat/lon fields --- src/location-manual.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/location-manual.c') diff --git a/src/location-manual.c b/src/location-manual.c index 30dfc9c..c5da074 100644 --- a/src/location-manual.c +++ b/src/location-manual.c @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with Redshift. If not, see . - Copyright (c) 2010 Jon Lund Steffensen + Copyright (c) 2010-2014 Jon Lund Steffensen */ #include @@ -36,8 +36,8 @@ int location_manual_init(location_manual_state_t *state) { - state->lat = NAN; - state->lon = NAN; + state->loc.lat = NAN; + state->loc.lon = NAN; return 0; } @@ -46,7 +46,7 @@ int location_manual_start(location_manual_state_t *state) { /* Latitude and longitude must be set */ - if (isnan(state->lat) || isnan(state->lon)) { + if (isnan(state->loc.lat) || isnan(state->loc.lon)) { fputs(_("Latitude and longitude must be set.\n"), stderr); exit(EXIT_FAILURE); } @@ -89,9 +89,9 @@ location_manual_set_option(location_manual_state_t *state, const char *key, } if (strcasecmp(key, "lat") == 0) { - state->lat = v; + state->loc.lat = v; } else if (strcasecmp(key, "lon") == 0) { - state->lon = v; + state->loc.lon = v; } else { fprintf(stderr, _("Unknown method parameter: `%s'.\n"), key); return -1; @@ -101,11 +101,10 @@ location_manual_set_option(location_manual_state_t *state, const char *key, } int -location_manual_get_location(location_manual_state_t *state, float *lat, - float *lon) +location_manual_get_location(location_manual_state_t *state, + location_t *loc) { - *lat = state->lat; - *lon = state->lon; + *loc = state->loc; return 0; } -- cgit v1.2.3-70-g09d2