return $_[0] =~ /^[A-Za-z0-9\.\-]+$/ ? undef : &text('plib_invaliddom', $_[0]);
}
-# display_options(&config)
-# Display a table of DHCP options
-sub display_options
-{
-print "<table border width=100%>\n";
-print "<tr $tb> <td><b>$text{'plib_copt'}</b></td> </tr>\n";
-print "<tr $cb> <td><table width=100%>\n";
-local @opts = &find("option", $_[0]);
-
-print "<tr>\n";
-print &p_option_input($text{'plib_chname'}, "host-name", \@opts, 3);
-print &p_option_input($text{'plib_defrouters'}, "routers", \@opts, 2);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_snmask'}, "subnet-mask", \@opts, 0);
-print &p_option_input($text{'plib_babbr'}, "broadcast-address", \@opts, 0);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_domname'}, "domain-name", \@opts, 3);
-print &p_option_input($text{'plib_dnsserv'}, "domain-name-servers", \@opts, 2);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_timeserv'}, "time-servers", \@opts, 2);
-print &p_option_input($text{'plib_logserv'}, "log-servers", \@opts, 2);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_swapserv'}, "swap-server", \@opts, 3);
-print &p_option_input($text{'plib_rdpath'}, "root-path", \@opts, 3);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_nisdom'}, "nis-domain", \@opts, 3);
-print &p_option_input($text{'plib_nisserv'}, "nis-servers", \@opts, 2);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_fontserv'}, "font-servers", \@opts, 2);
-print &p_option_input($text{'plib_xdmserv'}, "x-display-manager", \@opts, 2);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_statrouters'}, "static-routes", \@opts, 5);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_ntpserv'}, "ntp-servers", \@opts, 2);
-print &p_option_input($text{'plib_nbns'}, "netbios-name-servers", \@opts, 2);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_nbscope'}, "netbios-scope", \@opts, 3);
-print &p_option_input($text{'plib_nbntype'}, "netbios-node-type", \@opts, 1);
-print "</tr>\n";
-
-print "<tr>\n";
-print &p_option_input($text{'plib_toffset'}, "time-offset", \@opts, 1);
-print "</tr>\n";
-
-print "</table></td></tr></table>\n";
-}
-
-# p_option_input(text, name, &config, type)
-# types values: 0 - IP address
-# 1 - Integer
-# 2 - IP address list
-# 3 - String
-# 4 - Yes/no flag
-# 5 - IP address pairs
-sub p_option_input
-{
-local($rv, $v, $i);
-for($i=0; $i<@{$_[2]}; $i++) {
- if ($_[2]->[$i]->{'values'}->[0] eq $_[1]) {
- $v = $_[2]->[$i];
- last;
- }
- }
-$rv = "<td><b>$_[0]</b></td>\n";
-if ($_[3] == 5) { $rv .= "<td colspan=3>"; }
-else { $rv .= "<td>"; }
-$rv .= sprintf "<input type=radio name=$_[1]_def value=1 %s> $text{'default'}\n",
- $v ? "" : "checked";
-$rv .= sprintf "<input type=radio name=$_[1]_def value=0 %s> ",
- $v ? "checked" : "";
-local @vl = $v ? @{$v->{'values'}} : ();
-@vl = @vl[1..$#vl];
-if ($_[3] == 0) {
- $rv .= "<input name=$_[0] size=15 value=\"$vl[0]\">\n";
- }
-elsif ($_[3] == 1) {
- $rv .= "<input name=$_[0] size=8 value=\"$vl[0]\">\n";
- }
-elsif ($_[3] == 2) {
- @vl = grep { $_ ne "," } @vl;
- $rv .= "<input name=$_[0] size=25 value=\"".join(" ", @vl)."\">\n";
- }
-elsif ($_[3] == 3) {
- local $str = $vl[0] =~ /^[0-9\:]+$/ ? &nvt_to_string($vl[0]) : $vl[0];
- $rv .= "<input name=$_[0] size=20 value=\"$str\">\n";
- }
-elsif ($_[3] == 4) {
- $rv .= sprintf "<input name=$_[0] value=1 %s> $text{'yes'}\n",
- $vl[0] eq "1" ? "checked" : "";
- $rv .= sprintf "<input name=$_[0] value=0 %s> $text{'no'}\n",
- $vl[0] eq "0" ? "checked" : "";
- }
-elsif ($_[3] == 5) {
- @vl = grep { $_ ne "," } @vl;
- $rv .= "<input name=$_[0] size=50 value=\"";
- for($i=0; $i<@vl; $i+=2) {
- $rv .= $vl[$i]."-".$vl[$i+1];
- }
- $rv .= "\">\n";
- }
-$rv .= "</td>\n";
-return $rv;
-}
-
1;