source: Vago/Libs/quazip-0.7.2/doc/html/installdox@ 1069

Last change on this file since 1069 was 1050, checked in by s10k, 8 years ago
File size: 2.5 KB
RevLine 
[1050]1#!/usr/bin/perl
2
3%subst = ( "qtcore.tags", "");
4$quiet = 0;
5
6while ( @ARGV ) {
7 $_ = shift @ARGV;
8 if ( s/^-// ) {
9 if ( /^l(.*)/ ) {
10 $v = ($1 eq "") ? shift @ARGV : $1;
11 ($v =~ /\/$/) || ($v .= "/");
12 $_ = $v;
13 if ( /(.+)\@(.+)/ ) {
14 if ( exists $subst{$1} ) {
15 $subst{$1} = $2;
16 } else {
17 print STDERR "Unknown tag file $1 given with option -l\n";
18 &usage();
19 }
20 } else {
21 print STDERR "Argument $_ is invalid for option -l\n";
22 &usage();
23 }
24 }
25 elsif ( /^q/ ) {
26 $quiet = 1;
27 }
28 elsif ( /^\?|^h/ ) {
29 &usage();
30 }
31 else {
32 print STDERR "Illegal option -$_\n";
33 &usage();
34 }
35 }
36 else {
37 push (@files, $_ );
38 }
39}
40
41foreach $sub (keys %subst)
42{
43 if ( $subst{$sub} eq "" )
44 {
45 print STDERR "No substitute given for tag file `$sub'\n";
46 &usage();
47 }
48 elsif ( ! $quiet && $sub ne "_doc" && $sub ne "_cgi" )
49 {
50 print "Substituting $subst{$sub} for each occurrence of tag file $sub\n";
51 }
52}
53
54if ( ! @files ) {
55 if (opendir(D,".")) {
56 foreach $file ( readdir(D) ) {
57 $match = ".html";
58 next if ( $file =~ /^\.\.?$/ );
59 ($file =~ /$match/) && (push @files, $file);
60 ($file =~ /\.svg/) && (push @files, $file);
61 ($file =~ "navtree.js") && (push @files, $file);
62 }
63 closedir(D);
64 }
65}
66
67if ( ! @files ) {
68 print STDERR "Warning: No input files given and none found!\n";
69}
70
71foreach $f (@files)
72{
73 if ( ! $quiet ) {
74 print "Editing: $f...\n";
75 }
76 $oldf = $f;
77 $f .= ".bak";
78 unless (rename $oldf,$f) {
79 print STDERR "Error: cannot rename file $oldf\n";
80 exit 1;
81 }
82 if (open(F,"<$f")) {
83 unless (open(G,">$oldf")) {
84 print STDERR "Error: opening file $oldf for writing\n";
85 exit 1;
86 }
87 if ($oldf ne "tree.js") {
88 while (<F>) {
89 s/doxygen\=\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\" (xlink:href|href|src)=\"\2/doxygen\=\"$1:$subst{$1}\" \3=\"$subst{$1}/g;
90 print G "$_";
91 }
92 }
93 else {
94 while (<F>) {
95 s/\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\", \"\2/\"$1:$subst{$1}\" ,\"$subst{$1}/g;
96 print G "$_";
97 }
98 }
99 }
100 else {
101 print STDERR "Warning file $f does not exist\n";
102 }
103 unlink $f;
104}
105
106sub usage {
107 print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n";
108 print STDERR "Options:\n";
109 print STDERR " -l tagfile\@linkName tag file + URL or directory \n";
110 print STDERR " -q Quiet mode\n\n";
111 exit 1;
112}
Note: See TracBrowser for help on using the repository browser.