The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl

=begin metadata

Name: dirname
Description: print the directory name of a path
Author: Abigail, perlpowertools@abigail.be
License: perl

=end metadata

=cut


use strict;
use File::Basename;

my ($VERSION) = '1.2';

unless (@ARGV == 1) {
    $0 = basename ($0);
    print <<EOF;
$0 (Perl bin utils) $VERSION
$0 string
EOF
    exit;
};

print +(dirname $ARGV [0]), "\n";

__END__

=pod

=head1 NAME

dirname - print the directory name of a path

=head1 SYNOPSIS

dirname string

=head1 DESCRIPTION

I<dirname> prints the directory component of a path. Everything starting
from the last I</> (or whatever the path separator is on your OS) is
deleted.

=head2 OPTIONS

I<dirname> does not accept any options.

=head1 ENVIRONMENT

The working of I<dirname> is not influenced by any environment variables.

=head1 BUGS

I<dirname> has no known bugs.

=head1 STANDARDS

This I<dirname> implementation is compliant with the B<IEEE Std1003.2-1992>
specification, also known as B<POSIX.2>.

This I<bdirame> implementation is compatible with the
B<OpenBSD> implementation.

=head1 REVISION HISTORY

    $Log: dirname,v $
    Revision 1.2  2004/08/05 14:17:43  cwest
    cleanup, new version number on website

    Revision 1.1  2004/07/23 20:10:03  cwest
    initial import

    Revision 1.1  1999/02/27 01:49:59  abigail
    Initial revision

=head1 AUTHOR

The Perl implementation of I<dirname> was written by Abigail,
I<perlpowertools@abigail.be>.

=head1 COPYRIGHT and LICENSE

This program is copyright by Abigail 1999.

This program is free and open software. You may use, copy, modify, distribute
and sell this program (and any modified variants) in any way you wish,
provided you do not restrict others to do the same.

=cut