-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreverse.pl
More file actions
executable file
·49 lines (37 loc) · 854 Bytes
/
reverse.pl
File metadata and controls
executable file
·49 lines (37 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/local/bin/perl5 -w
#
# $Header$
#
# "/home/red/bin/reverse.pl" created by red
#
# $Log$
use strict;
use subs qw(handler);
use POSIX qw(strftime);
my($entry, $index, @stack);
my ($Rev, $RunDate, $DirName, $ProgName);
$RunDate = strftime '%Y/%m/%d %H:%M:%S', localtime;
$Rev = (split(' ', '$Revision: 2 $', 3))[1];
$0 =~ m!(.*)/!; $ProgName = $'; $DirName = $1; $DirName = '.' unless $DirName;
$SIG{'HUP'} = \&handler;
$SIG{'INT'} = \&handler;
$SIG{'QUIT'} = \&handler;
$SIG{'TERM'} = \&handler;
sub handler
{
my($sig) = @_;
warn "$ProgName:INFO: Caught a SIG$sig -- shutting down\n";
# close OUT;
# `rm -f $tmpfile`;
exit(0);
}
#print "# $ProgName $Rev\t\t$RunDate\n\n";
@stack=();
while (<>) {
chop;
push @stack, $_;
}
for ($index = $#stack; $index>=0; --$index){
print "$stack[$index]\n";
}
__END__