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
1 changed files with 3 additions and 1 deletions

View File

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