#!/usr/bin/perl

=begin metadata

Name: sleep
Description: suspend execution for a number of seconds
Author: Randy Yarger, randy.yarger@nextel.com
License: perl

=end metadata

=cut

use strict;

use File::Basename qw(basename);
use Getopt::Std qw(getopts);

use constant EX_SUCCESS => 0;
use constant EX_FAILURE => 1;

my $Program = basename($0);
my ($VERSION) = '1.203';

getopts('') or usage();
my $seconds = shift;
unless (defined $seconds) {
    warn "$Program: missing operand\n";
    usage();
}
if (@ARGV) {
    warn "$Program: extra operand `$ARGV[0]'\n";
    usage();
}
if ($seconds !~ m/\A[0-9]+\z/) {
    warn "$Program: invalid time interval `$seconds'\n";
    exit EX_FAILURE;
}
sleep $seconds;
exit EX_SUCCESS;

sub usage {
    warn "usage: $Program SECONDS\n";
    exit EX_FAILURE;
}

__END__

=pod

=head1 NAME

sleep - suspend execution for a number of seconds

=head1 SYNOPSIS

sleep I<seconds>

=head1 DESCRIPTION

I<sleep> waits for a number of seconds, then exits successfully.
The argument is taken as a decimal number with no fractional part.

=head1 ENVIRONMENT

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

=head1 BUGS

I<sleep> has no known bugs.

=head1 AUTHOR

The Perl implementation of I<sleep>
was written by Randy Yarger, I<randy.yarger@nextel.com>.

=head1 COPYRIGHT and LICENSE

This program is copyright by Randy Yarger 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