File: test_parse_latlon.c

package info (click to toggle)
viking 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,468 kB
  • sloc: ansic: 81,706; xml: 2,893; sh: 2,501; makefile: 874; python: 589; perl: 384; cpp: 259
file content (30 lines) | stat: -rw-r--r-- 603 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright: CC0
#include <glib.h>
#include <glib/gstdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include "coords.h"
#include "clipboard.h"

int main( int argc, char *argv[] )
{
#if ! GLIB_CHECK_VERSION (2, 36, 0)
  g_type_init();
#endif

  if ( !argv[1] ) {
    g_printerr ( "No text specified\n" );
    return 1;
  }

  struct LatLon coord;
  if ( clip_parse_latlon(argv[1], &coord) ) {
    // Ensure output uses decimal point for decimal separator
    (void)setlocale ( LC_ALL, "C" );
    printf ( "%0.5f %0.5f\n", coord.lat, coord.lon );
  } else
    return 1;

  return 0;
}