summaryrefslogtreecommitdiff
path: root/gridcal.c
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2022-10-06 11:38:17 +0100
committerKatolaZ <katolaz@freaknet.org>2022-10-06 11:38:17 +0100
commit304656477bb4f6c68b5a24a5cd8bbb49d1403cdf (patch)
treeea62c5c4bd566bdc69012c7fa99b810ccf3d62c8 /gridcal.c
parent2e07eff6639fc134305a3f460402182b696f4c04 (diff)
add more comments in README.md
Diffstat (limited to 'gridcal.c')
-rw-r--r--gridcal.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gridcal.c b/gridcal.c
index 97e8cf9..6e552b4 100644
--- a/gridcal.c
+++ b/gridcal.c
@@ -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);
}