Handle hostnames with upper-case letters
[webmin.git] / nis / save_file.cgi
1 #!/usr/local/bin/perl
2 # save_file.cgi
3 # Save the files of a manually edited NIS table
4
5 require './nis-lib.pl';
6 &ReadParseMime();
7 @tables = &list_nis_tables();
8 $table = $tables[$in{'table'}];
9 $fnum = 0;
10 foreach $f (@{$table->{'files'}}) {
11         $in{"data_$fnum"} =~ s/\r//g;
12         if ($in{"data_$fnum"} =~ /\S/) {
13                 $in{"data_$fnum"} =~ s/\s*$/\n/;
14                 }
15         else {
16                 $in{"data_$fnum"} = "";
17                 }
18         &open_tempfile(FILE, ">$f");
19         &print_tempfile(FILE, $in{"data_$fnum"});
20         &close_tempfile(FILE);
21         $fnum++;
22         }
23 &apply_table_changes() if (!$config{'manual_build'});
24 &redirect("edit_tables.cgi?table=$in{'table'}");
25