#!/usr/bin/perl
#
# This script is in public domain.
#
# xjdoc のファイルから ^H を使った重ね打ちを除去する。
#                              2000.3.4 NAKANO Takeo.
#
$DOCROOT = "xjdoc-0.5-out/";
$WWWROOT = "xjdoc";

open DL, "find $DOCROOT -type d |";
while (<DL>){
    chomp;
    $_ =~ s/$DOCROOT/$WWWROOT\//;
    system "mkdir -p $_";
}
close DL;

open FL, "find $DOCROOT -type f |";
while (<FL>){
    chomp;
    open IN, $_;
    $_ =~ s/$DOCROOT/$WWWROOT\//;
    open OUT, "> $_";

    while (<IN>){
	$_ =~ s/..\cH\cH//g;
	$_ =~ s/.\cH//g;
	print OUT;
    }
    close IN;
    close OUT;
}
close FL;

