s3-libsmb: Remove use of cli_errstr()
[kai/samba.git] / source4 / script / buildtree.pl
1 #! /usr/bin/env perl -w
2     eval 'exec /usr/bin/env perl -S $0 ${1+"$@"}'
3         if 0; #$running_under_some_shell
4
5 use strict;
6 use File::Find ();
7 use File::Path qw(mkpath);
8 use Cwd 'abs_path';
9
10 # Set the variable $File::Find::dont_use_nlink if you're using AFS,
11 # since AFS cheats.
12
13 # for the convenience of &wanted calls, including -eval statements:
14 use vars qw/*name *dir *prune/;
15 *name   = *File::Find::name;
16 *dir    = *File::Find::dir;
17 *prune  = *File::Find::prune;
18 my $builddir = abs_path($ENV{builddir});
19 my $srcdir = abs_path($ENV{srcdir});
20 sub wanted;
21
22
23
24 # Traverse desired filesystems
25 File::Find::find({wanted => \&wanted, no_chdir => 1}, $srcdir);
26 exit;
27
28
29 sub wanted {
30     my ($dev,$ino,$mode,$nlink,$uid,$gid,$newdir);
31
32     if ((($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
33         (-d _) && (($newdir = abs_path($_)) !~ /$builddir/)) 
34         { 
35           $newdir =~ s!$srcdir!$builddir!; 
36           mkpath($newdir);
37           print("Creating $newdir\n");
38         }
39 }
40