commit e9784c4196d4822c686edc7093cd6a486ba4c0d2
parent c6bbfcce1014f8d1430ac95b65222d588c0f252c
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Fri, 5 Jun 2026 18:34:11 +0200
Fix scem app argument parsing
The last 2 args cannot be options (they are lat and long).
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/scem_main.c b/src/scem_main.c
@@ -124,7 +124,8 @@ args_init(struct args* args, int argc, char** argv)
if((res = get_current_date(&args->time)) != RES_OK) goto error;
- while((opt = getopt(argc, argv, "a:d:hvr")) != -1) {
+ /* Don't process the last 2 args as options, they are lat and long */
+ while((opt = getopt(argc - 2, argv, "a:d:hvr")) != -1) {
switch(opt) {
case 'a': res = parse_algo(optarg, &args->algo); break;
case 'd': res = parse_date(optarg, &args->time); break;