~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to win32/dist/scripts/txt2html

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-10 22:20:23 UTC
  • mto: (1.4.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20070510222023-3fr07xb9i17xvq32
Tags: upstream-5.3.1
ImportĀ upstreamĀ versionĀ 5.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
#
3
 
# This program generates a simple HTML document from a text file.
4
 
#
5
 
# Written by:     Alex Burger
6
 
# Date:           March 18th, 2004
7
 
8
 
 
9
 
# Set to 1 to use fixed width font (<tt>)
10
 
$fixed_width = 0;
11
 
 
12
 
open (FILE, @ARGV[0]) || die "Could not open file \'@ARGV[0]\'. $!";
13
 
 
14
 
 
15
 
print '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' . "\n";
16
 
print '<html>' . "\n";
17
 
print '<head>' . "\n";
18
 
print "<title></title>\n";
19
 
print '</head>' . "\n";
20
 
print '<body>' . "\n";
21
 
if ($fixed_width == 1) {
22
 
  print "<p><tt>\n";
23
 
}
24
 
else {
25
 
  print "<p>\n";
26
 
}
27
 
 
28
 
while ($line = <FILE>) {
29
 
  chomp $line;
30
 
  $line =~ s/&/\&amp;/g;
31
 
  $line =~ s/</\&lt;/g;
32
 
  $line =~ s/>/\&gt;/g;
33
 
  $line =~ s/\"/\&quot;/g;
34
 
  if ($line eq "") {
35
 
    if ($fixed_width == 1) {
36
 
      print "</tt></p>\n";
37
 
      print "<p><tt>\n";
38
 
    }
39
 
    else {
40
 
      print "</p>\n";
41
 
      print "<p>\n";
42
 
    }
43
 
  }
44
 
  else {
45
 
    print "$line<br />\n";
46
 
  }
47
 
}
48
 
 
49
 
if ($fixed_width == 1) {
50
 
  print "</tt>\n";
51
 
}
52
 
print "</p>\n";
53
 
print "</body>\n";
54
 
print "</html>\n";
55