#!/usr/local/bin/perl # list_mgetty.cgi # Displays a list of serial ports on which mgetty is enabled by searching # for them in /etc/inittab require './pap-lib.pl'; $access{'mgetty'} || &error($text{'mgetty_ecannot'}); &foreign_require("inittab", "inittab-lib.pl"); &ui_print_header(undef, $text{'mgetty_title'}, ""); if (!&has_command($config{'mgetty'})) { print "

",&text('mgetty_ecmd', "$config{'mgetty'}"),"

\n"; &ui_print_footer("", $text{'index_return'}); exit; } print &text('mgetty_desc', "mgetty"),"

\n"; @mgi = &mgetty_inittabs(); if (@mgi) { print "$text{'mgetty_add'}
\n"; print "\n"; print " ", " ", " ", " ", "\n"; foreach $m (@mgi) { print "\n"; local $tty = $m->{'tty'} =~ /^ttyS(\d+)$/ ? &text('mgetty_ts', $1+1) : $m->{'tty'} =~ /^term\/(\S+)$/ ? &text('mgetty_ts', uc($1)) : $m->{'tty'} =~ /^\// ? $m->{'tty'} : "/dev/$m->{'tty'}"; if ($m->{'mgetty'}) { print "\n"; print "\n"; print "\n"; print "\n"; local $fn = $m->{'tty'}; $fn =~ s/^\/dev\///; $fn =~ s/\//\./g; if ($access{'options'}) { print "\n"; } else { print "\n"; } } else { print "\n"; print "\n"; } print "\n"; } print "
$text{'mgetty_tty'}$text{'mgetty_type'}$text{'mgetty_speed'}$text{'mgetty_answer'}$text{'mgetty_config'}
", "$tty",$m->{'direct'} ? $text{'mgetty_direct'} : $text{'mgetty_modem'},"",$m->{'speed'} || $text{'mgetty_auto'},"",defined($m->{'rings'}) ? $m->{'rings'} : 1," $text{'mgetty_rings'}", "$text{'mgetty_cedit'}
$tty$text{'mgetty_vgetty'}
\n"; } else { print "$text{'mgetty_none'}

\n"; } print "$text{'mgetty_add'}

\n"; print &ui_hr(); print "

\n"; print "\n"; print "\n"; print "\n"; print "
",&text('mgetty_applydesc', "telinit q"),"
\n"; &ui_print_footer("", $text{'index_return'});