diff options
author | Richard Levitte <levitte@openssl.org> | 2002-06-05 14:10:59 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2002-06-05 14:10:59 +0000 |
commit | d13363af6040e8f1277b984719c937ba55e52c41 (patch) | |
tree | d2b18f87440f4208e91ed198f70185c6d3aef4d0 /util | |
parent | b6fc2386f0e80e1280fd1ca8fb6b9ee848ae4f74 (diff) |
Make perl replacement for dirname, for system that lack the latter.
PR: 81
Diffstat (limited to 'util')
-rw-r--r-- | util/dirname.pl | 18 |
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); |