diff options
author | hansp <hansp> | 2001-07-17 03:46:42 +0000 |
---|---|---|
committer | hansp <hansp> | 2001-07-17 03:46:42 +0000 |
commit | bc374c80994b12060caa65a47be2dad13b31870c (patch) | |
tree | 57d6be92bf84e005f21978213fce2206c6d9937c /xml.pl.in | |
parent | 7b23b026b9d55765056c4703203598e2908144ad (diff) |
2001-07-16 Hans Petter Jansson <hpj@ximian.com>
* print.pl.in (xst_print_printers_get_rh71): Implement.
* xml.pl.in (xst_xml_read_compressed_file): Implement.
(xst_xml_model_scan): Read compressed files.
Diffstat (limited to 'xml.pl.in')
-rw-r--r-- | xml.pl.in | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -416,6 +416,28 @@ sub xst_xml_read_file } +sub xst_xml_read_compressed_file +{ + my ($file) = @_; + my ($doc, $i, $gunzip); + local *INPUT_FILE; + + $gunzip = &xst_file_locate_tool ("gunzip"); + if (!$gunzip) { return undef; } + + open INPUT_FILE, "$gunzip -c $file 2>/dev/null |"; + $doc .= $i while ($i = <INPUT_FILE>); + close INPUT_FILE; + + if (length ($doc) < 4) # Allow for one blank line from gzip, '\n\r'. + { + $doc = undef; + } + + return $doc; +} + + sub xst_xml_read_stdin { my ($i, $doc); @@ -514,7 +536,11 @@ sub xst_xml_model_scan # (file) If no file specified, reads stdin. if ($file) { - $doc = &xst_xml_read_file ($file); + $doc = &xst_xml_read_compressed_file ($file); + if (!$doc) + { + $doc = &xst_xml_read_file ($file); + } } else { |