etc/services - sync with NetBSD-8
[minix.git] / crypto / external / bsd / openssl / dist / util / mkdir-p.pl
blobe73d02b073bbf6171d300b1d66ca2be542dcf15a
1 #!/usr/local/bin/perl
3 # mkdir-p.pl
5 # On some systems, the -p option to mkdir (= also create any missing parent
6 # directories) is not available.
8 my $arg;
10 foreach $arg (@ARGV) {
11 $arg =~ tr|\\|/|;
12 &do_mkdir_p($arg);
16 sub do_mkdir_p {
17 local($dir) = @_;
19 $dir =~ s|/*\Z(?!\n)||s;
21 if (-d $dir) {
22 return;
25 if ($dir =~ m|[^/]/|s) {
26 local($parent) = $dir;
27 $parent =~ s|[^/]*\Z(?!\n)||s;
29 do_mkdir_p($parent);
32 mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n";
33 print "created directory `$dir'\n";