# This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # Changes # Makefile # README # batch-fetch-recursive.in # configure # echo x - Changes sed 's/^X//' >Changes << 'END-of-Changes' X Batch-Fetch-Recursive 改訂履歴 X X## Last modified: Sun Mar 23 08:01:09 1997 JST ## X X1.80 Mar 23 1997: is_htmlfile の中で .phtml も HTML ファイルとした. X $f\n"; X my($fetch_in_opened,$fetch_out_opened)=(0,0); X my($fetch_cmdline,$expect_header,$content_type, X $expected_size,$received_size,$make_newlist); X $expect_header=0; $content_type=""; $make_newlist=0; X $expected_size=0; X X if(($local_file_cache==0) || (! -e $f) || X &ignore_local_file_cache($u,$f)) { X $fetch_cmdline="$fetch_command "; X if($include_header_info && $u=~/^http:/i) { X $expect_header=1; X $fetch_cmdline.="$include_header_info "; X } X $fetch_cmdline.="$fetch_opt " if $fetch_opt; X $fetch_cmdline.="\'$u\' $fetch_stderr |"; X if($sleep) { X sleep $sleep unless $fetch_first_time; X $fetch_first_time=0; X } X open(FETCH_IN,$fetch_cmdline) || X die "$fetch_command $u | cannot be opened\n"; X $fetch_in_opened=1; X $make_newlist=&is_htmlfile($f); X $backup_old_file && -e $f && rename($f,$f.$tmp_rename); X open(FETCH_OUT,"> $f") || die "> $f cannot be opened\n"; X $fetch_out_opened=1; X } X elsif(&is_htmlfile($f)) { X print "## using local file $f as cache\n" if $debug; X open(FETCH_IN,$f) || die "$f cannot be opened\n"; X $fetch_in_opened=1; X $make_newlist=1; X } X else { X print "## local file $f has been kept\n" if $debug; X } X X if($fetch_in_opened && $expect_header) { X print "## checking header info of $u\n" if $debug; X $/="\n"; X while(($_=) && ($_!~/^[\r\n]*$/)) { X if($_=~/^content-type:[\s\t]*(.*)[\s\t\r\n]*$/i) { X $content_type=$1; X } X elsif($_=~/^content-length:[\s\t]*(\d+)/i) { X $expected_size=$1; X } X } X print "## content-type of $u is $content_type\n" if $debug; X $make_newlist=($content_type=~/text\/html/ ? 1 : 0) if $content_type; X } X X if($make_newlist) { X undef $/; X $_=; X $received_size=length($_); X my($modbuf,@newlist)=&extract_html_ref($_,$u,$l); X if($max_fetch_proc>1) { X open(NEWLIST,">$newlistname") || X die "$newlistname cannot be opened\n"; X for (@newlist) { X print NEWLIST "$_\n"; X } X close(NEWLIST); X } X else { X @global_newlist=@newlist; X } X if($fetch_out_opened) { X print FETCH_OUT $modbuf; X } X } X elsif($fetch_in_opened && $fetch_out_opened) { X my($l); X while($l=read(FETCH_IN,$_,1024)) { X $received_size+=$l; X print FETCH_OUT $_; X } X } X X unless($make_newlist) { X if($max_fetch_proc>1) { X open(NEWLIST,">$newlistname") || X die "$newlistname cannot be opened\n"; X close(NEWLIST); X } X else { X @global_newlist=(); X } X } X X close(FETCH_IN) if $fetch_in_opened; X X if($fetch_out_opened) { X close(FETCH_OUT); X if($backup_old_file) { X if(($received_size>0) && X ((!$check_file_size) || X (!($expected_size>0)) || X ($expected_size==$received_size))) { X -e $f.$tmp_rename && unlink($f.$tmp_rename); X } X else { X print "## failed to fetch $f\n" if $debug; X ! -e $f.$tmp_rename || X (unlink($f) && rename($f.$tmp_rename,$f)); X } X } X } X X if ($max_fetch_proc>1) { X exit 0; X } X else { X $forkcnt++; X } X } X elsif($pid>0) { X print "## chiled process $pid was forked - $u $f\n" if $debug; X $forkcnt++; X $childstat[$childid]=$pid; X } X else { X die "cannot fork\n"; X } X} X Xsub encode_url_unsafe { X my($u)=@_; X my($u1,$x); X $u1=""; X while($u) { X $x=substr($u,0,1); $u=substr($u,1); X if(index(" <>\"#%{}|\\^~[]`\@:\033",$x) >=0) { X $u1.="%"; X $u1.=sprintf("%X",ord($x)); X } X else { X $u1.=$x; X } X } X $u1; X} X Xsub extract_html_ref { X my($url,$level); X ($_,$url,$level)=@_; X my(@l,$tag,$tag1,$ref,$refgarbage,$garbage,$quote,$type,$modbuf,$end_with_lf); X @l=(); X X $modbuf=""; X $end_with_lf=1 if $_=~/\n$/; X X while($_) { X $_=~/()|$/; X $_=~/>|$/; X $modbuf.=$`.$&; X $_=$'; X next; X } X $type="F"; X $_=~/^[^>]*/; X $tag1=$&; $_=$'; X if($tag=~/ X $tag1=~/(url[\s\t\r\n]*=[\s\t\r\n]*)|$/i; X $modbuf.=$`.$&; X $ref=$'; X if($ref =~/(.*)(["\s\t\r\n].*$)/s) { X $ref=$1; X $_=$2.$_; X } X } X elsif($tag=~/= $depth; X return $ref if $ref!~/^$prefix/; X ($protocol,$server,$path)=($ref=~m#^\s*(\w+)://([\w-\.]+:?\d*)([^ \t]*)$#); X $f=$protocol."/".$server.$path; X $f=&change_filename($f); X $ref="file:".$cwd."/".$f; X return $ref; X } X if($ref=~m#^/#) { X ($protocol,$server)=($url=~m#^\s*(\w+)://([\w-\.]+:?\d*)#); X $f=$protocol."/".$server.$ref; X $f=&change_filename($f); X $ref="file:".$cwd."/".$f; X return $ref; X } X if($ref=~m#^\w+://#) { X return $ref if $level >= $depth; X return $ref if $ref!~/^$prefix/; X ($protocol,$server,$path)=($ref=~m#^\s*(\w+)://([\w-\.]+:?\d*)([^ \t]*)$#); X $f=$protocol."/".$server.$path; X $f=&change_filename($f); X $ref="file:".$cwd."/".$f; X return $ref; X } X $f=$ref; X $f=&change_filename($f); X return $f; X} X Xsub wait_fetch { X my($pid,$i,$j,$u,$f,$childid,$n,$newlistname,@newlist,$l); X X if($max_fetch_proc>1) { X $childid=-1; X while(1) { X $pid=wait; X last if $pid<0; X for($i=0;$i<$max_fetch_proc;$i++) { X if($childstat[$i] == $pid) { X print "## child process $pid ended\n" if $debug; X $forkcnt--; X $childid=$i; X $childstat[$i]=0; X last; X } X } X last if $childid >= 0; X } X } X else { X $pid=-1; X $forkcnt--; X $childid=0; X $childstat[0]=0; X } X X if($childid>=0) { X $n="newlist$childid"; X $newlistname=${$n}; X if($newlistname) { X $n="childlevel$childid"; X $l=${$n}; X if($l<$depth) { X $l++; X if($max_fetch_proc>1) { X open(NEWLIST,$newlistname) || X die "$newlistname cannot be opened\n"; X while() { X chop; X push(@newlist,($_)); X } X close(NEWLIST); X } X else { X @newlist=@global_newlist; X } X $n="sourceurl$childid"; X $u=${$n}; X &append_fetchlist($u,$l,@newlist); X } X } X if($fetchlist[0]) { X &fork_fetch(); X } X } X X return $pid; X} X Xsub clean_tmpfiles { X my($i,$n); X for($i=0;$i<$max_fetch_proc;$i++) { X $n="$tmpfile_dir/${this_pid}newlist$i"; X -f $n && unlink($n); X } X} X Xsub append_fetchlist { X my($sourceurl,$level,@flist)=@_; X my($f,$u,$h,$a,$type,$baseurl); X $baseurl=""; X foreach $f (@flist) { X ($type,$f)=split(/\t/,$f); X if($type eq "U") { X $baseurl=$f; X $baseurl=~s|/$||; X next; X } X print "## append_fetchlist: $f of $sourceurl\n" if $debug; X if($get_image || !($f=~/(\.jpe*g$)|(\.gif$)/i)) { X if($f=~/\w+:/) { X $u=$f; X } X else { X if($f=~/^\//) { X $u=($baseurl ? "$baseurl$f" : "$urlroot$f"); X } X else { X if($baseurl) { X $a=$baseurl; X } X else { X $a=$sourceurl; X $a=~s|/[^/]*$||; X } X $u="$a/$f"; X } X } X while($u=~s|/\./|/|) {} X while($u=~s|/[^/]+/\.\./|/|) {} X X if(&select_url($u)) { X $u=&change_url($u); X $h=1; X for(@history) { X if($_ eq $u) { X $h=0; X last; X } X } X if($h) { X push(@history,($u)); X print "## appending ($u, $level)\n" if $debug; X push(@fetchlist,($u,$level)); X } X } X } X } X} X Xsub mkdirhier { X my($directory)=@_; X my($prefix,@filename,$filename,$path,$renamed); X $directory || return; X X $directory=~m#^/*#; X $prefix=$&; $directory=$'; X X @filename=split(/\/+/,$directory); X while($filename=shift(@filename)) { X $path="$prefix$filename"; X $prefix="$path/"; X -d "$path" || X do { X# print "## making directory $path\n" if $debug; X $renamed=0; X if($allow_rm_and_mkdir && (-f $path)) { X print "## mkdirhier: changing file $path to directory\n" if $debug; X if($change_dir_to_file) { X $renamed=rename($path,$path.$tmp_rename); X } X unlink($path) unless $renamed; X } X mkdir($path,$mkdir_mode); X if($renamed) { X rename($path.$tmp_rename,"$path/$change_dir_to_file"); X } X while($filename=shift(@filename)) { X if("$filename" ne ".") { X $path="$path/$filename"; X mkdir($path,$mkdir_mode); X } X } X last; X } X } X X} X Xsub get_last_modified { X my($u)=@_; X my($cmd,$u_time); X $cmd="$get_header_command \'$u\' |"; X open(HEAD,$cmd) || die "$cmd cannot be opened\n"; X $/="\n"; X while() { X if(/^last-modified:[\s\t]*(.*)[\r\n]*$/i) { X $u_time=&timeexpr2time($1); X last; X } X } X close(HEAD); X ($u_time ? $u_time : time()); X} X Xsub timeexpr2time { X my($date)=@_; X my($yy,$mm,$dd,$hh,$mn,$ss,$tz,$time,@a,$i,$mmp,$timep,$x); X @a=split(/[-\s\t\r\n,]+/,$date); X $mmp=-1; $timep=-1; X for($i=0;$i<=$#a;$i++) { X $x=$a[$i]; X if($x=~/^\D+$/) { X if($mmp<0) { X $mm=index("JanFebMarAprMayJunJulAugSepOctNovDec",$x); X if($mm>=0) { X $mm/=3; $mmp=$i; X } X } X } X elsif($x=~/^(\d\d):(\d\d):(\d\d)$/) { X $hh=$1; $mn=$2; $ss=$3; $timep=$i; X } X elsif($x=~/^\d\d\d\d$/) { X $yy=$x; X } X else { X } X } X return undef unless $mmp>=0; X if($mmp>0) { X if($a[$mmp-1]=~/^\d\d*$/) { X $dd=$a[$mmp-1]; X if($a[$mmp+1]=~/^\d+$/) { X $yy=$a[$mmp+1] unless $yy; X } X } X else { X $dd=$a[$mmp+1] if $a[$mmp+1]=~/^\d+$/ X } X } X else { X $dd=$a[$mmp+1] if $a[$mmp+1]=~/^\d+$/; X } X return undef unless $yy && $mm && $dd && ($timep>=0); X $tz=$a[$timep+1]; $tz=~tr/a-z/A-Z/; X X $yy > 99 && ($yy -= 1900); X $time = &timegm($ss,$mn,$hh,$dd,$mm,$yy); X $time-=(3600*9) if $tz eq 'JST'; X # I know only JST as time zone other than GMT X $time; X} END-of-batch-fetch-recursive.in echo x - configure sed 's/^X//' >configure << 'END-of-configure' X#! /usr/local/bin/perl X# ^^^^^^^^^^^^^^^^^^^ ここは perl が動くように書き換えてください X# X## Batch-Fetch-Recursive Configuration X## Last modified: Sun Mar 23 07:48:49 1997 JST ## X X# ------------------------------------------------------------------- X# Where is your perl? X# X# perl のパスを指定する. X X$perl="/usr/local/bin/perl"; X X# ------------------------------------------------------------------- X# Which command to use to fetch a file X# X# $fetch_command には URL を指定してファイルを入手するためのコマンドに X# 何を使うかを指定する. コマンドとしては, 入手したデータを標準出力に X# 書き出すものを指定する. X# X# 私の知るかぎり, 次のようなものが使える. X# lynx を使う場合: lynx -source X# lwp-request を使う場合: lwp-request X# url_get を使う場合: url_get -b X# fetch を使う場合: fetch -q -o - X# X# $include_header_info には, ファイル本体と同時にヘッダ情報を X# 取得するためのコマンドラインオプションを指定する. X# lynx の場合: -mime_header X# ただし, lynx version 2.6, 2.7 において, X# -mime_header オプションを使うと, GIF ファイルなどを X# 取得する場合にファイルの一部が欠落する不具合が X# 確認されているので注意されたい. X# lwp-request の場合: -e X# 伊藤私家版 fetchの場合: -e X# その他の場合: "" (私の知るかぎり対応機能なし) X# X# fetch を使う場合など, コマンドの標準エラー出力を標準出力に X# マージしたい場合は $fetch_stderr="2>&1" を指定する. X X$fetch_command="lynx -source"; X$include_header_info="-mime_header"; X$fetch_stderr=""; X X# $fetch_command="fetch -q -o -"; X# $include_header_info=""; X# $fetch_stderr="2>&1"; X X# ------------------------------------------------------------------- X# Depth of the search X# X# 最初に入手されるファイルを 第 0 レベルのファイルとする. X# X# 入手した 第 (r-1) レベルのファイルのうち, HTML ファイルと判定される X# ものを調べ, その中で参照されているファイルのうち, 未入手のものを X# 入手して第 r レベルのファイルとする. X# X# このような探索の r の最大値を $depth で指定する. X X$depth=1; X X# ------------------------------------------------------------------- X# Whether or not to fetch image files X# X# イメージファイルを入手する ($get_image=1) かしない ($get_image=0) かを X# 指定する. X# X# なお, 実際にイメージファイルを入手するかどうか, 何をもって X# イメージファイルとするかは, select_utl サブルーチンの中で X# 決定される. X X$get_image=1; X X# ------------------------------------------------------------------- X# Target directory where fetched files are saved X X# 入手したファイルは, protocol://server/path という URL に X# 応じて, $targetdir で指定されたディレクトリの下に X# protocol/server/path X# として格納される. X# X# 指定されたディレクトリが存在しない場合は, 自動的に生成される. X X$targetdir="."; X X# ------------------------------------------------------------------- X# How many fetch processes run at the same time X# X# ファイルの取得は, $fetch_command で指定したコマンドを X# 子プロセスで走らせることによって行なわれるが, 最大 X# いくつまで同時に走らせるかを指定する. X# ただし, $max_fetch_proc=1 にした場合は子プロセスを X# 生成しない. X# X# Ver 1.80 未満では, $max_fetch_proc の初期値を 5 に X# していたが, 好ましくないと思うので 1 にした. X X$max_fetch_proc=1; X X# ------------------------------------------------------------------- X# Sleep before fetching the next document X# X# サーバの負荷に配慮して, ひとつのファイルの取得後, 次のファイルの X# 取得前に休眠をいれたいとき, 休眠する秒数を指定する. X X$sleep=5; X X# ------------------------------------------------------------------- X# Whether or not to print messages for debugging X# X# デバッグ用の情報を表示する ($debug=1) か表示しない ($debug=0) かを X# 指定する. X X$debug=0; X X# ------------------------------------------------------------------- X# Permissions of new directories X# X# 新しいディレクトリを作るときのモードを 10進数で指定する. X X$mkdir_mode=64*7+8*5+5; X X# ------------------------------------------------------------------- X# Whether or not to allow to make a directory after removing an exising X# file of the same name. X# X# $allow_rm_and_mkdir=1 X# mkdir を行なおうとしたときに同じ名前のファイルが既存で X# あった場合, そのファイルを削除して mkdir を行なう. X# $allow_rm_and_mkdir=0 X# mkdir を行なおうとしたときに同じ名前のファイルが既存で X# あった場合, mkdir を失敗させる. X# $change_dir_to_file X# $allow_rm_and_mkdir が真のときだけ意味を持つ. X# もとのファイルを新たに作られたディレクトリの下のファイルに X# 変更したい場合は, そのファイル名を指定する. たとえば, foo と X# いうファイルがディレクトリに変更されるときに, もとの foo を X# foo/index.html に変更させるには, X# $change_dir_to_file="index.html" X# とする. X# 単に削除するだけの場合は, $change_dir_to_file="" とする. X X$allow_rm_and_mkdir=1; X$change_dir_to_file="index.html"; X X# ------------------------------------------------------------------- X# Temporary working directory X# X# 中間作業用ファイルを書くディレクトリを指定する. X X$tmpfile_dir="/tmp"; X X# ------------------------------------------------------------------- X# Whether or not to allow to modify local links. X# X# $modify_local_links=1 X# 入手した HTML ファイルの中で が X# 設定されていたり, / で始まるファイル名が参照されたり X# している場合, 入手した HTML ファイルの内容を修正して X# ローカルな参照関係が正しくなるようにする. X# $modify_local_links=0 X# 入手した HTML ファイルの内容は修正しない. X X$modify_local_links=1; X X# ------------------------------------------------------------------- X# Whether or not to use local file cache X# X# $local_file_cache=0 X# ローカルファイルキャッシュ機能を使わない. 入手しようと X# するファイルが既存であっても新たにファイルを入手する. X# $local_file_cache=1 X# ローカルファイルキャッシュ機能を使う. 入手しようと X# するファイルが既存の場合はファイルの入手は行なわない. X# HTML ファイルであればローカルなファイルを読んで, X# そこからリンクをたどる. X# $ignore_local_file_cache X# $local_file_cache==1 の場合に, ファイルが既存であっても X# 無視してファイルの入手を行なうかどうかを判定する perl スクリプトを X# 指定する. 入手元の URL と格納先のファイル名を引数として, X# $local_file_cache を無視して入手を行なう場合は真, さもなければ X# 偽を返すサブルーチンを指定する. X# 下のサンプルでは, $get_header_command によって, 入手元 URL の X# ヘッダ情報を入手し, Last-Modified が, ローカルに存在する X# ファイルの日付より新しければ真を返すようにしている. X# $use_header_info X# ignore_local_file_cache サブルーチンの中で, URL に関する X# ヘッダ情報 (Last-Modified など) を取得して利用するか X# どうかを指定する. X# $get_header_command X# $use_header_info が真のときに, 指定された URL に関するヘッダ情報を X# 取得するためのコマンドを指定する. たとえば次のようなものが使える. X# lynx -head -dump X# lwp-request -m HEAD X# (lwp-request は CPAN から入手できる libwww-perl に付属) X# $update_dirinfo X# ignore_local_file_cache サブルーチンが, ディレクトリ情報の X# 参照の場合に真を返すようにするには $update_dirinfo=1 とする. X# 下のサンプルでは, $use_header_info の指定が優先. X X$local_file_cache=0; X X$ignore_local_file_cache=<<'END_IGNORE_LOCAL_FILE_CACHE'; X sub ignore_local_file_cache { X my($u,$f)=@_; X if($use_header_info) { X my($u_time,$f_time,@f_stat); X $u_time=&get_last_modified($u); X @f_stat=stat($f); X $f_time=$f_stat[9]; X print "## ignore_local_file_cache: u_time=$u_time, f_time=$f_time\n" if $debug; X $u_time > $f_time; X } X elsif($update_dirinfo) { X ($u=~m#/$# ? 1 : 0); # renew directory info X } X else { X 0; X } X } X 1; XEND_IGNORE_LOCAL_FILE_CACHE X X$use_header_info=1; X$get_header_command="lynx -head -dump"; X$update_dirinfo=0; X X# ------------------------------------------------------------------- X# Whether or not to assume that a file name without .extension is a X# directory name. X# X# change_url サブルーチンの中で参照されて, $dir_if_noext が X# 真のときは, 拡張子のつかないファイル名はディレクトリで X# あるとみなすことを指示する. X X$dir_if_noext=0; X X# ------------------------------------------------------------------- X# How to change a file name X# X# ローカルファイルの名前の変更規則を記述した perl スクリプトを指定する. X# X# 入手する URL protocol://server/path に対して, 格納先の X# ファイル名が protocol/server/path[/$dirinfo_file] (path が X# ディレクトリに対する参照のとき $dirinfo_file が付加される) X# と決定されて変数 $f に設定されるが, それをさらに書き直し X# たい場合は, $change_filename で書き直しの方法を指定する. X X# 下の初期設定例において, $use_encode_url_unsafe=1 を指定すると X# " <>\"#%{}|\\^~[]`\@:\033" という unsafe な文字を, "%" の X# 後に 16進数をつけた形にエンコードする. こうすることの X# 利点が明らかではないので, 初期値では $use_encode_url_unsafe=0 X# とする. X X$change_filename=<<'END_CHANGE_FILENAME'; X $use_encode_url_unsafe=0; X sub change_filename { X my($f)=@_; X my($dir); X $f=&encode_url_unsafe($f) if $use_encode_url_unsafe; X $f=~s|/~|/|; # file:/foo/~bar/xxx --> file:/foo/bar/xxx X $f=~s/\.cgi$/.cgi.html/; X $f=~m#(.*)/([^/]+)$#; X $dir=$1; X if($2=~/[&?=]/) { X # seemes to be CGI request X $cgiseq++; X $f="$dir/_cgi$cgiseq.html"; X } X $f; X } X 1; XEND_CHANGE_FILENAME X X# ------------------------------------------------------------------- X# URL selection rules X# X# URL の取捨選択規則を記述した perl スクリプトを指定する. X# 引数に指定された URL を入手対象にするときは 真, 捨てる X# ときは偽を返すサブルーチンを指定する. X X$select_url=<<'END_SELECT_URL'; X sub select_url { X my($url)=@_; X if((!$get_image) && ($f=~/(\.jpe*g$)|(\.gif$)/i)) { X print "## select_url: $url was ignored because \$get_image=$get_image\n" if $debug; X return 0; X } X if($url !~ /^$prefix/) { X print "## select_url: $url was ignored because \$prefix=$prefix\n" if $debug; X return 0; X } X 1; X } X 1; XEND_SELECT_URL X X# ------------------------------------------------------------------- X# How to change URL X# X# 取得しようとする URL を強制的に書き直す規則を記述した X# perl スクリプトを指定する. X X$change_url=<<'END_CHANGE_URL'; X sub change_url { X my($url)=@_; X if($dir_if_noext) { X #It is very likely that a file name without .extension is a directory. X $url="$url/" if $url=~m#/[-\w]+$#; X } X $url; X } X 1; XEND_CHANGE_URL X X# ------------------------------------------------------------------- X# How to tell a file is an HTML file X# X# ファイル名を見て, それが HTML ファイルであるかどうかを X# 判定する perl スクリプトを指定する. X X$is_htmlfile=<<'END_IS_HTMLFILE'; X sub is_htmlfile { X my($f)=@_; X ($force_html ? X ($f!~/(\.txt$)|(\.jpe*g$)|(\.gif$)/i) : X ($f=~/\.[ps]*html*$/i ? 1 : 0)); X } X 1; XEND_IS_HTMLFILE X X# ------------------------------------------------------------------- X# Whether or not to consider all files to be HTML files X# X# ファイル名によらず, すべてのファイルが HTML ファイルである X# ものとみなすかどうかのオプションを指定する. X X$force_html=1; X X# ------------------------------------------------------------------- X# Special character string for temporarily renaming a file X# X# 作業の都合で既存ファイルを一時的に別の名前に変更することが X# ある. そのとき, ファイル名に付加する文字列を指定する. X X$tmp_rename='\x19'; X X# ------------------------------------------------------------------- X# Whether or not to take a backup copy of an existing file before X# fetching a new one X# X# ファイルを取得する前に, 既存のファイルのバックアップを X# とって, 取得に失敗したらもとのファイルを復元するかどうかを指定する. X X$backup_old_file=1; X X# ------------------------------------------------------------------- X# Whether or not to check the size of the fetched file X# X# 取得されたファイルのサイズを, ヘッダ情報の Content-Length の X# 値と比較して不一致の場合は取得に失敗したとみなすかどうかを指定する. X# $include_header_info が指定されていて, ヘッダに Content-Length が X# 含まれていた場合のみ有効である. X# X# なお, サイズの不一致によって取得失敗とみなされた場合であっても, X# $backup_old_file が真でない限りは何も回復処理は行なわない. X X$check_file_size=1; X X# ------------------------------------------------------------------- X# File name for directory information X# X# URL がディレクトリを指している場合に, 得られたディレクトリ X# 情報を格納するファイル名を指定する. X X$dirinfo_file="index.html"; X X# ------------------------------------------------------------------- X# end of configuration parameters X X$init=<<'END_INIT'; X$fetch_command="?FETCH_COMMAND"; X$fetch_stderr="?FETCH_STDERR"; X$include_header_info="?INCLUDE_HEADER_INFO"; X$depth=?DEPTH; X$get_image=?GET_IMAGE; X$targetdir="?TARGETDIR"; X$max_fetch_proc=?MAX_FETCH_PROC; X$sleep=?SLEEP; X$debug=?DEBUG; X$mkdir_mode=?MKDIR_MODE; X$allow_rm_and_mkdir=?ALLOW_RM_AND_MKDIR; X$tmpfile_dir="?TMPFILE_DIR"; X$modify_local_links=?MODIFY_LOCAL_LINKS; X$local_file_cache=?LOCAL_FILE_CACHE; X$ignore_local_file_cache=<<'END_IGNORE_LOCAL_FILE_CACHE'; X?IGNORE_LOCAL_FILE_CACHE XEND_IGNORE_LOCAL_FILE_CACHE X$use_header_info=?USE_HEADER_INFO; X$get_header_command="?GET_HEADER_COMMAND"; X$update_dirinfo=?UPDATE_DIRINFO; X$dir_if_noext=?DIR_IF_NOEXT; X$change_filename=<<'END_CHANGE_FILENAME'; X?CHANGE_FILENAME XEND_CHANGE_FILENAME X$select_url=<<'END_SELECT_URL'; X?SELECT_URL XEND_SELECT_URL X$change_url=<<'END_CHANGE_URL'; X?CHANGE_URL XEND_CHANGE_URL X$is_htmlfile=<<'END_IS_HTMLFILE'; X?IS_HTMLFILE XEND_IS_HTMLFILE X$force_html=?FORCE_HTML; X$change_dir_to_file="?CHANGE_DIR_TO_FILE"; X$tmp_rename="?TMP_RENAME"; X$backup_old_file=?BACKUP_OLD_FILE; X$check_file_size=?CHECK_FILE_SIZE; X$dirinfo_file="?DIRINFO_FILE"; XEND_INIT X Xwhile(<>) { X X s/\?PERL/$perl/g; X s/\?INIT/$init/g; X X s/\?FETCH_COMMAND/$fetch_command/g; X s/\?FETCH_STDERR/$fetch_stderr/g; X s/\?INCLUDE_HEADER_INFO/$include_header_info/g; X s/\?DEPTH/$depth/g; X s/\?GET_IMAGE/$get_image/g; X s/\?TARGETDIR/$targetdir/g; X s/\?MAX_FETCH_PROC/$max_fetch_proc/g; X s/\?SLEEP/$sleep/g; X s/\?DEBUG/$debug/g; X s/\?MKDIR_MODE/$mkdir_mode/g; X s/\?ALLOW_RM_AND_MKDIR/$allow_rm_and_mkdir/g; X s/\?TMPFILE_DIR/$tmpfile_dir/g; X s/\?MODIFY_LOCAL_LINKS/$modify_local_links/g; X s/\?LOCAL_FILE_CACHE/$local_file_cache/g; X s/\?IGNORE_LOCAL_FILE_CACHE/$ignore_local_file_cache/g; X s/\?USE_HEADER_INFO/$use_header_info/g; X s/\?GET_HEADER_COMMAND/$get_header_command/g; X s/\?UPDATE_DIRINFO/$update_dirinfo/g; X s/\?DIR_IF_NOEXT/$dir_if_noext/g; X s/\?CHANGE_FILENAME/$change_filename/g; X s/\?SELECT_URL/$select_url/g; X s/\?CHANGE_URL/$change_url/g; X s/\?IS_HTMLFILE/$is_htmlfile/g; X s/\?FORCE_HTML/$force_html/g; X s/\?CHANGE_DIR_TO_FILE/$change_dir_to_file/g; X s/\?TMP_RENAME/$tmp_rename/g; X s/\?BACKUP_OLD_FILE/$backup_old_file/g; X s/\?CHECK_FILE_SIZE/$check_file_size/g; X s/\?DIRINFO_FILE/$dirinfo_file/g; X X print $_; X} END-of-configure exit