3 # Display the mgetty configuration for some serial port
5 require './pap-lib.pl';
6 $access{'mgetty'} || &error($text{'mgetty_ecannot'});
8 &foreign_require("inittab", "inittab-lib.pl");
11 &ui_print_header(undef, $text{'mgetty_create'}, "");
14 &ui_print_header(undef, $text{'mgetty_edit'}, "");
15 @mgi = &mgetty_inittabs();
16 ($init) = grep { $_->{'id'} eq $in{'id'} } @mgi;
19 print "<form action=save_mgetty.cgi>\n";
20 print "<input type=hidden name=new value='$in{'new'}'>\n";
21 print "<input type=hidden name=id value='$in{'id'}'>\n";
23 print "<table border width=100%>\n";
24 print "<tr $tb> <td><b>$text{'mgetty_header'}</b></td> </tr>\n";
25 print "<tr $cb> <td><table width=100%>\n";
27 print "<tr> <td><b>$text{'mgetty_tty'}</b></td>\n";
28 print "<td><select name=tty>\n";
29 $found++ if ($in{'new'});
30 foreach $t (sort { "$a$b" =~ /^\/dev\/ttyS(\d+)\/dev\/ttyS(\d+)$/ ? $1 <=> $2 : 0 }
31 glob($config{'serials'})) {
33 local $f = $init->{'tty'} eq $t || $init->{'tty'} eq "/dev/$t";
34 printf "<option value=%s %s>%s\n",
35 $t, $f ? "selected" : "",
36 $t =~ /^ttyS(\d+)$/ ? &text('mgetty_ts', $1+1) :
37 $t =~ /^term\/(\S+)$/ ? &text('mgetty_ts', uc($1)) : "/dev/$t";
40 printf "<option value='' %s>%s\n",
41 $found ? "" : "selected", $text{'mgetty_other'};
43 printf "<input name=other size=20 value='%s'> %s</td>\n",
44 $found ? "" : $init->{'tty'}, &file_chooser_button("other");
46 print "<td><b>$text{'mgetty_type'}</b></td>\n";
47 printf "<td><input name=direct type=radio value=1 %s> %s\n",
48 $init->{'direct'} ? "checked" : "", $text{'mgetty_direct'};
49 printf "<input name=direct type=radio value=0 %s> %s</td> </tr>\n",
50 $init->{'direct'} ? "" : "checked", $text{'mgetty_modem'};
52 print "<tr> <td><b>$text{'mgetty_speed'}</b></td>\n";
53 printf "<td><input type=radio name=speed_def value=1 %s> %s\n",
54 $init->{'speed'} ? "" : "checked", $text{'mgetty_auto'};
55 printf "<input type=radio name=speed_def value=0 %s>\n",
56 $init->{'speed'} ? "checked" : "";
57 printf "<input name=speed size=8 value='%s'> %s</td>\n",
58 $init->{'speed'}, $text{'mgetty_baud'};
60 print "<td><b>$text{'mgetty_answer'}</b></td>\n";
61 printf "<td><input name=rings size=4 value='%s'> %s</td> </tr>\n",
62 defined($init->{'rings'}) ? $init->{'rings'} : 1, $text{'mgetty_rings'};
64 print "<tr> <td><b>$text{'mgetty_mode'}</b></td>\n";
65 printf "<td><input type=radio name=mode value=0 %s> %s\n",
66 $init->{'data'} || $init->{'fax'} ? "" : "checked", $text{'mgetty_df'};
67 printf "<input type=radio name=mode value=1 %s> %s\n",
68 $init->{'data'} ? "checked" : "", $text{'mgetty_d'};
69 printf "<input type=radio name=mode value=2 %s> %s</td>\n",
70 $init->{'fax'} ? "checked" : "", $text{'mgetty_f'};
72 print "<td><b>$text{'mgetty_back'}</b></td>\n";
73 printf "<td><input type=radio name=back_def value=1 %s> %s\n",
74 $init->{'back'} ? "" : "checked", $text{'mgetty_back_def'};
75 printf "<input type=radio name=back_def value=0 %s>\n",
76 $init->{'back'} ? "checked" : "";
77 printf "<input name=back size=4 value='%s'> %s</td> </tr>\n",
78 $init->{'back'}, $text{'mgetty_secs'};
80 print "<tr> <td><b>$text{'mgetty_prompt'}</b></td>\n";
81 printf "<td colspan=3><input type=radio name=prompt_def value=1 %s> %s\n",
82 $init->{'prompt'} ? "" : "checked", $text{'default'};
83 printf "<input type=radio name=prompt_def value=0 %s>\n",
84 $init->{'prompt'} ? "checked" : "";
85 printf "<input name=prompt size=50 value='%s'></td> </tr>\n",
88 print "</table></td></tr></table>\n";
89 print "<table width=100%><tr>\n";
91 print "<td><input type=submit value='$text{'create'}'></td>\n";
94 print "<td><input type=submit value='$text{'save'}'></td>\n";
95 print "<td align=right><input type=submit name=delete ",
96 "value='$text{'delete'}'></td>\n";
98 print "</table></form>\n";
100 &ui_print_footer("list_mgetty.cgi", $text{'mgetty_return'});