aboutsummaryrefslogtreecommitdiff
path: root/openssl/util/dirname.pl
diff options
context:
space:
mode:
Diffstat (limited to 'openssl/util/dirname.pl')
-rw-r--r--openssl/util/dirname.pl18
1 files changed, 18 insertions, 0 deletions
diff --git a/openssl/util/dirname.pl b/openssl/util/dirname.pl
new file mode 100644
index 000000000..d7a66d96a
--- /dev/null
+++ b/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);