mkdir-p.pl (1.1.1.1) | mkdir-p.pl (1.1.1.2) |
---|---|
1#!/usr/local/bin/perl | 1#! /usr/bin/env perl 2# Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. 3# 4# Licensed under the OpenSSL license (the "License"). You may not use 5# this file except in compliance with the License. You can obtain a copy 6# in the file LICENSE in the source distribution or at 7# https://www.openssl.org/source/license.html |
2 | 8 |
3# mkdir-p.pl 4 | |
5# On some systems, the -p option to mkdir (= also create any missing parent 6# directories) is not available. 7 8my $arg; 9 10foreach $arg (@ARGV) { 11 $arg =~ tr|\\|/|; 12 &do_mkdir_p($arg); --- 11 unchanged lines hidden (view full) --- 24 25 if ($dir =~ m|[^/]/|s) { 26 local($parent) = $dir; 27 $parent =~ s|[^/]*\Z(?!\n)||s; 28 29 do_mkdir_p($parent); 30 } 31 | 9# On some systems, the -p option to mkdir (= also create any missing parent 10# directories) is not available. 11 12my $arg; 13 14foreach $arg (@ARGV) { 15 $arg =~ tr|\\|/|; 16 &do_mkdir_p($arg); --- 11 unchanged lines hidden (view full) --- 28 29 if ($dir =~ m|[^/]/|s) { 30 local($parent) = $dir; 31 $parent =~ s|[^/]*\Z(?!\n)||s; 32 33 do_mkdir_p($parent); 34 } 35 |
32 mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n"; | 36 unless (mkdir($dir, 0777)) { 37 if (-d $dir) { 38 # We raced against another instance doing the same thing. 39 return; 40 } 41 die "Cannot create directory $dir: $!\n"; 42 } |
33 print "created directory `$dir'\n"; 34} | 43 print "created directory `$dir'\n"; 44} |