-
Notifications
You must be signed in to change notification settings - Fork 1
/
mkspectable
executable file
·51 lines (41 loc) · 1.2 KB
/
mkspectable
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/perl
use CGI;
use Carp;
use Mysql;
use Env qw(LSBUSER LSBDBPASSWD LSBDB LSBDBHOST);
$query = new CGI(%ARGV);
$Dbh = Mysql->connect($LSBDBHOST,$LSBDB,$LSBUSER, $LSBDBPASSWD) || die $Mysql::db_errstr;
$select ="SELECT DISTINCT Interface.Iname ";
$select .="FROM Standard,Interface,StandInt";
if ( $query->param('Sname') ) {
push(@where,"Standard.Sname=".$Dbh->quote($query->param('Sname')));
push(@where,"Standard.Sid=StandInt.SIstand");
push(@where,"Interface.Iid=StandInt.SIint");
}
push(@where,"Interface.Iname NOT LIKE '\\_\\_%'");
if( scalar(@where) > 0 ) {
$select .= " WHERE ".join(" AND ",@where);
}
$select .=" ORDER BY Interface.Iname ";
#printf $select,"\n";
$sth = $Dbh->query($select) || die $select."\n".$Dbh->errmsg();
for(1..$sth->numrows) {
%entry=$sth->fetchhash;
$entry[$_]=$entry{'Iname'};
}
print "<html>\n";
print "<body>\n";
print "<table>\n";
$inc=($sth->numrows+4)/5;
for(1..$inc) {
print "<tr>";
printf "<td>%s</td>",$entry[$_];
printf "<td>%s</td>",$entry[$_+$inc];
printf "<td>%s</td>",$entry[$_+(2*$inc)];
printf "<td>%s</td>",$entry[$_+(3*$inc)];
printf "<td>%s</td>",$entry[$_+(4*$inc)];
print "</tr>\n";
}
print "</table>\n";
print "</body>\n";
print "</html>\n";