]> git.donarmstrong.com Git - debbugs.git/blob - t/sendmail_tester
include function in instalsql for bin ver/src pkg linking
[debbugs.git] / t / sendmail_tester
1 #!/usr/bin/perl
2
3 # All this script does is write whatever is piped to it to a unique
4 # filename, with the first line containing the arguments sent.
5
6 use IO::File;
7
8 # create a unique filename
9 if (not -d $ENV{SENDMAIL_TESTDIR}) {
10      system('mkdir','-p',$ENV{SENDMAIL_TESTDIR});
11 }
12
13 my $fn = "$ENV{SENDMAIL_TESTDIR}/".time.$$;
14
15 my $fh = IO::File->new($fn ,'w') or die "Unable to open file $fn for writing: $!";
16
17 print {$fh} "$0 called with: ", join(' ',map {"'$_'"} @ARGV) or die "Unable to write to file $fn: $!";
18 print {$fh} "\n\n";
19 print {$fh} <STDIN> or die "Unable to write to file $fn: $!";
20
21 close $fh or die "Unable to close file $fn: $!";