From 75085d94afa9ad53ae3ac294af7119712b4789e7 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Thu, 5 Feb 2009 00:08:31 +0100 Subject: [PATCH] CLI cleanups --- rsbs2.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/rsbs2.pl b/rsbs2.pl index 0843330..2d7ec2a 100755 --- a/rsbs2.pl +++ b/rsbs2.pl @@ -196,8 +196,10 @@ sub setprop { if ($res->{RESP}->{RC} ne '0x0') { print "Error setting ${property} to ${value}: ".$res->{RESP}->{RC}."\n"; + undef; } else { - print "${property}: ${oldval} -> ${value}\n"; + print "${property}: ${oldval} -> ${value}\n" if ($verbose); + $oldval; } } @@ -480,7 +482,10 @@ if (@gprop) { if (@sprop) { foreach my $p (@sprop) { (my $pr, $v) = split(/=/,$p,2); - setprop($pr, $v); + my $oldval = setprop($pr, $v); + if (defined($oldval)) { + print "${pr}: ${oldval} -> ${v}\n" if (!$verbose); + } } } @@ -496,6 +501,7 @@ if ($save ne '') { LAST_IP_ADDRESS LAST_NETMASK); open (SAVEFILE, ">${save}") || die "Error opening save-file: $!\n"; + print STDERR "saving" if (!$verbose); foreach my $ts (@fw_vars) { next if (grep(/^${ts}$/, @dontsave)); @@ -503,18 +509,23 @@ if ($save ne '') { next if ($phash->{PERMS} ne 'RW'); print SAVEFILE "${ts}=".$phash->{VAL}."\n"; + print STDERR "." if (!$verbose); } close(SAVEFILE); + print STDERR "done\n" if (!$verbose); } if ($load ne '') { open (LOADFILE, "<${load}") || die "Error opening load-file: $!\n"; + print STDERR "loading" if (!$verbose); while() { chomp; (my $p, my $v) = split(/=/, $_); setprop($p, $v); + print STDERR "." if (!$verbose); } close(LOADFILE); + print STDERR "done\n" if (!$verbose); print "Settings loaded, resetting board...\n"; my $reqstr=''; _req($reqstr); -- 2.39.2