Make perl replacement for dirname, for system that lack the latter.
authorRichard Levitte <levitte@openssl.org>
Wed, 5 Jun 2002 14:10:59 +0000 (14:10 +0000)
committerRichard Levitte <levitte@openssl.org>
Wed, 5 Jun 2002 14:10:59 +0000 (14:10 +0000)
PR: 81

Makefile.org
util/dirname.pl [new file with mode: 0644]

index 8a767e2a30b4136420b6a0ed5b12768e242524d6..8303f2ce8aa77594ad2fd7f355ca0d4ce558e533 100644 (file)
@@ -732,7 +732,7 @@ install_docs:
                fn=`basename $$i .pod`; \
                if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
                echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
-               (cd `dirname $$i`; \
+               (cd `$(PERL) util/dirname.pl $$i`; \
                sh -c "`cd ../../util; ./pod2mantest ignore` \
                        --section=$$sec --center=OpenSSL \
                        --release=$(VERSION) `basename $$i`") \
@@ -742,7 +742,7 @@ install_docs:
                fn=`basename $$i .pod`; \
                if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
                echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
-               (cd `dirname $$i`; \
+               (cd `$(PERL) util/dirname.pl $$i`; \
                sh -c "`cd ../../util; ./pod2mantest ignore` \
                        --section=$$sec --center=OpenSSL \
                        --release=$(VERSION) `basename $$i`") \
diff --git a/util/dirname.pl b/util/dirname.pl
new file mode 100644 (file)
index 0000000..d7a66d9
--- /dev/null
@@ -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);