From 832e77c7547efe6605acbc5f0d7ea4cb1a0799e9 Mon Sep 17 00:00:00 2001
From: Jorge Pereira
Date: Thu, 11 Jun 2020 13:44:14 -0300
Subject: [PATCH] Let the user know about their error
If the user informed wrong value, then let them know about that.
---
htop.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/htop.c b/htop.c
index 8c88c782a..d64755360 100644
--- a/htop.c
+++ b/htop.c
@@ -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':