Ensure -t argument is positive integer.

Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
This commit is contained in:
Nicolás A. Ortega Froysa 2024-02-24 14:02:19 +01:00
parent a728570c89
commit 9a0a4e03d0

View File

@ -68,6 +68,9 @@ if ($opts{'v'}) {
print("Improper usage. -r and -i cannot be used at the same time.\n"); print("Improper usage. -r and -i cannot be used at the same time.\n");
print("Use -h for help information.\n"); print("Use -h for help information.\n");
exit 1; exit 1;
} elsif ($opts{'t'} && !($opts{'t'} =~ /[0-9]+/)) {
print("The argument for -t must be a positive integer.\n");
exit 1;
} }
$r_flag = 1 if ($opts{'r'}); $r_flag = 1 if ($opts{'r'});