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
|
#!/usr/bin/perl
# require Jcode;
# *Jgetcode = &Jcode::getcode;
# *Jconvert = &Jcode::convert;
require "../../../cgi-bin/jcode.pl";
*Jgetcode = &jcode::getcode;
*Jconvert = sub { &jcode::to($_[1], $_[0], $_[2]); };
@styles = ("../../ipp.css","../test.css");
$title = "テスト10";
$mycode = &Jgetcode($title);
$cutcode = "jis";
$scrname = "";
$filename = "";
$rtdir = "../";
$file = "";
{
$scrname = $ENV{'SCRIPT_NAME'};
$scrname =~ s/_1|_u// ;
if($scrname =~ /(ts[0-9]{4}.cgi$)/){
$filename = $+ ;
$filename =~ s/cgi/htm/ ;
}
&printHeader;
print "<div class=test>n";
&Jprint ("$mycode → $cutcode 変換<br>n");
&Jprint ("「親ディレクトリ」には、以下のHTMファイルがあります。");
print "<ul>n";
chdir($rtdir);
opendir(DIR, ".");
while ($file = readdir(DIR)) {
if($file =~ /htm$/){
open(IN, $file);
while(<IN>){
if(/<title>/){
if($' =~ /</title>/){
print "<li>$file" ;
&Jconv ("(", $`, ")", "n");
last;
}
}
}
close(IN);
}
}
closedir(DIR);
print "</ul>n";
print "</div>";
&printFooter;
exit;
}
sub printHeader{
print "Content-type: text/htmlnn";
&Jprint ("<html lang=ja><head><title>", $title, "</title>", "n");
foreach $st (@styles){
print "<link rel="stylesheet" type="text/css" href="$st">n";
}
print "</head><body>n";
print "<div class=head>n";
&Jprint ("<h1>", $title, "</h1><hr>n");
&printlinks;
print "<hr></div>n";
}
sub printFooter{
print "<div class=foot><hr>n";
&printlinks;
print "<hr>n";
open(IN, "../../sig.txt");
while ($sig = <IN>){ print $sig; }
close(IN);
print "</div>n";
print "</body></html>n";
}
sub printlinks{
print "<a href="../../../index.htm">Home</a>n";
print "/n<a href="../../">Perl</a>n";
print "/n<a href="../">TestCGI Index</a>n";
if($filename){
&Jprint ("/n<a href="../$filename">", $title, "の解説", "</a>n");
}
}
sub Jprint{
foreach (@_) { print &Jconvert($_, $cutcode, $mycode); }
}
sub Jconv{
foreach (@_) { print &Jconvert($_, $cutcode, &Jgetcode($_)); }
}
|