#!/usr/local/bin/perl -w eval 'exec /usr/local/bin/perl -w -S $0 ${1+"$@"}' if 0; # not running under some shell # # $Id: head,v 1.1.1.1 2001/06/06 08:54:01 sdague Exp $ # # $Log: head,v $ # Revision 1.1.1.1 2001/06/06 08:54:01 sdague # initial import # # Revision 1.1 2001/05/14 00:49:39 sdague # added more files # # Revision 1.4 1999/03/02 17:37:26 abigail # Added __DIE__ handler. Simplified dying on illegal count arguments. # # Revision 1.3 1999/03/02 17:28:39 abigail # Provided support for reading from STDIN if no arguments are given. # # Revision 1.2 1999/02/26 18:39:59 abigail # Fixed usage message. # # Revision 1.1 1999/02/26 18:38:59 abigail # Initial revision # # use strict; use Getopt::Std; my ($VERSION) = '$Revision: 1.1.1.1 $' =~ /([.\d]+)/; END { close STDOUT || die "can't close stdout: $!\n"; $? = 1 if $? == 255; # from die } my $warnings = 0; # Print a usage message on a unknown option. # Requires my patch to Getopt::Std of 25 Feb 1999. $SIG {__WARN__} = sub { if (substr ($_ [0], 0, 14) eq "Unknown option") {die "Usage"}; require File::Basename; $0 = File::Basename::basename ($0); $warnings = 1; warn "$0: @_"; }; $SIG {__DIE__} = sub { require File::Basename; $0 = File::Basename::basename ($0); if (substr ($_ [0], 0, 5) eq "Usage") { die < ${$file eq '-' ? \'standard input' : \$file} <==\n" if @ARGV > 1; my $c = $count; while ($c -- && defined ($_ = )) {print} close FILE; } __END__ =pod =head1 NAME head -- print the first lines of a file. =head1 SYNOPSIS head [-n count] [files ...] =head1 DESCRIPTION I prints the first I lines from each file. If the I<-n> is not given, the first 10 lines will be printed. If no files are given, the first lines of standard input will be printed. =head2 OPTIONS I accepts the following options: =over 4 =item -n count Print I lines instead of the default 10. =back =head1 ENVIRONMENT The working of I is not influenced by any environment variables. =head1 BUGS I has no known bugs. =head1 STANDARDS This I implementation is compliant with the B specification, also known as B. This I implementation is compatible with the B implementation. =head1 REVISION HISTORY $Log: head,v $ Revision 1.1.1.1 2001/06/06 08:54:01 sdague initial import Revision 1.1 2001/05/14 00:49:39 sdague added more files Revision 1.4 1999/03/02 17:37:26 abigail Added __DIE__ handler. Simplified dying on illegal count arguments. Revision 1.3 1999/03/02 17:28:39 abigail Provided support for reading from STDIN if no arguments are given. Revision 1.2 1999/02/26 18:39:59 abigail Fixed usage message. Revision 1.1 1999/02/26 18:38:59 abigail Initial revision =head1 AUTHOR The Perl implementation of I was written by Abigail, I. =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