39#define LL_TOLERANCE 10
41static int scan_ll(
const char *,
const char *,
double *,
int);
42static int check_minutes(
const char *);
43static int check_seconds(
const char *);
60 return scan_ll(
tbuf,
"we", res, 0);
64static int scan_ll(
const char *buf,
const char *dir,
double *result,
int max)
77 if (
sscanf(buf,
"%d:%d:%d.%[0123456789]%[^\n]", &d, &
m, &s,
ps, h) == 5) {
81 p += (*
pps -
'0') * f;
85 else if (
sscanf(buf,
"%d:%d:%d%[^\n]", &d, &
m, &s, h) == 4) {
88 else if (
sscanf(buf,
"%d:%d.%[0123456789]%[^\n]", &d, &
m,
ps, h) == 4) {
93 pm += (*
pps -
'0') * f;
97 else if (
sscanf(buf,
"%d:%d%[^\n]", &d, &
m, h) == 3) {
101 else if (
sscanf(buf,
"%d%[^\n]", &d, h) == 2) {
118 if (d ==
max && (
m > 0 || s > 0 || p > 0.0))
122 if (
m && !check_minutes(buf))
124 if (s && !check_seconds(buf))
127 *result = d + (
m +
pm) / 60.0 + (s + p) / 3600.0;
131 if (*result == 0.0 && *h ==
MARKER)
134 if (*h >=
'A' && *h <=
'Z')
137 if (*h != dir[0] && *h != dir[1])
143 if (*h == dir[0] && *result != 0.0)
144 *result = -(*result);
149static int check_minutes(
const char *buf)
158 if (*buf <
'0' || *buf >
'9')
161 if (*buf <
'0' || *buf >
'9')
164 return (*buf <
'0' || *buf >
'9');
167static int check_seconds(
const char *buf)
181 if (*buf <
'0' || *buf >
'9')
184 if (*buf <
'0' || *buf >
'9')
187 return (*buf <
'0' || *buf >
'9');
void G_strip(char *)
Removes all leading and trailing white space from string.
int G_lat_scan(const char *buf, double *lat)
int G_lon_scan(const char *buf, double *lon)
int G_llres_scan(const char *buf, double *res)