s3: Fix uninitialized memory read in talloc_free()
[Samba.git] / source3 / script / expand-includes.pl
blob33fc44b267f986caea64e520cceacf69600dd2b4
1 #!/usr/bin/perl
2 # Expand the include lines in a Makefile
3 # Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
4 # Published under the GNU GPLv3 or later
6 my $depth = 0;
8 sub process($)
10 my ($f) = @_;
11 $depth++;
12 die("Recursion in $f?") if ($depth > 100);
13 open(IN, $f) or die("Unable to open $f: $!");
14 foreach (<IN>) {
15 my $l = $_;
16 if ($l =~ /^include (.*)$/) {
17 process($1);
18 } else {
19 print $l;
22 $depth--;
25 my $path = shift;
26 unless ($path) {
27 print STDERR "Usage: $0 Makefile.in > Makefile-noincludes.in\n";
28 exit(1);
30 process($path);