summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2002-06-05 14:09:53 +0000
committerRichard Levitte <levitte@openssl.org>2002-06-05 14:09:53 +0000
commitd23a74f71cc85dba086fb31770412231b2cc0141 (patch)
treef8263d6cc5eeb9ad963c9cb67ff425ea259496e1 /util
parent12c853701e80f7613e1e9df182bc0a5d44123f1b (diff)
Make perl replacement for dirname, for system that lack the latter.
PR: 81
Diffstat (limited to 'util')
-rw-r--r--util/dirname.pl18
1 files changed, 18 insertions, 0 deletions
diff --git a/util/dirname.pl b/util/dirname.pl
new file mode 100644
index 0000000000..d7a66d96ac
--- /dev/null
+++ b/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);