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

« back to all changes in this revision

Viewing changes to local/html-textfile-fix.pl

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-12-08 14:59:50 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20071208145950-u1tykhpw56nyzqik
Tags: 5.4.1~dfsg-4ubuntu1
* Merge from debian unstable.
* Remaining Ubuntu changes:
  - Remove stop links from rc0 and rc6
  - Munge Maintainer field as per spec.
* Ubuntu changes dropped:
  - Symlink common files between the packages, CDBS ought to handle that
    for us automatically.
* The latest Debian changes has dropped history from the changelog. Slot in
  the Ubuntu changes as best I can. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
use File::Copy;
 
3
#
 
4
# This program adds some HTML entities to the text files.  This will help prevent
 
5
# missing characters when including text documents in HTML.
 
6
#
 
7
# Written by:     Alex Burger
 
8
# Date:           December 29th, 2005
 
9
 
10
@files = qw"
 
11
ERRATA
 
12
INSTALL
 
13
NEWS
 
14
PORTING
 
15
README
 
16
README.agent-mibs
 
17
README.agentx
 
18
README.aix
 
19
README.hpux11
 
20
README.krb5
 
21
README.mib2c
 
22
README.mibs
 
23
README.osX
 
24
README.Panasonic_AM3X.txt
 
25
README.smux
 
26
README.snmpv3
 
27
README.solaris
 
28
README.thread
 
29
README.tru64
 
30
README.win32
 
31
TODO
 
32
perl/AnyData_SNMP/README
 
33
perl/default_store/README
 
34
perl/OID/README
 
35
perl/SNMP/README
 
36
perl/TrapReceiver/README
 
37
";
 
38
 
 
39
 
 
40
foreach my $file (@files) {
 
41
  open (FILEIN, $file) || die "Could not open file \'$file\' for reading. $!";
 
42
  open (FILEOUT, ">$file.new") || die "Could not open file \'$file.new\' for writing. $!";
 
43
  
 
44
  while ($line = <FILEIN>) {
 
45
    $line =~ s/&(?!lt|gt|quot|amp)/\&amp;/g;
 
46
    $line =~ s/</\&lt;/g;
 
47
    $line =~ s/>/\&gt;/g;
 
48
    $line =~ s/\"/\&quot;/g;
 
49
    print FILEOUT "$line";
 
50
  }
 
51
  close FILE;
 
52
 
 
53
  if (! (move ("$file", "$file.old"))) {
 
54
    die "Could not move $file to $file.old\n";
 
55
  }
 
56
  if (! (move ("$file.new", "$file"))) {
 
57
    die "Could not move $file.new to $file\n";
 
58
  }
 
59
}
 
60