Diff for /doc/help/usage.pl between versions 1.2 and 1.4

version 1.2, 2004/09/14 19:57:15 version 1.4, 2008/07/29 21:18:16
Line 4  use strict; Line 4  use strict;
 use HTML::TokeParser;  use HTML::TokeParser;
 use Getopt::Long;  use Getopt::Long;
   
 my ($help) = (0,0,0);  my ($usage,$build_unused) = (0,0);
 &GetOptions( "help"     => \$help);  &GetOptions( "usage"        => \$usage,
        "build-unused" => \$build_unused);
   
 sub get_all_files {  sub get_all_files {
     my $dir="../../loncom/html/adm/help/tex/";      my $dir="../../loncom/html/adm/help/tex/";
     opendir(DIR,$dir);      opendir(DIR,$dir);
     my @files=sort {uc($a) cmp uc($b)} (readdir(DIR));      my @files=sort {uc($a) cmp uc($b)} (readdir(DIR));
     return @files;      my @realfiles;
       foreach my $file (@files) {
    if ($file eq '.' || $file eq '..' || $file eq 'CVS' ||
       $file eq 'Latex_Footer.tex' || $file eq 'Latex_Header.tex') {next;}
    push(@realfiles,$file);
       }
       return @realfiles;
 }  }
   
 sub get_usage {  sub get_usage {
Line 30  sub print_unused { Line 37  sub print_unused {
     my ($all,$usage)=@_;      my ($all,$usage)=@_;
     my %all;      my %all;
     my %no_exist;      my %no_exist;
     foreach my $file (@{ $all }) {$all{$file}=[];}      foreach my $file (@{ $all }) {
     my @order=('author','course','developer');   $all{$file}=[];
       }
       my @order=('author','course','developer','domain');
     foreach my $list (@{ $usage }) {      foreach my $list (@{ $usage }) {
  foreach my $file (@{ $list }) {   foreach my $file (@{ $list }) {
     if (exists($all{$file})) {       if (exists($all{$file})) { 
Line 58  sub print_unused { Line 67  sub print_unused {
     }      }
 }  }
   
   sub texxml_unused {
       my ($all,$usage)=@_;
       my %all;
        foreach my $file (@{ $all }) {$all{$file}='1';}
       foreach my $list (@{ $usage }) {
    foreach my $file (@{ $list }) {
       if (exists($all{$file})) { 
    delete($all{$file});
       }
    }
       }
       print("<texxml>\n");
       print("<title name=\"Unused files\" />\n");
       foreach my $file (sort {uc($a) cmp uc($b)} (keys(%all))) {
    print("<section name=\"$file\">\n");
    print("<file name=\"$file\">\n");
    print("</section>\n");
       }
       print("</texxml>\n");
   }
   
 sub main {  sub main {
     my @all_files=&get_all_files();      my @all_files=&get_all_files();
     my @author_usage=&get_usage('author');      my @author_usage=&get_usage('author');
     my @course_usage=&get_usage('course');      my @course_usage=&get_usage('course');
     my @developer_usage=&get_usage('developer');      my @developer_usage=&get_usage('developer');
       my @domain_usage=&get_usage('domain');
     &print_unused(\@all_files,[\@author_usage,\@course_usage,      if     ($usage) {
        \@developer_usage]);   &print_unused(\@all_files,[\@author_usage,\@course_usage,
      \@developer_usage,\@domain_usage]);
       } elsif($build_unused) {
    &texxml_unused(\@all_files,[\@author_usage,\@course_usage,
       \@developer_usage,\@domain_usage]);
       } else {
    print("Please specify either --usage or --build-unused\n");
       }
 }  }
   
 &main;  &main;

Removed from v.1.2  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>