allow for dynamic detection of error-marked values during error printouts

This commit is contained in:
ІО-23 Шмуляр Олег 2024-09-27 11:05:41 +03:00
parent be39097f63
commit a2601eb15e
1 changed files with 10 additions and 6 deletions

View File

@ -139,11 +139,17 @@ print_error_message(char** argv,
{
puts("[Error] Incorrect CLI argument input.");
if (error_code & 0x1)
print_argument_error(argv, argc, 1);
int current_argument_position = 1;
int temp_error_code = error_code;
if (error_code & 0x2)
print_argument_error(argv, argc, 2);
while (temp_error_code)
{
if (temp_error_code & 0x1)
print_argument_error(argv, argc, current_argument_position);
temp_error_code >>= 1;
current_argument_position++;
}
}
int
@ -176,5 +182,3 @@ main(int argc,
return 0;
}