#!/usr/local/bin/perl -wT eval 'exec /usr/local/bin/perl -wT -S $0 ${1+"$@"}' if 0; # not running under some shell # # $Id: cat,v 1.1.1.1 2001/06/06 08:54:05 sdague Exp $ # # $Log: cat,v $ # Revision 1.1.1.1 2001/06/06 08:54:05 sdague # initial import # # Revision 1.1.1.1 2001/05/13 19:55:38 sdague # added initial import of PPT work # # Revision 1.1 1999/02/26 03:21:14 abigail # Initial revision # # use strict; use Getopt::Std; my ($VERSION) = '$Revision: 1.1.1.1 $' =~ /([.\d]+)/; # Get the options. # Print a usuage 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") { $0 =~ s{.*/}{}; print <) { if ($squeeze_empty) { my $is_empty = /^$/; if ($is_empty && $was_empty) { next; } $was_empty = $is_empty; } $_ = sprintf "%6d $_", ++ $count if $number_lines || $number_non_blanks && /\S/; $_ =~ s/$/\$/ if $ends; if ($nonprinting) { $_ =~ s/([\x80-\xFF])/"M-" . ("\x7F" & $1)/ge; $_ =~ s/([\x00-\x08\x0B-\x1F])/"^" . chr (0100 + ord $1)/ge; $_ =~ s/\x7F/^?/g; } if ($tabs) { $_ =~ s/\x09/^I/g; } print; } __END__ =pod =head1 NAME cat -- concatenate and print files. =head1 SYNOPSIS cat [-benstuv] [file ...] =head1 DESCRIPTION I reads and prints the files in order they are given. If no files are given, I is processed. A lone dash represents I as well. =head2 OPTIONS I accepts the following options: =over 4 =item -b Number all the non blank lines, starting at 1. =item -e Print a dollar sign (B<$>) at the end of each lines. Implies I<-v>. =item -n Number all the lines, starting at 1. =item -s The I option. Sequential empty lines are squeezed into a single empty line. =item -t Display tabs as I<^I>. Implies I<-v>. =item -u Unbuffer output. =item -v Display non-printable characters in a printable way. Characters in the range I<\000> - I<\037>, with the exception of tabs and linefeeds, are printed as I<^X>, where I is the symbol I<\0100> higher. I is printed as I<^?>. Characters whose highest bit is set are printed as I, followed by the representation of the character with the high bit stripped. =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: cat,v $ Revision 1.1.1.1 2001/06/06 08:54:05 sdague initial import Revision 1.1.1.1 2001/05/13 19:55:38 sdague added initial import of PPT work Revision 1.1 1999/02/26 03:21:14 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