-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmkintlist
More file actions
executable file
·151 lines (133 loc) · 4.29 KB
/
Copy pathmkintlist
File metadata and controls
executable file
·151 lines (133 loc) · 4.29 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/perl
use Getopt::Long;
use DBI;
use Env qw(LSBUSER LSBDBPASSWD LSBDB LSBDBHOST);
sub usage()
{
print STDERR "mkintlist -a <archname> -v <lsbversion>\n";
die;
}
# Uncomment to trace SQL statments
#$trace=1;
#
# 1) process the arguments
#
GetOptions("a=s" => \$archname,
"v=s" => \$lsbversion);
if( !$archname ) { usage(); }
if( !$lsbversion ) { usage(); }
#
# 2) Establish connection to the database
#
$dbh = DBI->connect('DBI:mysql:database='.$LSBDB.';host='.$LSBDBHOST, $LSBUSER, $LSBDBPASSWD)
or die "Couldn't connect to database: ".DBI->errstr;
#
# 3) get & print the architecture info
#
$select = "SELECT * FROM Architecture WHERE ";
$select.= "Architecture.Aname=".$dbh->quote($archname);
print STDERR $select,"\n" if $trace;
$sth = $dbh->prepare($select) or die "Couldn't prepare $select query: ".DBI->errstr;
$sth->execute or die "Couldn't execute $select query: ".DBI->errstr;
$entry=$sth->fetchrow_hashref;
$Aid=$entry->{'Aid'};
$Aname=$entry->{'Aname'};
$sth->finish;
#print "<APPENDIX ID=app-A>\n";
#print "<TITLE>Alphabetical Listing of Interfaces</TITLE>\n";
#print "<PARA>\n";
#print "</PARA>\n";
#
# 4) get & print the library info
#
$select = "SELECT * FROM Library LEFT JOIN ArchLib ON ALlid=Lid WHERE ";
$select.= "(ALappearedin <= '$lsbversion' AND ALappearedin >'' ";
$select.= "AND (ALwithdrawnin IS NULL OR ALwithdrawnin > '$lsbversion') ) ";
$select.= "AND ALaid=$Aid ";
print STDERR $select,"\n" if $trace;
$lth = $dbh->prepare($select) or die "Couldn't prepare $select query: ".DBI->errstr;
$lth->execute or die "Couldn't execute $select query: ".DBI->errstr;
for(1..$lth->rows) {
$entry=$lth->fetchrow_hashref;
$Lid=$entry->{'Lid'};
$Lname=$entry->{'Lname'};
$select = "SELECT Iname,AIdeprecatedsince,Vname ";
$select.= "FROM Interface ";
$select.= "LEFT JOIN LGInt ON LGIint=Iid ";
$select.= "LEFT JOIN LibGroup ON LGIlibg=LGid ";
$select.= "LEFT JOIN ArchInt ON Iid=AIint ";
$select.= "LEFT JOIN Version ON Vid=AIversion ";
$select.= "WHERE LGlib=$Lid AND Itype='Function' ";
$select.= "AND AIarch=$Aid ";
$select.= "AND (AIappearedin <= '$lsbversion' and AIappearedin > '') ";
$select.= "AND (AIwithdrawnin IS NULL OR AIwithdrawnin >'$lsbversion') ";
# Include only arch specific interfaces
if( $Aid!=1 ) {
$select.= "AND Iid NOT IN ";
$select.= "(SELECT AIint FROM ArchInt ";
$select.= " WHERE AIarch=1 ";
$select.= "AND (AIappearedin <= '$lsbversion' and AIappearedin > '') ";
$select.= "AND (AIwithdrawnin IS NULL OR AIwithdrawnin >'$lsbversion') )";
}
$select.= "ORDER BY Iname";
$inh = $dbh->prepare($select) or die "Couldn't prepare $select query: ".DBI->errstr;
$inh->execute or die "Couldn't execute $select query: ".DBI->errstr;
if( $inh->rows == 0) {
$inh->finish;
next;
}
print "$Lname Function Interfaces\n";
#
# 7) Get a list of the interfaces in the library
#
{
local(*std);
local(*symver);
local(*entry);
print STDERR $select,"\n" if $trace;
for(1..$inh->rows) {
$entry=$inh->fetchrow_hashref;
print $entry->{'Iname'}."(".$entry->{'Vname'}.")";
if( $entry->{'AIdeprecatedsince'} and $entry->{'AIdeprecatedsince'} le $lsbversion ) {
print " *Deprecated*";
}
print "\n";
}
}
$inh->finish;
#
# 8) Make a table of data interfaces
#
{
local(*datasym);
local(*std);
$select = "SELECT * FROM Interface ";
$select.= "LEFT JOIN LGInt ON Iid=LGIint ";
$select.= "LEFT JOIN LibGroup ON LGIlibg=LGid ";
$select.= "LEFT JOIN ArchInt ON Iid=AIint ";
$select.= "WHERE Itype='Data' AND LGlib=$Lid AND AIarch=$Aid ";
$select.= "AND (AIappearedin <= '$lsbversion' and AIappearedin<>'') ";
$select.= "AND (AIwithdrawnin IS NULL OR AIwithdrawnin >'$lsbversion') ";
if( $Aid!=1 ) {
$select.= "AND Iid NOT IN ";
$select.= "(SELECT AIint FROM ArchInt ";
$select.= " WHERE AIarch=1 ";
$select.= "AND (AIappearedin <= '$lsbversion' and AIappearedin<>'') ";
$select.= "AND (AIwithdrawnin IS NULL OR AIwithdrawnin >'$lsbversion') ) ";
}
$select.= "ORDER BY Iname";
print STDERR $select,"\n" if $trace;
$sth = $dbh->prepare($select) or die "Couldn't prepare $select query: ".DBI->errstr;
$sth->execute or die "Couldn't execute $select query: ".DBI->errstr;
if ($sth->rows > 0 ) {
print "$Lname Data Interfaces\n";
for(1..$sth->rows) {
$datasym=$sth->fetchrow_hashref;
print $datasym->{'Iname'}."(".$datasym->{'Vname'}.")\n";
}
}
$sth->finish;
}
}
$lth->finish;
$dbh->disconnect;