Return 99 if an unknown flag occured. Also updated price_to_wattspersecond to price_kwh_to_wattspersecond.

This commit is contained in:
Alexander Andreev 2023-09-17 23:48:13 +04:00
parent cd84aee61f
commit 18a593e800
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -33,10 +33,12 @@ int parse_arguments(const int argc, const char *const *const argv,
return 1; return 1;
else if (argv[i][1] == 'v' || argv[i][2] == 'v') else if (argv[i][1] == 'v' || argv[i][2] == 'v')
return 2; return 2;
else
return 99;
} else if (argc < 4) { } else if (argc < 4) {
return 1; return 1;
} else if (pos == 0) { } else if (pos == 0) {
*price = price_to_wattspersecond((price_t)atof(argv[i])); *price = price_kwh_to_wattspersecond((price_t)atof(argv[i]));
++pos; ++pos;
} else if (pos == 1) { } else if (pos == 1) {
*wattage = (wattage_t)atof(argv[2]); *wattage = (wattage_t)atof(argv[2]);