File: external-program

package info (click to toggle)
sagan 1.2.0-1.2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 6,604 kB
  • sloc: ansic: 21,146; sh: 4,499; asm: 1,002; perl: 282; makefile: 144
file content (32 lines) | stat: -rwxr-xr-x 667 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl

##############################################################################
# This is a exmaple program to test the "external" output format with.  This
# routine simply writes our a lot file of what it has received. 
#
# Champ Clark III
# 08/05/2015
##############################################################################

my $filename = "/tmp/myprogram.$$"; 


$SIG{'INT'} = \&signal_handler;
$SIG{'TERM'} = \&signal_handler;
$SIG{'HUP'} = \&signal_handler;

open(MYFILE, ">> $filename") || die "Cannot open $filename!\n"; 

while (<>) {
    print MYFILE $_;
}

close(MYFILE); 
exit(0);


sub signal_handler {
close(MYFILE); 
exit(0);
}