X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fblhc;h=cbd5697118e915958bc7ddb30b052531dd522ebe;hb=28d1ed15ddda3a3cb2f3be7cfccad06b5229ad6c;hp=465ce0fc04d4708fd5fbdab00f5aed68206a6d3c;hpb=46cd48288d8300d525282dc31926108f264ee985;p=blhc%2Fblhc.git diff --git a/bin/blhc b/bin/blhc index 465ce0f..cbd5697 100755 --- a/bin/blhc +++ b/bin/blhc @@ -154,6 +154,9 @@ my %flag_renames = ( '-Wl,(-z,)?now' => '-Wl,-z,now', ); +# Use colored (ANSI) output? +my $option_color; + # FUNCTIONS @@ -189,8 +192,7 @@ sub error_hardening_wrapper { sub error_color { my ($message, $color) = @_; - # Use colors when writing to a terminal. - if (-t STDOUT) { + if ($option_color) { return Term::ANSIColor::colored($message, $color); } else { return $message; @@ -300,6 +302,7 @@ my $option_version = 0; my $option_all = 0; my $option_arch = undef; my $option_buildd = 0; + $option_color = 0; if (not Getopt::Long::GetOptions( 'help|h|?' => \$option_help, 'version' => \$option_version, @@ -308,6 +311,7 @@ if (not Getopt::Long::GetOptions( 'bindnow' => \$harden_bindnow, 'all' => \$option_all, # Misc. + 'color' => \$option_color, 'arch' => \$option_arch, 'buildd' => \$option_buildd, )) { @@ -612,9 +616,7 @@ blhc - build log hardening check, checks build logs for missing hardening flags =head1 SYNOPSIS -B [-h -? --help] - -B [--pie] [--bindnow] [--all] +B [options] --help available options --version version number and license @@ -623,6 +625,7 @@ B [--pie] [--bindnow] [--all] --all force +all (+pie, +bindnow) check --arch set architecture (autodetected) --buildd parser mode for buildds + --color use colored output =head1 DESCRIPTION @@ -674,6 +677,10 @@ detected). =back +=item B<--color> + +Use colored (ANSI) output for warning messages. + =back Auto detection for B<--pie> and B<--bindnow> only works if at least one