summaryrefslogtreecommitdiff
path: root/utils/rhrd-show
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rhrd-show')
-rwxr-xr-xutils/rhrd-show22
1 files changed, 13 insertions, 9 deletions
diff --git a/utils/rhrd-show b/utils/rhrd-show
index 3431450..7cb8422 100755
--- a/utils/rhrd-show
+++ b/utils/rhrd-show
@@ -23,6 +23,7 @@
use strict;
use lib "../lib/";
use RHRD::rddb;
+use RHRD::utils;
# this is ridiculous but makes it a little harder to create/remove users...
# if ($> != 0 ) {
@@ -90,24 +91,27 @@ sub add__check_arguments
return 1;
}
- if($rhythm !~ m/^[01]{4}$/ || $rhythm eq '0000') {
- print STDERR "rhythm '" . $rhythm . "' contains illegal characters or is too long/short\n";
- print STDERR " only 0 or 1 are allowed and, length must be exactly 4 and it must not be '0000'\n";
+ my ($result, $err, $hint) = RHRD::utils::dropbox_param_rhythm_ok($rhythm);
+ unless($result) {
+ print STDERR $err . "\n " . $hint . "\n";
return 1;
}
- if($dow < 1 || $dow > 7) {
- print STDERR "dow '" . $dow . "' is out of range, must be between 1 and 7 (1=Monday, ..., 7=Sunday)\n";
+ ($result, $err, $hint) = RHRD::utils::dropbox_param_dow_ok($dow);
+ unless($result) {
+ print STDERR $err . "\n " . $hint . "\n";
return 1;
}
- if($starttime !~ m/^[0-2][0-9][0-5][0-9]$/ || $starttime > 2359) {
- print STDERR "starttime '" . $starttime . "' is not a valid time must be HHMM\n";
+ ($result, $err, $hint) = RHRD::utils::dropbox_param_starttime_ok($starttime);
+ unless($result) {
+ print STDERR $err . "\n " . $hint . "\n";
return 1;
}
- if($len <= 0) {
- print STDERR "len '" . $len . "' must be > 0\n";
+ ($result, $err, $hint) = RHRD::utils::dropbox_param_len_ok($len);
+ unless($result) {
+ print STDERR $err . "\n " . $hint . "\n";
return 1;
}