Let the user know about their error

If the user informed wrong value, then let them know about that.
This commit is contained in:
Jorge Pereira 2020-06-11 13:44:14 -03:00
parent 402e46bb82
commit 832e77c754
No known key found for this signature in database
GPG Key ID: 3506FEC2EECDAA6D
1 changed files with 3 additions and 0 deletions

3
htop.c
View File

@ -112,6 +112,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
flags.sortKey = ColumnsPanel_fieldNameToIndex(optarg);
if (flags.sortKey == -1) {
fprintf(stderr, "Error: invalid column \"%s\".\n", optarg);
exit(1);
}
break;
case 'd':
@ -120,11 +121,13 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
if (flags.delay > 100) flags.delay = 100;
} else {
fprintf(stderr, "Error: invalid delay value \"%s\".\n", optarg);
exit(1);
}
break;
case 'u':
if (!Action_setUserOnly(optarg, &(flags.userId))) {
fprintf(stderr, "Error: invalid user \"%s\".\n", optarg);
exit(1);
}
break;
case 'C':