From 0efee1f5208a3622d47f31fcdede8f15e828a953 Mon Sep 17 00:00:00 2001 From: Edward Emelianov Date: Thu, 24 Mar 2022 12:19:48 +0300 Subject: [PATCH] changes with 'sun' --- Auxiliary_utils/Sun/Readme | 9 --------- Auxiliary_utils/Sun/sun.c | 7 ++++--- 2 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 Auxiliary_utils/Sun/Readme diff --git a/Auxiliary_utils/Sun/Readme b/Auxiliary_utils/Sun/Readme deleted file mode 100644 index 289ec28..0000000 --- a/Auxiliary_utils/Sun/Readme +++ /dev/null @@ -1,9 +0,0 @@ -Calculates times of sunrise, sunset and noon, gives @ stdout just UNIX time of event - -Sunrise/sunset - for particular angle below horizon (default: -18degr). - -Usage: - -- just `noon`, `sunrise` or `sunset` for default angles; -- `sunrise/sunset angle` for `angle` in degrees below horizon; -- `sunrise/sunset "standard"|"civil"|"nautic"|"astro" - calculates event for -0.833degr, -6degr, -12degr and -18degr. diff --git a/Auxiliary_utils/Sun/sun.c b/Auxiliary_utils/Sun/sun.c index f3246db..6d3f1fc 100644 --- a/Auxiliary_utils/Sun/sun.c +++ b/Auxiliary_utils/Sun/sun.c @@ -21,6 +21,7 @@ A simple example showing some solar calculations. */ #include +#include #include #include #include @@ -53,7 +54,7 @@ int main (int argc, char **argv){ } }else if(argc > 2){ fprintf(stderr, "Usage: %s [positive angle in degr] OR %s [\"standard\"|\"civil\"|\"nautic\"|\"astro\"]\n", - argv[0], argv[0]); + program_invocation_short_name, program_invocation_short_name); return 1; } @@ -62,9 +63,9 @@ int main (int argc, char **argv){ JD = ln_get_julian_from_sys(); ln_get_solar_equ_coords (JD, &equ); if(ln_get_solar_rst_horizon(JD, &observer, angle, &rst) == 1) return 1; - if(strcasecmp(basename(argv[0]), "sunrise") == 0) + if(strcasecmp(program_invocation_short_name, "sunrise") == 0) ln_get_timet_from_julian(rst.rise, &t); - else if(strcasecmp(basename(argv[0]), "sunset") == 0) + else if(strcasecmp(program_invocation_short_name, "sunset") == 0) ln_get_timet_from_julian(rst.set, &t); else ln_get_timet_from_julian(rst.transit, &t);