Author: dfiser Date: Wed Sep 12 13:50:09 2007 New Revision: 40869 URL: http://svn.opensuse.org/viewcvs/yast?rev=40869&view=rev Log: Added support for reading from stdin to showy2log script. 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=40869&r1=40868&r2=40869&view=diff ============================================================================== --- trunk/devtools/devtools/bin/showy2log (original) +++ trunk/devtools/devtools/bin/showy2log Wed Sep 12 13:50:09 2007 @@ -130,7 +130,8 @@ By default $default_file is processed, unless you're not root and ~/.y2log exists. - -f FILE use FILE as y2log file + -f FILE use FILE as y2log file, if FILE equals to '-' script reads + the log from stdin Filter options: Those options allow to select which message lines are actually printed @@ -240,7 +241,7 @@ $indent = "a" } -if ( ! -r "$file" ) { +if ( ! -r "$file" and "$file" ne "-") { die "Can't read file '$file'"; } @@ -670,14 +671,18 @@ # main # ######################################################################## -my $command = ""; -if ( $#ARGV != -1 ) { - $command .= "$_ " foreach (@ARGV); -} else { - $command = "cat "; +if ("$file" ne "-"){ + my $command = ""; + if ( $#ARGV != -1 ) { + $command .= "$_ " foreach (@ARGV); + } else { + $command = "cat "; + } + open(FILE, "$command '$file'|"); +}else{ + open(FILE, "-"); } -open(FILE, "$command '$file'|"); binmode(FILE, ":utf8"); showlog(); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org