summaryrefslogtreecommitdiff
path: root/scripts/print_deps
blob: 9e76897186543f391c77aff4d751898d4a8a418e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl

# a glue program for print out dependencies based on filenames
# by Ken Estes kestes@staff.mail.com

use File::Basename;
use Getopt::Long;


GetOptions (	
	    qw( identifier=s basename! )
	      );
	    

if ("@ARGV") {
  foreach (@ARGV) {
    process_file($_);
  }
} else {

  # notice we are passed a list of filenames NOT as common in unix the
  # contents of the file.

  foreach (<>) {
    process_file($_);
  }
}

sub process_file {
  my ($str) = @_;
  chomp $str;

  if ($opt_basename) {
    $str = basename($str);
  }

  if ($opt_identifier) {
    print "${opt_identifier}(${str})\n";
  } else {
    print "$str\n";
  }

  return ;
}