3 # A program to split out the Command_en.hlp file into two
4 # html documents, one for sysops, one for users
6 # Copyright (c) - 1999 Dirk Koopman G1TLH
12 # search local then perl directories
14 # root of directory tree for this system
16 $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
18 unshift @INC, "$root/perl"; # this IS the right way round!
19 unshift @INC, "$root/local";
28 $lang = shift @ARGV if @ARGV;
31 # read in the help file and key it all up and store it
34 if (!open($h, "$main::localcmd/Commands_$lang.hlp")) {
35 if (!open($h, "$main::cmd/Commands_$lang.hlp")) {
36 die "cannot open $main::cmd/Commands_$lang.hlp $!";
51 $text = [ ] if $state != 1; # new text reference if not in a list
53 my ($priv, $cmd, $desc) = split /\^/, $in;
54 $c{$cmd} = { cmd=>$cmd, priv=>$priv, desc=>$desc, text=> $text };
59 confess "no text!" unless $text;
67 # At this point we should have a hash containing all the useful info on each command
69 # Starting with the user file, open it and copy across the top and tail with the
70 # <data> tag replaced by this system.
73 my $html = "$main::root/html";
74 my $in = new IO::File "$html/user_$lang\_t.html" or die "can't open $html/user_$lang\_t.html $!";
75 my $out = new IO::File ">$html/user_$lang.html" or die "can't open $html/user_$lang.html $!";
76 chmod 0664, "$html/user_$lang.html";
78 # copy until <data> is nigh
88 foreach $c (sort {$a->{cmd} cmp $b->{cmd}} values %c) {
91 my $label = "L$count";
92 print $out "<li><a name=\"$label\"><b>$c->{cmd}</b></a> $c->{desc}<br><br>\n";
93 printlines($out, $c->{text});
96 # now copy the rest out
121 print $fh "</pre>\n";
128 if ($last =~ /^\s*$/) {
131 print $fh "<br><br>\n";
136 # print $fh "<br>\n";