From d13363af6040e8f1277b984719c937ba55e52c41 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 5 Jun 2002 14:10:59 +0000 Subject: [PATCH] Make perl replacement for dirname, for system that lack the latter. PR: 81 --- Makefile.org | 4 ++-- util/dirname.pl | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 util/dirname.pl diff --git a/Makefile.org b/Makefile.org index 8a767e2a3..8303f2ce8 100644 --- a/Makefile.org +++ b/Makefile.org @@ -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 index 000000000..d7a66d96a --- /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);