3 # Create, update or delete a host
5 require './nis-lib.pl';
8 ($t, $lnums, $host) = &table_edit_setup($in{'table'}, $in{'line'}, '\s+');
10 # Just delete the host
11 &table_delete($t, $lnums);
14 # Validate inputs and save the host
15 &error_setup($text{'hosts_err'});
16 &check_ipaddress($in{'ip'}) || &error($text{'hosts_eip'});
17 $in{'name'} =~ /^[A-Za-z0-9\.\-]+$/ || &error($text{'hosts_ename'});
18 @host = ( $in{'ip'}, $in{'name'}, split(/\s+/, $in{'aliases'}) );
19 if ($in{'line'} eq '') {
20 &table_add($t, "\t", \@host);
23 &table_update($t, $lnums, "\t", \@host);
26 &apply_table_changes() if (!$config{'manual_build'});
27 &redirect("edit_tables.cgi?table=$in{'table'}");