home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / mc454src.zip / mc-4.5.4.src / mc-4.5.4 / src / gindex.pl < prev    next >
Perl Script  |  1999-01-04  |  671b  |  27 lines

  1. #!/usr/bin/perl
  2. # Since we use a linear search trought the block and the license and
  3. # the warranty are quite big, we leave them at the end of the help file,
  4. # the index will be consulted quite frequently, so we put it at the beginning. 
  5.  
  6. @help_file = <>;
  7.  
  8. foreach $line (@help_file){
  9.     if ($line =~ /\x4\[(.*)\]/ && $line !~ /\x4\[main\]/){
  10.     $nodes[$node_count++] = $1;
  11.     $line =~ s/(\x4\[) */$1/;
  12.     }
  13. }
  14.  
  15. print "\x4[Contents]\nTopics:\n\n";
  16. foreach $node (@nodes){
  17.     if (length $node){
  18.     $node =~ m/^( *)(.*)$/;
  19.     printf ("  %s\x1 %s \x2%s\x3", $1, $2, $2);
  20.     }
  21.     print "\n";
  22. }
  23. #foreach $line (@help_file){
  24. #    $line =~ s/%NEW_NODE%/\004/g;
  25. #}
  26. print @help_file;
  27.