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