diff options
Diffstat (limited to 'gridcal.c')
-rw-r--r-- | gridcal.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -15,8 +15,16 @@ #include <ctype.h> #define MIN(a,b) ((a)>(b)?(b):(a)) +#define R 6371 -double R = 6371; +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif + + +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#endif typedef struct { double lat; @@ -26,7 +34,7 @@ typedef struct { void usage(char *argv0){ - printf("Usage: %s <grid1> <grid2> [<pwr>]", argv0); + printf("Usage: %s <loc1> [<loc2> [<pwr>]]", argv0); exit(1); } @@ -117,7 +125,7 @@ int main(int argc, char *argv[]){ loc1[n1] = '\0'; check_input(loc1); grid_to_latlon(loc1, &c1); - printf("%s %g %g\n", loc1, c1.lat, c1.lon); + printf("%s %g %g %g %g\n", loc1, c1.lat*180/M_PI, c1.lon*180/M_PI, c1.lat, c1.lon); exit(0); } |