Author: odabrunz Date: Tue Aug 7 17:05:19 2007 New Revision: 40064 URL: http://svn.opensuse.org/viewcvs/yast?rev=40064&view=rev Log: - changes for showylog: - fixed --version output: show revision, date, time but no extra line - print extra line / line finisher with color reset only when normal output was printed Modified: trunk/devtools/devtools/bin/showy2log Modified: trunk/devtools/devtools/bin/showy2log URL: http://svn.opensuse.org/viewcvs/yast/trunk/devtools/devtools/bin/showy2log?rev=40064&r1=40063&r2=40064&view=diff ============================================================================== --- trunk/devtools/devtools/bin/showy2log (original) +++ trunk/devtools/devtools/bin/showy2log Tue Aug 7 17:05:19 2007 @@ -25,6 +25,9 @@ $0 =~ m/([^\/]*)$/; my $progname = $1; +# set to 1 when normal output was printed, so we can reset the color on exit +my $output_printed = 0; + # set up $stdout, $stderr and the current output filehandle $outfh open my $stdout, ">&STDOUT"; open my $stderr, ">&STDERR"; @@ -40,7 +43,7 @@ my $vcs_id = '$Id$'; my $vcs_date = '$Date$'; -$vcs_id =~ /^\$[[:alpha:]]+: [^ ]+ ([^ ]+ [^ ]+ [^ ]+) [^ ]+ [^ ]+ \$$/; +$vcs_id =~ /^\$[[:alpha:]]+: [^ ]+ ([^ ]+ [^ ]+ [^ ]+) [^ ]+.*$/; my $version = $1; # defaults for program variables that need to be printed in the usage message @@ -86,7 +89,11 @@ # on exit/interrupt, make sure we finish the current output line by resetting # to normal colors -END { printf($outfh "%s", "$normal" . "\n"); } +END { + if (defined($output_printed) and $output_printed) { + printf($outfh "%s", "$normal" . "\n"); + } +} # Usage message sub version { @@ -470,6 +477,8 @@ my ($text, $prefix) = @_; $prefix = $prefix || ""; + $output_printed = 1; + if ( ! $line_started ) { printf($outfh "%s%s", ( $level <= $maxlevel ? $color[$level.$bold] : $whiteback . $color[$milestone.$bold] ), $prefix); $line_started = 1; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org