diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-09-30 15:07:41 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-09-30 15:07:41 (GMT) |
commit | 5897b1bc3b059a29f57bde6c08344deceb41bd23 (patch) | |
tree | f2ca2ba16403ac0d65286fc1b5e3d9783440b32b /utils/rd-show | |
parent | efb5d6557591ef21c27aa46aae220d862c36feeb (diff) |
major cleanup for all utils
Diffstat (limited to 'utils/rd-show')
-rwxr-xr-x | utils/rd-show | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/utils/rd-show b/utils/rd-show index d2e69c4..ff5a169 100755 --- a/utils/rd-show +++ b/utils/rd-show @@ -37,7 +37,7 @@ sub print_usage " rd-show add <shortname> <title> <num-carts> <rhythm> <dow> <starttime> <len>\n"; } -sub list_shows +sub list { my ($dbh) = @_; @@ -52,7 +52,7 @@ sub list_shows return 0; } -sub show_show +sub show { my ($dbh, $show_id) = @_; @@ -73,7 +73,7 @@ sub show_show return 0; } -sub add_show +sub add { my ($dbh, $shortname, $title, $numcarts, $rhythm, $dow, $starttime, $len) = @_; @@ -81,7 +81,7 @@ sub add_show return 0; } -sub remove_show +sub remove { my ($dbh, $show_id) = @_; @@ -102,40 +102,43 @@ if(defined $dbh) { if($cmd eq "list") { if($num_args != 1) { print_usage(); - exit(1); + $ret = 1; + } else { + $ret = list($dbh) } - $ret = list_shows($dbh) } elsif($cmd eq "show") { if($num_args != 2) { print_usage(); - exit(1); + $ret = 1; + } else { + $ret = show($dbh, $ARGV[1]) } - $ret = show_show($dbh, $ARGV[1]) } elsif($cmd eq "remove") { if($num_args != 2) { print_usage(); - exit(1); + $ret = 1; + } else { + $ret = remove($dbh, $ARGV[1]); } - $ret = remove_show($dbh, $ARGV[1]); } elsif($cmd eq "add") { if($num_args != 8) { print_usage(); - exit(1); + $ret = 1; + } else { + $ret = add($dbh, $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5], $ARGV[6], $ARGV[7]); } - $ret = add_show($dbh, $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5], $ARGV[6], $ARGV[7]); } else { print_usage(); - RHRD::rddb::closedb($dbh); - exit 1; + $ret = 1; } RHRD::rddb::closedb($dbh); } else { print STDERR "$errorstring\n"; - exit 1; + $ret = 1; } exit $ret; |