320 lines
8.4 KiB
Perl
Executable File
320 lines
8.4 KiB
Perl
Executable File
#!/usr/sbin/perl
|
|
|
|
# /usr/sbin/perl
|
|
# - man page links should be local, not to reality.sgi.com
|
|
# - alphabetize classes in method output
|
|
|
|
# ----------------------------------------------------
|
|
# VARIABLES
|
|
|
|
$docroot = "\/performer";
|
|
$maindocroot = "\/var\/www\/htdocs";
|
|
$absdocroot = "$maindocroot$docroot";
|
|
$dbsdir = "$absdocroot\/dbs";
|
|
$abssrcdir = "$absdocroot\/src";
|
|
|
|
$cgiroot = "\/cgi-bin";
|
|
$fullcgiroot = "/var/www$cgiroot";
|
|
$includedir = "$docroot/include";
|
|
# ----------------------------------------------------
|
|
&start_page();
|
|
&get_args();
|
|
|
|
if ($TYPE eq "CLASS") {
|
|
&make_class_page($NAME);
|
|
} elsif ($TYPE eq "METHOD") {
|
|
&make_meth_page($NAME);
|
|
} elsif ($TYPE eq "$TOKEN") {
|
|
&make_token_page($NAME);
|
|
}
|
|
|
|
&end_page();
|
|
|
|
sub start_page {
|
|
print "Content-type: text/html\n\n"; # Required for HTTP/1.0 compat.
|
|
print "<HTML>\n<HEAD>\n";
|
|
print "<TITLE>Library Search</TITLE>";
|
|
print "</HEAD>\n";
|
|
print "<BODY BGCOLOR=\"f2f5bd\">\n";
|
|
print "<TABLE><TR><TD WIDTH=\"30\"></TD><TD WIDTH=\"500\">";
|
|
}
|
|
|
|
sub end_page {
|
|
print "</TD></TR></TABLE>";
|
|
print "</BODY>\n</HTML>\n";
|
|
}
|
|
|
|
|
|
sub get_args {
|
|
|
|
#print "<P>ARGV is \"@ARGV\" \n";
|
|
$CGI_ARG=$ARGV[0];
|
|
#$LANG = "$ARGV[1]";
|
|
|
|
# print "<P>ARGV1 is \"$LANG\"\n";
|
|
@ARGLIST = split(/,/, $CGI_ARG);
|
|
|
|
$TYPE = $ARGLIST[0];
|
|
$NAME = $ARGLIST[1];
|
|
$NAME =~ s/-(\d+)/pack("C", "$1")/eg;
|
|
if ($ARGLIST[2] eq "A"||"B"||"C") {
|
|
$LANG = $ARGLIST[2];
|
|
}
|
|
|
|
if ($ARGLIST[4] eq "LANG") {
|
|
$LANG = $ARGLIST[5];
|
|
}
|
|
|
|
if ($ARGLIST[2] eq "LANG") {
|
|
$LANG = $ARGLIST[3];
|
|
}
|
|
|
|
|
|
# This get classname if present for narrow search. DV
|
|
if ($ARGLIST[2] eq "CLASS") {
|
|
$SET_CLASS = 1;
|
|
}
|
|
#print "<P>SET_CLASS is $SET_CLASS\n";
|
|
$NEWCLASS = $ARGLIST[3];
|
|
$NEWCLASS =~ s/-(\d+)/pack("C", "$1")/eg;
|
|
|
|
#print "<P>CGI_ARG is \"$CGI_ARG\"\n";
|
|
#print "<P>TYPE is \"$TYPE\"; NAME is \"$NAME\"; NAME2 is \"$NAME2\"\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub make_class_page {
|
|
|
|
local($NAME) = @_;
|
|
|
|
dbmopen(%CLASS_TBL,"$dbsdir/class.dbm",0444) || die "$!";
|
|
dbmopen(%CLSMTH,"$dbsdir/clsmth.dbm",0444) || die "$!";
|
|
dbmopen(%CLSALSO,"$dbsdir/clsalso.dbm",0444) || die "$!";
|
|
dbmopen(%METH_TBL,"$dbsdir/meth.dbm",0444) || die "$!";
|
|
|
|
dbmopen(%METH_LANG,"$dbsdir/methlang.dbm",0444) || die "$!";
|
|
|
|
# print "<P>LANG is \"$LANG\"\n";
|
|
if ($CLASS_TBL{$NAME}) {
|
|
|
|
($DESC,$LIB) = split(/\|/,$CLASS_TBL{$NAME});
|
|
|
|
#print "<H3>Class $NAME</H3>\n";
|
|
|
|
($LIBARG = $LIB) =~ tr/a-z/A-Z/;
|
|
$LIBARG .= "_HRCHY";
|
|
|
|
# print "<P><A HREF=\"$cgiroot/pfmakepage.cgi?CLASS,$MAKEPAGE_ARG\"><IMG BORDER=\"0\" SRC=\"$docroot/images/${LIB}.gif\" ALT=\"Parent\"></A>\n";
|
|
|
|
#print "<A HREF=\"$cgiroot/pfsearch.cgi?$LIBARG\" TARGET=\"search_frame\"><IMG BORDER=\"0\" SRC=\"$docroot/images/${LIB}.gif\" ALT=\"${LIB}\"></A>";
|
|
|
|
#print "<P>library is ${LIB}<P>\n";
|
|
|
|
&selectmanpage();
|
|
|
|
|
|
print "<P><B>Description:</B> $DESC\n";
|
|
|
|
print "<P><B>Methods:</B>\n";
|
|
|
|
$METH_COUNTER = 0;
|
|
#$METH_KEY = $NAME . "_" . $METH_COUNTER;
|
|
$METH_KEY = $NAME . $METH_NAME;
|
|
|
|
#print "<P>methname is $METH_NAME<P>\n";
|
|
|
|
while (($key, $value) = each(%METH_LANG)) {
|
|
($newclass, $newmeth) = split(/\./,$key);
|
|
#print "$newclass \= $value<P>\n";
|
|
#print "<P>methkey is $METH_KEY<P>\n";
|
|
|
|
#print "<UL>\n";
|
|
if ($METH_KEY =~ /$newclass/) {
|
|
if (($value eq $LANG) || ($value eq "B") || ($LANG eq "B")) {
|
|
#print "metod is $newmeth<P>\n"
|
|
&print_meth();
|
|
}
|
|
#push(@list,"$key \= $value\n");
|
|
}
|
|
#print "</UL>\n";
|
|
|
|
} # end while
|
|
|
|
|
|
$ALSO_COUNTER = 0;
|
|
$ALSO_KEY = $NAME . "_" . $ALSO_COUNTER;
|
|
|
|
while ($CLSALSO{$ALSO_KEY}) {
|
|
|
|
if ($ALSO_COUNTER == 0) { print "<P><B>See Also:</B> "; }
|
|
|
|
$MAKEPAGE_ARG = &packup($CLSALSO{$ALSO_KEY});
|
|
|
|
#print "<A HREF=\"$cgiroot/pfmakepage.cgi?CLASS,$MAKEPAGE_ARG\">$CLSALSO{$ALSO_KEY}</A>";
|
|
print "<A HREF=\"$cgiroot/pfmakepage.cgi?CLASS,$MAKEPAGE_ARG,LANG,$LANG\">$CLSALSO{$ALSO_KEY}</A>";
|
|
|
|
$ALSO_COUNTER++;
|
|
$ALSO_KEY = $NAME . "_" . $ALSO_COUNTER;
|
|
|
|
if ($CLSALSO{$ALSO_KEY}) {
|
|
|
|
print ", ";
|
|
|
|
}
|
|
|
|
else { print "."; }
|
|
|
|
}
|
|
|
|
}
|
|
else {
|
|
|
|
print "<P> <P>Sorry, no information available for <B>${NAME}</B>";
|
|
|
|
}
|
|
|
|
dbmclose(%METH_LANG);
|
|
dbmclose(%CLASS_TBL);
|
|
dbmclose(%CLSMTH);
|
|
dbmclose(%CLSALSO);
|
|
dbmclose(%METH_TBL);
|
|
|
|
} # END make_class_page
|
|
|
|
sub print_meth {
|
|
#$MAKEPAGE_ARG = &packup($CLSMTH{$METH_KEY});
|
|
$MAKEPAGE_ARG = &packup($newmeth);
|
|
# Added to get Class name for narrowed search, DV
|
|
$NEWNAME = &packup($NAME);
|
|
#$NEWNAME = &packup($newmeth);
|
|
#print "<P>Methname is $METH_NAME\n";
|
|
#$newmeth
|
|
#print "<BR><A HREF=\"$cgiroot/pfmakepage.cgi?METHOD,$MAKEPAGE_ARG,CLASS,$NEWNAME,LANG,$LANG\">$CLSMTH{$METH_KEY}</A>\n";
|
|
print "<BR> \; \; \; \; \;<A HREF=\"$cgiroot/pfmakepage.cgi?METHOD,$MAKEPAGE_ARG,CLASS,$NEWNAME,LANG,$LANG\">$newmeth</A>\n";
|
|
} # END print_meth
|
|
|
|
sub make_meth_page {
|
|
|
|
local($NAME) = @_;
|
|
|
|
dbmopen(%METH_TBL,"$dbsdir/meth.dbm",0444) || die "$!";
|
|
|
|
print "<H3>Method $NAME</H3>\n";
|
|
|
|
$COUNTER = 0;
|
|
|
|
$NAME_KEY = $NAME . "_" . $COUNTER;
|
|
|
|
while ($METH_TBL{$NAME_KEY}) {
|
|
|
|
($SYNTAX,$CLASS,$INCLUDE) = split(/\|/,$METH_TBL{$NAME_KEY});
|
|
|
|
$MAKEPAGE_ARG = &packup($CLASS);
|
|
|
|
# Added to check Class and if present only print where class matches. DV
|
|
if ($SET_CLASS =~ "1") {
|
|
if ($CLASS eq $NEWCLASS) {
|
|
&prtmethod();
|
|
}
|
|
} else {
|
|
&prtmethod();
|
|
}
|
|
|
|
|
|
$COUNTER++;
|
|
$NAME_KEY = $NAME . "_" . $COUNTER;
|
|
|
|
}
|
|
|
|
dbmclose(%METH_TBL);
|
|
|
|
} #END make_meth_page
|
|
|
|
sub prtmethod {
|
|
print "<P>Class: <A HREF=\"$cgiroot\/pfmakepage.cgi?CLASS,$MAKEPAGE_ARG,LANG,$LANG\">$CLASS</A>\n";
|
|
#print "<P>Class: <A HREF=\"$cgiroot/pfmakepage.cgi?CLASS,$CLASS\">$CLASS</A>\n";
|
|
print "<P> $SYNTAX\n";
|
|
|
|
|
|
#$INCLUDE =~ s/\</</g;
|
|
$INCLUDE =~ /\<Performer(.*)\>/;
|
|
$inclhead = $1;
|
|
#$INCLUDE =~ s/\<.*\>/<\<A HREF\=\"file\:\/usr\/include\/$inclhead\"\>$inclhead<\/A>>/;
|
|
$INCLUDE =~ s/\<.*\>/<\<A HREF=\"$cgiroot\/pfdispaly.cgi?$includedir$inclhead\"\>Performer$inclhead<\/A>>/;
|
|
print "<P> $INCLUDE\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub packup {
|
|
|
|
$ALL = "";
|
|
local (@string) = split(//,(pop(@_))); # Split all chars in string
|
|
foreach $i (@string) {
|
|
$j = ord($i); # Get the ordinal value of this char
|
|
$ALL = "$ALL" . "-$j" ; # Concatenate to string ALL w/- sign
|
|
}
|
|
|
|
return $ALL ; # Give back better than what you got
|
|
|
|
}
|
|
|
|
sub make_token_page {
|
|
|
|
local($NAME) = @_;
|
|
dbmopen(%TOKEN_TBL,"$dbsdir/token.dbm",0444) || die "$!";
|
|
|
|
print "<H3>Token $NAME</H3>\n";
|
|
|
|
$COUNTER = 0;
|
|
|
|
$NAME_KEY = $NAME . "_" . $COUNTER;
|
|
|
|
while (($key, $value) = each(%TOKEN_TBL)) {
|
|
$key =~ s/(\w)_\d+/$1/;
|
|
if ($key eq $NAME) {
|
|
print "<A HREF=\"manpage\?$key\">$value</A><BR>\n";
|
|
} # end if
|
|
} # end while
|
|
|
|
|
|
} # end make_token_page
|
|
|
|
sub selectmanpage {
|
|
# Check to see if C and C++ have been selected and for existence of
|
|
# man page in C or C++
|
|
|
|
if (-f "$absdocroot/html_mans/${NAME}.html") {
|
|
print "<H3>Class <A HREF=\"$docroot/html_mans/${NAME}.html\">${NAME}</A></H3>\n";
|
|
} elsif ($LANG =~ "C") {
|
|
print "<H3>Class <A HREF=\"$docroot/html_mans/C/${NAME}.html\">${NAME}</A></H3>\n";
|
|
} elsif ($LANG =~ "A") {
|
|
print "<H3>Class <A HREF=\"$docroot/html_mans/c/${NAME}.html\">${NAME}</A></H3>\n";
|
|
} elsif (($LANG =~ "B") && (-f "$absdocroot/html_mans/c/${NAME}.html")) {
|
|
print "<H3>Class <A HREF=\"$docroot/html_mans/B/${NAME}.html\">${NAME}</A></H3>\n";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
sub selectmanpageold {
|
|
# Check to see if C and C++ have been selected and for existence of
|
|
# man page in C or C++
|
|
|
|
if (-f "$absdocroot/html_mans/${NAME}.html") {
|
|
print " <A HREF=\"$docroot/html_mans/${NAME}.html\"><IMG BORDER=\"0\" SRC=\"$docroot/images/manpage.gif\" ALT=\"Man Page\"></A>\n";
|
|
} elsif ($LANG =~ "C") {
|
|
print " <A HREF=\"$docroot/html_mans/C/${NAME}.html\"><IMG BORDER=\"0\"
|
|
SRC=\"$docroot/images/manpage.gif\" ALT=\"Man Page\"></A>\n";
|
|
} elsif ($LANG =~ "A") {
|
|
print " <A HREF=\"$docroot/html_mans/c/${NAME}.html\"><IMG BORDER=\"0\"
|
|
SRC=\"$docroot/images/manpage.gif\" ALT=\"Man Page\"></A>\n";
|
|
} elsif (($LANG =~ "B") && (-f "$absdocroot/html_mans/c/${NAME}.html")) {
|
|
print " <A HREF=\"$docroot/html_mans/B/${NAME}.html\"><IMG BORDER=\"0\" SRC=\"$docroot/images/manpage.gif\" ALT=\"Man Page\"></A>\n";
|
|
}
|
|
|
|
}
|