#!/usr/pkg/bin/perl

=begin metadata

Name: pwd
Description: working directory name
Author: Kevin Meltzer, perlguy@perlguy.com
License: perl

=end metadata

=cut


use strict;

use Cwd qw(cwd getcwd);
use Getopt::Std qw(getopts);

my ($VERSION) = '1.4';

my %opt;
getopts('LP', \%opt) or usage();
usage() if @ARGV;
my $dir = $opt{'L'} ? cwd() : getcwd(); # default -P
unless (defined $dir) {
	warn "pwd: $!\n";
	exit 1;
}
if ($^O =~ m/Win32/) {
	$dir =~ tr/\//\\/;
}
print $dir . "\n";
exit;

sub usage {
	warn "usage: pwd [-L|-P]\n";
	exit 1;
}

__END__

=pod

=head1 NAME

pwd - working directory name

=head1 SYNOPSIS

pwd

=head1 DESCRIPTION

Pwd prints the pathname of the working (current) directory.

=head2 OPTIONS

I<pwd> takes no options.

=head1 ENVIRONMENT

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

=head1 BUGS

I<pwd> has no known bugs.

=head1 AUTHOR

The Perl implementation of I<pwd>
was written by Kevin Meltzer, I<perlguy@perlguy.com>.

=head1 COPYRIGHT and LICENSE

This program is copyright by Kevin Meltzer 1999.

This program is free and open software. You may use, 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


