File: RawIndexToHTML.pl

package info (click to toggle)
radiuscontext 1.76-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 176 kB
  • ctags: 135
  • sloc: python: 1,120; perl: 57; sh: 50; makefile: 40
file content (32 lines) | stat: -rw-r--r-- 834 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl -w
#
#  Converts "index.raw" in the current directory into an html hot-linked
#  version (linking to user files).  Writes "index.html".
#
#  Contributed by Richard A. Soderberg, June 1998

open(INDEX, "index.raw") or die "Can't read index: $!";
open(HTML, ">index.html") or die "Can't write index.html: $!";

print HTML '<HTML><HEAD><TITLE>Index of /radius/Raw</TITLE></HEAD><BODY><PRE>',
		"\n";

while (<INDEX>) {
  print HTML;
  last if /=/;
}

while (<INDEX>) {
  if (/=/) {
    print HTML;
    last;
  }
  chomp($record = $_);
  ($username = substr($record, 0, 19)) =~ s/\s+$//g;;
  next if (length($username) > 20);
  $end = substr($record, 20);
  print HTML '<A HREF="' . $username . '.raw">' . $username . '</A>' .
		( ' ' x ( 20 - length($username) ) ) . "$end\n";
}

print HTML '</PRE></BODY></HTML>', "\n";