Namazu-devel-ja(旧)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rtf2html 対応 filter/rtf.pl



臼田です。

Tadamasa Teranishi wrote:
> 以下の rtf2html に対応した HEAD の filter/rtf.pl の差分です。

試してみたところ私の環境ではうまく動きませんでした。
> 	my @cmd = ($rtfconvpath, @rtfconvopts, $tmpfile);
> 	my ($status, $fh_out, $fh_err) = util::systemcmd(@cmd);
としているところで
コマンドの結果が$tmpfileに入らずに標準出力に出てきます。

bash-2.05a$ diff rtf.pl_org rtf.pl
109,118c109,115
<       my @cmd = ($rtfconvpath, @rtfconvopts, $tmpfile);
<       my ($status, $fh_out, $fh_err) = util::systemcmd(@cmd);
<       my $size = util::filesize($fh_out);
<       if ($size == 0) {
<           return "Unable to convert file ($rtfconvpath error occurred).";
<       }
<       if ($size > $conf::TEXT_SIZE_MAX) {
<           return 'Too large rtf file.';
<       }
<         $$cont = util::readfile($fh_out);
---
>         my $cmd = ($rtfconvpath ." ".  $tmpfile . " |");
>         my $fh_out = "";
>         my $fh = util::efopen($cmd);
>         while (defined(my $line = <$fh>)){
>             $fh_out .= $line;
>         }
>       $$cont = $fh_out;
として確かめたら動いたのでutil::systemcmdが環境によって
異なる振るまいをしているのかもしれません

私の環境に他の原因があるのかもしれません。

臼田幸生