source: tags/ms_r18q1/util/arb_srclst.pl

Last change on this file was 16873, checked in by westram, 6 years ago
  • fix typos ("neither")
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 22.7 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6my $debug_matching = 0; # set to 1 to view file matching and decision
7my $ignore_unknown = 0;
8
9# ------------------------------------------------------------
10# override checks below and save strictly as checked-in in SVN
11
12my @strictly_as_in_svn_when_matchesDir = (
13                                           qr/\/GDE\/MAFFT\/mafft-[0-9\.]+-with[out]*-extensions/o,
14                                          );
15
16# ------------------------------------------------------------
17# skipped_directories and files inside are never examined:
18
19my @skipped_directories = (
20                           qr/\/.+\/bin$/o,
21                           qr/\/.+\/build$/o,
22                           qr/\/lib\/sativa$/o,
23                           qr/\/HELP_SOURCE\/Xml$/o,
24                           qr/\/GDE\/MUSCLE\/obj$/o,
25                           qr/\/GDE\/PHYML20130708\/phyml\/autom4te.cache$/o,
26                           qr/\/GDE\/RAxML8\/builddir/o,
27                           qr/\/GDE\/SATIVA\/builddir/o,
28                           qr/\/ignore\./o,
29                           qr/\/PERL2ARB\/blib$/o,
30                           qr/\/HEADERLIBS\/[^\/]+/o,
31                           qr/\/UNIT_TESTER\/logs$/o,
32                           qr/\/UNIT_TESTER\/tests$/o,
33                           qr/\/UNIT_TESTER\/tests\.slow$/o,
34                           qr/\/UNIT_TESTER\/run\/homefake\/.arb_prop\/(macros|cfgSave)$/o,
35                           qr/^\.\/ARB_SOURCE_DOC/o,
36                           qr/^\.\/dep_graphs/o,
37                           qr/^\.\/INCLUDE$/o,
38                           qr/^\.\/lib\/help$/o,
39                           qr/^\.\/lib\/help_html$/o,
40                           qr/^\.\/lib\/pts$/o,
41                           qr/^\.\/lib\/mafft$/o,
42                           qr/^\.\/patches.arb$/o,
43                           qr/^\.\/PERL5$/o,
44                           qr/_COM\/DUMP$/o,
45                           qr/_COM\/GEN[CH]$/o,
46                           qr/_COM\/O$/o,
47                           qr/_GEN$/o,
48                           qr/nbproject/o,
49                           # needed by ralf:
50                           qr/^\.\/test_arb_make_targets_logs/o,
51                           qr/\.dSYM$/o,
52                          );
53
54# first used/skipped match wins (exception see @3 below)
55
56my %used_files = map { $_ => 1; } (
57                                   '!BRANCH_STATE',
58                                   'AUTHORS',
59                                   'COPYING',
60                                   'demo.arb',
61                                   'Doxyfile',
62                                   'export2sub',
63                                   'Makefile',
64                                   'Makefile.org',
65                                   'Makefile.setup.include',
66                                   'Makefile.setup.template',
67                                   'Makefile.suite',
68                                   'Makefile.test',
69                                   'needs_libs',
70                                  );
71
72my %skipped_files = map { $_ => 1; } (
73                                      '.build.lst',
74                                      '.cvsignore',
75                                      '.depends',
76                                      'ChangeLog',
77                                      'config.makefile',
78                                      'helpfiles.lst',
79                                      'last.success',
80                                      'Makefile.setup.local',
81                                      'makeloc.here',
82                                      'makeloc.here',
83                                      'nt_date.h',
84                                      'postcompile.sav',
85                                      'TAGS',
86                                      '.DS_Store',
87                                      );
88
89my %used_extensions = map { $_ => 1; } ( # matches part behind last '.' in filename
90                                        'c', 'cpp', 'cxx', 'cc',
91                                        'h', 'hpp', 'hxx',
92
93                                        'aisc', 'pa',
94                                        'bitmap',
95                                        'dtd', 'xsl',
96                                        'f',
97                                        'footer',
98                                        'head', 'header',
99                                        'i',  # swig input
100                                        'inc',
101                                        'java', 'manifest',
102                                        'makefile',
103                                        'pl', 'pm', 'PL', 'cgi', 'xs',
104                                        'awk',
105                                        'py',
106                                        'script',
107                                        'sh',
108                                        'source', 'menu',
109                                        'template', 'default',
110                                        'txt', 'doc', 'ps', 'pdf',
111                                        'tgz', 'gz',
112                                        'svg', 'png',
113                                        'xpc',
114                                       );
115
116my %skipped_extensions = map { $_ => 1; } ( # matches part behind last '.' in filename
117                                           'a',
118                                           'bak',
119                                           'class',
120                                           'bundle', # Some file from XCode
121                                           'gcno',
122                                           'genmenu',
123                                           'jar',
124                                           'last_gcc',
125                                           'last_compiler',
126                                           'list',
127                                           'log',
128                                           'o',
129                                           'old',
130                                           'patch',
131                                           'rej',
132                                           'so',
133                                           'stamp',
134                                           'swp',
135                                           'tmp',
136                                           'yml', 'json', # perl2arb
137                                          );
138
139
140# used_when_matches, skipped_when_matches and used_when_matchesFull are only tested,
141# if above filters did not match:
142
143my @used_when_matches = (
144                         qr/^arb_.*\.txt$/o,
145                         qr/disclaimer/io,
146                         qr/license/io,
147                         qr/needs_libs\..*/io,
148                         qr/readme$/io,
149                         qr/typemap$/io,
150                        );
151
152my @skipped_when_matches = (
153                            qr/.*~$/o, # backups
154                            qr/\#.*\#$/o,
155                            qr/\.\#.*$/o,
156                            qr/^arbsrc.*\.tgz$/o,
157                            qr/^arbsrc\.lst$/o,
158                            qr/^arbsrc\.lst\.tmp$/o,
159                            qr/^callgrind\./o,
160                           );
161
162my @used_when_matchesFull = (
163                             qr/\/AISC_COM\/AISC\/magic.lst$/o,
164                             qr/\/CLUSTALW\/.*$/o,
165                             qr/\/EISPACK\/rg\.html$/o,
166                             qr/\/GDE\/.*\.html$/o,
167                             qr/\/GDEHELP\/FASTA/o,
168                             qr/\/GDEHELP\/GDE.*/o,
169                             qr/\/GDEHELP\/HELP_PLAIN/o,
170                             qr/\/GDEHELP\/HELP_WRITTEN/o,
171                             qr/\/GDEHELP\/Makefile\.helpfiles/o,
172                             qr/\/HEADERLIBS\/.*COPYING$/o,
173                             qr/\/HELP_SOURCE\/.*\.gif$/o,
174                             qr/\/HELP_SOURCE\/oldhelp\/.*\.(ps|pdf)\.gz$/o,
175                             qr/\/HELP_SOURCE\/oldhelp\/.*\.hlp$/o,
176                             qr/\/HGL_SRC\/plot\.icon$/o,
177                             qr/\/PERL2ARB\/.*\.html$/o,
178                             qr/\/PERL2ARB\/Makefile.main$/o,
179                             qr/\/PHYLIP\/doc\//o,
180                             qr/\/PROBE_SERVER\/.*\.conf$/o,
181                             qr/\/READSEQ\/.*\.help$/o,
182                             qr/\/READSEQ\/Formats$/o,
183                             qr/\/SH\/[^\/\.]*$/o,
184                             qr/\/SOURCE_TOOLS\//o,
185                             qr/\/TREEPUZZLE\/.*\.gif$/o,
186                             qr/\/UNIT_TESTER\/run\/.*\.a00$/o,
187                             qr/\/UNIT_TESTER\/run\/.*\.arb$/o,
188                             qr/\/UNIT_TESTER\/run\/.*\.amc$/o,
189                             qr/\/UNIT_TESTER\/run\/.*\.expected$/o,
190                             qr/\/UNIT_TESTER\/run\/.*\.fig$/o,
191                             qr/\/UNIT_TESTER\/run\/.*\.in$/o,
192                             qr/\/UNIT_TESTER\/run\/.*\.inp$/o,
193                             qr/\/UNIT_TESTER\/run\/.*\.input$/o,
194                             qr/\/UNIT_TESTER\/run\/.*\.out$/o,
195                             qr/\/UNIT_TESTER\/run\/.*\.tree$/o,
196                             qr/\/UNIT_TESTER\/run\/help\//o,
197                             qr/\/UNIT_TESTER\/run\/impexp\/.*\.exported$/o,
198                             qr/\/UNIT_TESTER\/valgrind\/arb_valgrind_logged$/o,
199                             qr/^\.\/etc\//o,
200                             qr/^\.\/lib\/arb_default\/.*\.arb$/o,
201                             qr/^\.\/lib\/arb_tcp_org\.dat$/o,
202                             qr/^\.\/lib\/config\.[^\.]+$/io,
203                             qr/^\.\/lib\/desktop\/.*$/o,
204                             qr/^\.\/lib\/export\/.*\.eft$/o,
205                             qr/^\.\/lib\/import\/.*\.ift2?$/o,
206                             qr/^\.\/lib\/inputMasks\/.*\.mask$/o,
207                             qr/^\.\/lib\/macros\/.*\.amc$/o,
208                             qr/^\.\/lib\/macros\/.checks\/.*\.expected$/o,
209                             qr/^\.\/lib\/nas\/names\.dat\.template$/o,
210                             qr/^\.\/lib\/pictures\/.*\.(fig|vfont)$/o,
211                             qr/^\.\/lib\/pixmaps\/.*\.xpm$/o,
212                             qr/^\.\/lib\/protein_2nd_structure\/.*\.dat$/o,
213                             qr/^\.\/lib\/rna3d\/.*\.(pdb|data)$/o,
214                             qr/^\.\/lib\/rna3d\/images\/.*\.png$/o,
215                             qr/^\.\/lib\/sellists\/.*\.sellst$/o,
216                             qr/^\.\/lib\/submit\//o,
217                             qr/^\.\/lib\/BUGS\//o,
218                             qr/^\.\/util\/arb_.*$/o,
219                             qr/^\.\/util\/config\..*$/o,
220                             qr/\/GDE\/.*\/Makefile\.[^\/]+$/io,
221                             qr/\/GDE\/PHYML[^\/]+\/phyml\//o,
222                             qr/\/GDE\/SATIVA\/sativa\//o,
223                            );
224
225# skipped_when_matchesFull and forced_when_matchesFull are always tested! (@3)
226
227my @skipped_when_matchesFull = (
228                                qr/\/genhelp\/.*\.hlp$/o,
229                                qr/\/lib\/addlibs\/(lib.*\.so\..*)$/o,
230                                qr/^\.\/arb.*\.tgz$/o,
231                                qr/^\.\/bin\//o,
232                                qr/^\.\/GDE\/CORE\/functions.h$/o,
233                                qr/^\.\/GDE\/PHYML[^\/]+\/phyml\/(configure|config.h.in)$/o,
234                                qr/\/HELP_SOURCE\/help_map\.gif$/o,
235                                qr/^\.\/lib\/ARB\.pm$/o,
236                                qr/^\.\/lib\/arb_tcp\.dat$/o,
237                                qr/^\.\/lib\/gde\/.*\.menu$/o,
238                                qr/^\.\/lib\/nas\/names.*\.dat$/o,
239                                qr/^\.\/lib\/macros\/\.checks\/.*\.ids$/o,
240                                qr/^\.\/lib\/motifHack\/pixmaps\/.*$/o,
241                                qr/^\.\/PERL2ARB\/.*\.h$/o,
242                                qr/^\.\/PERL2ARB\/ARB\.bs$/o,
243                                qr/^\.\/PERL2ARB\/ARB\.c$/o,
244                                qr/^\.\/PERL2ARB\/ARB\.xs$/o,
245                                qr/^\.\/PERL2ARB\/Makefile$/o,
246                                qr/^\.\/PERL2ARB\/Makefile.PL$/o,
247                                qr/^\.\/PERL2ARB\/perlmain.c$/o,
248                                qr/^\.\/PERL2ARB\/pm_to_blib$/o,
249                                qr/^\.\/SOURCE_TOOLS\/valgrind2grep\.lst$/o,
250                                qr/^\.\/SOURCE_TOOLS\/stamp\./o,
251                                qr/^\.\/TEMPLATES\/arb_build\.h$/o,
252                                qr/^\.\/UNIT_TESTER\/run\/TEST_g?pt\.arb$/o,
253                                qr/^\.\/UNIT_TESTER\/run\/.*\.ARM$/o,
254                                qr/^\.\/UNIT_TESTER\/run\/.*\.ARF$/o,
255                                qr/^\.\/UNIT_TESTER\/Makefile\.setup\.local\.last$/o,
256                                qr/^\.\/TAGS\./o, # avoid failure while 'make tags' is running
257                                qr/date\.xsl$/o,
258                               );
259
260my @forced_when_matchesFull = (
261                               qr/^\.\/bin\/Makefile/o,
262                               qr/\/PROBE_WEB\/SERVER\/.*\.jar$/o,
263                               qr/\/GDE\/PHYML[^\/]+\/phyml\/.*\.log$/o,
264                               qr/\/UNIT_TESTER\/run\/.*\.list$/o,
265                               qr/\/HEADERLIBS\/.*\.patch$/o,
266                              );
267
268# files that are even packed when generated and not in VC
269my @pack_fullGenerated = (
270                          qr/\/TEMPLATES\/svn_revision\.h$/o,
271                          qr/\/lib\/revision_info\.txt$/o,
272                         );
273
274# ------------------------------------------------------------
275# sanity checks
276
277foreach (keys %used_extensions) {
278  if (exists $skipped_extensions{$_}) { die "'$_' in \$used_extensions and \$skipped_extensions"; }
279}
280foreach (keys %used_files) {
281  if (exists $skipped_files{$_}) { die "'$_' in \$used_files and \$skipped_files"; }
282}
283
284# ------------------------------------------------------------
285
286sub useDir($) {
287  my ($dir) = @_;
288
289  if ($dir =~ /.svn$/o) { return 0; }
290  if ($dir =~ /CVS$/o) { return 0; }
291  foreach (@skipped_directories) {
292    if ($dir =~ $_) { return 0; }
293  }
294  return 1;
295}
296
297sub matchingExpr($\@) {
298  # return 0 if no regexp matched, return index+1 otherwise
299  my ($str,$regexp_arr_r) = @_;
300
301  my $regexps = scalar(@$regexp_arr_r);
302  for (my $r=0; $r<$regexps; $r++) {
303    my $reg = $$regexp_arr_r[$r];
304    if ($str =~ $reg) {
305      return $r+1;
306    }
307  }
308  return 0;
309}
310
311sub useIfMatching($\@\$) {
312  my ($str,$regexp_arr_r,$use_r) = @_;
313  my $matches = matchingExpr($str,@$regexp_arr_r);
314  if ($matches>0) {
315    if ($debug_matching!=0) { print STDERR "'$str' matches '".$$regexp_arr_r[$matches-1]."' => use!\n"; }
316    $$use_r = 1;
317  }
318}
319sub dontUseIfMatching($\@\$) {
320  my ($str,$regexp_arr_r,$use_r) = @_;
321  my $matches = matchingExpr($str,@$regexp_arr_r);
322  if ($matches>0) {
323    if ($debug_matching!=0) { print STDERR "'$str' matches '".$$regexp_arr_r[$matches-1]."' => don't use!\n"; }
324    $$use_r = 0;
325  }
326}
327
328sub useFile($$) {
329  my ($dir,$file) = @_;
330
331  my $use = undef;
332  if (exists $used_files{$file}) { $use = 1; }
333  elsif (exists $skipped_files{$file}) { $use = 0; }
334
335  my $hasExt = 0;
336  if (not defined $use) {
337    if ($file =~ /\.([^\.]+)$/o) {
338      my $ext = $1;
339      $hasExt = 1;
340      if (exists $used_extensions{$ext}) {
341        if ($debug_matching!=0) { print STDERR "'$file' matches extension '".$ext."' => use!\n"; }
342        $use = 1;
343      }
344      elsif (exists $skipped_extensions{$ext}) {
345        if ($debug_matching!=0) { print STDERR "'$file' matches extension '".$ext."' => don't use!\n"; }
346        $use = 0;
347      }
348    }
349  }
350
351  if (not defined $use) {
352    useIfMatching($file,@used_when_matches, $use);
353  }
354
355  if (not defined $use) {
356    dontUseIfMatching($file,@skipped_when_matches, $use);
357  }
358
359  my $full;
360  if (not defined $use) {
361    $full = $dir.'/'.$file;
362
363    useIfMatching($full,@used_when_matchesFull, $use);
364    if (not defined $use) {
365      if (-X $full and $hasExt==0) { $use = 0; } # exclude binaries by default (wrong for scripts)
366    }
367  }
368
369  if (not defined $use or $use==1) {
370    if (not defined $full) { $full = $dir.'/'.$file; }
371
372    dontUseIfMatching($full,@skipped_when_matchesFull, $use);
373  }
374  if (not defined $use or $use==0) {
375    if (not defined $full) { $full = $dir.'/'.$file; }
376    useIfMatching($full,@forced_when_matchesFull, $use);
377  }
378
379  if (not defined $use) {
380    if ($ignore_unknown==0) {
381      die "Don't know whether to use or skip '$file' (in $dir)";
382    }
383    $use = 1;
384  }
385
386  return $use;
387}
388
389# ------------------------------------------------------------
390
391my $VC_FILE    = 1;
392my $VC_DIR     = 2;
393my $VC_UNKNOWN = 3; # in SVN, but unknown whether dir or file
394
395my $svn_entries_read = 0;
396my %all_svn_entries = ();
397
398sub isSVNcheckout($) {
399  my ($dir) = @_;
400  if (-f $dir.'/.svn/entries') { return 1; }
401  if (-f $dir.'/.svn/wc.db') { return 1; }
402  return 0;
403}
404
405sub getSVNEntries($\%) {
406  my ($dir,$SVN_r) = @_;
407
408  if ($svn_entries_read==0) { # first call
409    if (isSVNcheckout($dir)==0) { return 0; }
410
411    my $cmd = "svn status -v $dir";
412    open(SVNSTATUS, "$cmd|") || die "failed to execute '$cmd' (Reason: $!)";
413
414    eval {
415      my $reg_status_line = qr/^(.*)\s+([0-9]+|\-)\s+([0-9]+|\?)\s+([^\s]+)\s+([^\s]+)$/;
416
417      my $line;
418      while (defined($line=<SVNSTATUS>)) {
419        chomp($line);
420        if ($line =~ $reg_status_line) {
421          my ($flags,$revLast,$revFirst,$author,$name) = ($1,$2,$3,$4,$5);
422
423          my $inSVN = 1;
424          if ($flags =~ /D/) { $inSVN = 0; }
425
426          if ($inSVN==1) {
427            if (-f $name) {
428              $all_svn_entries{$name} = $VC_FILE;
429            }
430            elsif (-d $name) {
431              $all_svn_entries{$name} = $VC_DIR;
432            }
433            else {
434              $all_svn_entries{$name} = $VC_UNKNOWN;
435            }
436          }
437        }
438        else {
439          if ($line =~ /^?/) {
440            ; # silently ignore unknown files
441            # print STDERR "Silently ignores '$line'\n";
442          }
443          else {
444            die "Cant parse line '$line'";
445          }
446        }
447      }
448    };
449    if ($@) {
450      die "Failed to read svn status: $@";
451    }
452
453    close(SVNSTATUS);
454    $svn_entries_read = 1;
455  }
456
457  if ($dir eq '.') {
458    foreach (keys %all_svn_entries) {
459      if (not /\//) { # root entry
460        $$SVN_r{$_} = $all_svn_entries{$_};
461      }
462    }
463  }
464  else {
465    if (not $dir =~ /^\.\//) { die "expected '$dir' to start with './'"; }
466    my $sdir = $';
467    my $reg_matchdir = qr/^$sdir\//;
468    foreach (keys %all_svn_entries) {
469      if ($_ =~ $reg_matchdir) {
470        my $rest = $';
471        if (not $rest =~ /\//) { # in $dir (not below)
472          $$SVN_r{$rest} = $all_svn_entries{$_};
473        }
474      }
475    }
476  }
477
478  return 1;
479}
480
481sub getCVSEntries($\%) {
482  my ($dir,$CVS_r) = @_;
483
484  my $cvsentries = $dir.'/CVS/Entries';
485  if (-f $cvsentries) {
486    open(CVS,'<'.$cvsentries) || die "can't read '$cvsentries' (Reason: $!)";
487    eval {
488      foreach (<CVS>) {
489        chomp;
490        if (/^D\/([^\/]+)\//o) { # directory
491          $$CVS_r{$1} = $VC_DIR;
492        }
493        elsif (/^\/([^\/]+)\//o) { # file
494          $$CVS_r{$1} = $VC_FILE;
495        }
496        elsif (/^D$/o) {
497          ;
498        }
499        else {
500          die "can't parse line '$_'";
501        }
502      }
503    };
504    if ($@) { die "$@ while reading $cvsentries"; }
505    close(CVS);
506    return 1;
507  }
508  return 0;
509}
510
511my $VC = '<no VC>';
512
513sub getVCEntries($\%) {
514  my ($dir,$VC_r) = @_;
515
516  my $res = 1;
517  if (getSVNEntries($dir,%$VC_r)==0) {
518    if (getCVSEntries($dir,%$VC_r)==0) {
519      $VC = '<no VC>';
520      $res = 0;
521    }
522    else {
523      $VC = 'CVS';
524    }
525  }
526  else {
527    $VC = 'SVN';
528  }
529
530  if (0) {
531    print STDERR "$VC entries for $dir:\n";
532    foreach (sort keys %$VC_r) {
533      print STDERR " ".$$VC_r{$_}.": $_\n";
534    }
535  }
536
537  return $res;
538}
539
540# ------------------------------------------------------------
541
542sub expectVCmember($$\%) {
543  my ($full,$item,$VC_r) = @_;
544  if ((not defined $$VC_r{$item}) and ($ignore_unknown==0)) {
545    if (not matchingExpr($full,@pack_fullGenerated)) {
546      die "'$full' ($_) included, but not in $VC (seems to be generated)";
547    }
548  }
549}
550
551my %unpackedCVSmember = map { $_ => 1; } (
552                                          '.cvsignore',
553                                          'ChangeLog',
554                                         );
555
556sub unexpectVCmember($$\%) {
557  my ($full,$item,$VC_r) = @_;
558  if (defined $$VC_r{$item}) {
559    if ((not exists $unpackedCVSmember{$item}) and ($ignore_unknown==0)) {
560      die "'$full' excluded, but in $VC";
561    }
562  }
563}
564
565sub is_version_controlled($\%) {
566  my ($item,$VC_r) = @_;
567  if (defined $$VC_r{$item}) {
568    return 1;
569  }
570  return 0;
571}
572
573sub saveAsInSVNforDir($) {
574  my ($dir) = @_;
575  foreach my $reg (@strictly_as_in_svn_when_matchesDir) {
576    if ($dir =~ $reg) {
577      return 1;
578    }
579  }
580  return 0;
581}
582
583sub dumpFiles($);
584sub dumpFiles($) {
585  my ($dir) = @_;
586
587  eval {
588    my @subdirs;
589    my @files;
590
591    my %CVS;
592    if (!getVCEntries($dir,%CVS)) {
593      die "arb_srclst.pl only works in a SVN checkout";
594    }
595
596    my $as_in_svn = saveAsInSVNforDir($dir);
597
598    opendir(DIR,$dir) || die "can't read directory '$dir' (Reason: $!)";
599    foreach (readdir(DIR)) {
600      if ($_ ne '.' and $_ ne '..') {
601        my $full = $dir.'/'.$_;
602
603        # print STDERR "full='$full' (as_in_svn=$as_in_svn)\n";
604
605        if (not -l $full) {
606          if (-d $full) {
607            if ($as_in_svn==1) {
608              if (is_version_controlled($_,%CVS)==1) {
609                push @subdirs, $full;
610              }
611            }
612            else {
613              if (useDir($full)==1) {
614                expectVCmember($full,$_,%CVS);
615                push @subdirs, $full;
616              }
617              else { unexpectVCmember($full,$_,%CVS); }
618            }
619          }
620          elsif (-f $full) {
621            if ($as_in_svn==1) {
622              if (is_version_controlled($_,%CVS)==1) {
623                push @files, $full;
624              }
625            }
626            else {
627              if (useFile($dir,$_)==1) {
628                expectVCmember($full,$_,%CVS);
629                push @files, $full;
630              }
631              else { unexpectVCmember($full,$_,%CVS); }
632            }
633          }
634          else { die "Unknown (neither link nor file nor directory): '$full'"; }
635        }
636      }
637    }
638    closedir(DIR);
639
640    foreach (@files) { print $_."\n"; }
641    foreach (@subdirs) { dumpFiles($_); }
642  };
643  if ($@) {
644    my $err = $@;
645    if ($err =~ /at\s(.*\.pl)\sline\s([0-9]+)/) {
646      $err = "$1:$2: Error: $`";
647    }
648    $err =~ s/\n//g;
649    die "$err\n";
650  }
651}
652
653my $args = scalar(@ARGV);
654if ($args==0) {
655  dumpFiles('.');
656}
657else {
658  my $arg = $ARGV[0];
659  if ($arg eq 'ignore') {
660    $ignore_unknown = 1;
661    dumpFiles('.');
662  }
663  elsif ($arg eq 'matching') {
664    $debug_matching = 1;
665    dumpFiles('.');
666  }
667  else {
668    die "Usage: arb_srclst.pl [ignore|matching]\n";
669  }
670}
Note: See TracBrowser for help on using the repository browser.