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
|
#!/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]); };
$file = "ts0011";
$outfile = "$file.htm";
$infile = "$file.cgi";
$title = "$infileのソース";
$fcode = "sjis";
$mycode = &Jgetcode("漢字");
$cutcode = "jis";
$title .= "($mycodeから出力)";
{
open(OUT, "> $outfile");
&printHeader;
print (OUT "<ol>");
open(IN, $infile);
while($line = <IN>){
$line =~ s/&/&amp;/g;
$line =~ s/"/&quot;/g;
$line =~ s/</&lt;/g;
$line =~ s/>/&gt;/g;
$line =~ s/ /&nbsp;/g;
&Jfprint ("<li><code>$line</code>");
}
close(IN);
print (OUT "</ol>");
&printFooter;
close(OUT);
print "Location: $outfilenn";
exit;
}
sub printHeader{
&Jprint ("<html lang=ja><head><title>$title</title>n");
print (OUT "</head><body>n");
&Jprint ("<h1>$title</h1><hr>n");
}
sub printFooter{
print (OUT "<hr>n");
print (OUT "</body></html>n");
}
sub Jprint{
foreach (@_) {
print (OUT &Jconvert($_, $cutcode, $mycode));
}
}
sub Jfprint{
foreach (@_) {
print (OUT &Jconvert($_, $cutcode, $fcode));
}
}
|