my $reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="propget"><PROPLIST><PROP NAME="'.$property.'"/></PROPLIST></REQ></RMCSEQ>';
my $resp = _req($reqstr);
+
+ print "get: ${property}\n" if ($verbose);
if ($resp->{RESP}->{RC} ne '0x0') {
$resp->{RESP}->{RC};
if ($res->{RESP}->{RC} ne '0x0') {
print "Error setting ${property} to ${value}: ".$res->{RESP}->{RC}."\n";
} else {
- print "${property}: ${oldval} -> ${value}\n" if ($verbose);
+ print "${property}: ${oldval} -> ${value}\n";
}
}
}
}
-if (!defined(${$Config{$hostalias}}{'host'})) {
+if ($valid_arg && (!defined(${$Config{$hostalias}}{'host'}))) {
$valid_arg = 0;
}
}
if ($save ne '') {
- print "save: implement me!\n";
+ my @dontsave = qw(ENABLE_LAN_AUTONEG ENABLE_LAN_100 ENABLE_LAN_FDUPLEX GATEWAY
+ IP_ADDRESS NETMASK TFTP_FIRMWARE_FILE TFTP_ADDR_FIRMWARE ENABLE_DHCP);
+
+ open (SAVEFILE, ">${save}") || die "Error opening save-file: $!\n";
+ foreach my $ts (@fw_vars) {
+ next if (grep(/^${ts}$/, @dontsave));
+
+ my $phash = _getprop($ts)->{RESP}->{PROPLIST}->{PROP};
+ next if ($phash->{PERMS} ne 'RW');
+
+ print SAVEFILE "${ts}=".$phash->{VAL}."\n";
+ }
+ close(SAVEFILE);
}
if ($load ne '') {
- print "load: implement me!\n";
+ open (LOADFILE, "<${load}") || die "Error opening load-file: $!\n";
+ while(<LOADFILE>) {
+ chomp;
+ (my $p, my $v) = split(/=/, $_);
+ setprop($p, $v);
+ }
+ close(LOADFILE);
}
if ($enable_debug ne '') {