Copyright consolidation: perl files
[openssl.git] / util / dirname.pl
1 #! /usr/bin/env perl
2 # Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the OpenSSL license (the "License").  You may not use
5 # this file except in compliance with the License.  You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
8
9 if ($#ARGV < 0) {
10     die "dirname.pl: too few arguments\n";
11 } elsif ($#ARGV > 0) {
12     die "dirname.pl: too many arguments\n";
13 }
14
15 my $d = $ARGV[0];
16
17 if ($d =~ m|.*/.*|) {
18     $d =~ s|/[^/]*$||;
19 } else {
20     $d = ".";
21 }
22
23 print $d,"\n";
24 exit(0);