diff options
Diffstat (limited to 'crypto/openssl/util/dirname.pl')
-rw-r--r-- | crypto/openssl/util/dirname.pl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/openssl/util/dirname.pl b/crypto/openssl/util/dirname.pl new file mode 100644 index 0000000..d7a66d9 --- /dev/null +++ b/crypto/openssl/util/dirname.pl @@ -0,0 +1,18 @@ +#!/usr/local/bin/perl + +if ($#ARGV < 0) { + die "dirname.pl: too few arguments\n"; +} elsif ($#ARGV > 0) { + die "dirname.pl: too many arguments\n"; +} + +my $d = $ARGV[0]; + +if ($d =~ m|.*/.*|) { + $d =~ s|/[^/]*$||; +} else { + $d = "."; +} + +print $d,"\n"; +exit(0); |