File: creaindex.pl

package info (click to toggle)
doc-linux-it 2000.01-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 8,136 kB
  • ctags: 19
  • sloc: perl: 249; makefile: 50; sh: 42
file content (92 lines) | stat: -rwxr-xr-x 1,741 bytes parent folder | download
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
#!/usr/bin/perl -w


$now = localtime;

sub print_header() {
	print INDEX <<EOF;
<html>
<head>
<title>Debian GNU/Linux Italian HOWTO Document Index</title>
</head>

<body BGCOLOR="#FFFFFF">
<center>
<h1>Debian GNU/Linux Italian HOWTO Document Index</h1>
<h1>Indice dei documenti HOWTO in italiano per Debian GNU/Linux</h1>
</center>
<hr>

EOF
}

sub print_footer() {
	print INDEX <<EOF;
<hr>
<address>
<small>
Please send comments to <a href="mailto:borto\@pluto.linux.it">Giovanni Bortolozzo</a>.<br>
This page was created automatically at $now by the script crea-index.
</small>
</address>
</body>
EOF
}


# MAIN
open INDEX,">index.html" || die "Non posso aprire il file\n";
print_header;

opendir DIR,"." || die "Non posso aprire la directory\n";
@files = readdir DIR;

shift(@files); # tolgo il file .
shift(@files); # tolgo il file ..
@files = sort @files;

print INDEX "<table><tr>\n";
print INDEX "<td valign=top><dl>\n";
print INDEX "<h2>Linux HOWTO</h2>\n";
while ($file = shift @files) {
	if ( ($name = $file) =~ s/\.gz//) {
		$name =~ s/-/\ /g;
#		print $file.$name."\n";
		print INDEX "<a href=\"$file\">$name</a><br>\n";
	}
}
print INDEX "</tr></table>\n";
close DIR;

#mini HOWTO
opendir DIR,"./mini" || die "Non posso aprire la directory\n";
@files = readdir DIR;

shift(@files); # tolgo il file .
shift(@files); # tolgo il file ..
@files = sort @files;


print INDEX "<hr>\n<table><tr>\n";
print INDEX "<td valign=top><dl>\n";
print INDEX "<h2>Linux mini-HOWTO</h2>\n";
while ($file = shift @files) {
	if ( ($name = $file) =~ s/\.gz//) {
		$name =~ s/-/\ /g;
#		print $file.$name."\n";
		print INDEX "<a href=\"mini/$file\">$name</a><br>\n";
	}
}
print INDEX "</tr></table>\n";
close DIR;

print_footer;

close INDEX;