From b791cba788d185fc861a56cd849ebd4a56d350c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Feb 2014 19:59:33 +0100 Subject: [PATCH] Fix: #496 tools scripts should print warnings and errors to STDERR --- tools/awstats_buildstaticpages.pl | 12 ++---------- tools/awstats_configure.pl | 2 +- tools/awstats_exportlib.pl | 4 ++-- tools/awstats_updateall.pl | 2 +- tools/logresolvemerge.pl | 4 ++-- tools/maillogconvert.pl | 2 +- 6 files changed, 9 insertions(+), 17 deletions(-) diff --git a/tools/awstats_buildstaticpages.pl b/tools/awstats_buildstaticpages.pl index 82f4f268..9bae87f7 100755 --- a/tools/awstats_buildstaticpages.pl +++ b/tools/awstats_buildstaticpages.pl @@ -79,7 +79,7 @@ $nowsec $nowmin $nowhour $nowday $nowmonth $nowyear $nowwday $nowyday $nowns # Return: None #------------------------------------------------------------------------------ sub error { - print "Error: $_[0].\n"; + print STDERR "Error: $_[0].\n"; exit 1; } @@ -93,15 +93,7 @@ sub error { sub warning { my $messagestring=shift; debug("$messagestring",1); -# if ($WarningMessages) { -# if ($HTMLOutput) { -# $messagestring =~ s/\n/\
/g; -# print "$messagestring
\n"; -# } -# else { - print "$messagestring\n"; -# } -# } + print STDERR "$messagestring\n"; } #------------------------------------------------------------------------------ diff --git a/tools/awstats_configure.pl b/tools/awstats_configure.pl index 6dc1660d..d1fe7a90 100755 --- a/tools/awstats_configure.pl +++ b/tools/awstats_configure.pl @@ -87,7 +87,7 @@ $Step=0; # error #------------------------------------------------------- sub error { - print "Error: $_[0].\n"; + print STDERR "Error: $_[0].\n"; exit 1; } diff --git a/tools/awstats_exportlib.pl b/tools/awstats_exportlib.pl index 40a4fb20..0dc4a814 100755 --- a/tools/awstats_exportlib.pl +++ b/tools/awstats_exportlib.pl @@ -92,8 +92,8 @@ sub error { my $thirdmessage=shift||""; my $donotshowsetupinfo=shift||0; if ($Debug) { debug("$message $secondmessage $thirdmessage",1); } - print "$message"; - print "\n"; + print STDERR "$message"; + print STDERR "\n"; exit 1; } diff --git a/tools/awstats_updateall.pl b/tools/awstats_updateall.pl index 07ec4c1f..55c10c37 100755 --- a/tools/awstats_updateall.pl +++ b/tools/awstats_updateall.pl @@ -36,7 +36,7 @@ my $LastLine=''; # Return: None #------------------------------------------------------------------------------ sub error { - print "Error: $_[0].\n"; + print STDERR "Error: $_[0].\n"; exit 1; } diff --git a/tools/logresolvemerge.pl b/tools/logresolvemerge.pl index 39cd068d..fec6fda2 100755 --- a/tools/logresolvemerge.pl +++ b/tools/logresolvemerge.pl @@ -130,7 +130,7 @@ sub addDirectory { # Return: None #------------------------------------------------------------------------------ sub error { - print "Error: $_[0].\n"; + print STDERR "Error: $_[0].\n"; exit 1; } @@ -159,7 +159,7 @@ sub debug { sub warning { my $messagestring=shift; if ($Debug) { debug("$messagestring",1); } - print "$messagestring\n"; + print STDERR "$messagestring\n"; } #----------------------------------------------------------------------------- diff --git a/tools/maillogconvert.pl b/tools/maillogconvert.pl index 5ab463c1..b0cf7aeb 100755 --- a/tools/maillogconvert.pl +++ b/tools/maillogconvert.pl @@ -56,7 +56,7 @@ $MailType=''; # Mail server family (postfix, sendmail, qmail) #------------------------------------------------------- sub error { - print "Error: $_[0].\n"; + print STDERR "Error: $_[0].\n"; exit 1; } -- 2.47.2