#! /usr/bin/perl -w

$debug=0;
$dir="/usr/local/fontine/var";
$ttf="ttf";
$font1="HGRHR4.TTC";
$font2="HGRHG5.TTC";
$font3="HGRHR8.TTC";
$font4="HGHANGLE.TTF";
$font5="HGPAGLT1.TTF";
$font6="DFFANGS.TTF";
$font7="DFHEI5.TTF";
$font8="DFKAI5.TTF";
$font9="DFSONG.TTF";

print $dir."\n" if $debug;

chdir($dir);
@files=glob("*");
foreach $file (@files) {
  if (-d $file && $file eq $ttf) {
    chdir($ttf);
    @files2=glob("*");
    foreach $file2 (@files2) {
      if (-f $file2 &&
        ($file2 eq $font1) ||
        ($file2 eq $font2) ||
        ($file2 eq $font3) ||
        ($file2 eq $font4) ||
        ($file2 eq $font5) ||
        ($file2 eq $font6) ||
        ($file2 eq $font7) ||
        ($file2 eq $font8) ||
        ($file2 eq $font9)) {
        #nop
      }
      else {
        $com1="rm -rf $file2";
        print $com1."\n" if $debug;
        system($com1);
      }
    }
    chdir("..");
  }
  else {
    $com2="rm -rf $file";
    print $com2."\n" if $debug;
    system($com2);
  }
}

$file_1="/usr/local/sony/lib/sj3/dict/user/root/private.dic";
$file_2="/usr/local/sony/lib/sj3/dict/user/root/study.dat";

print $file_1."\n" if $debug;
print $file_2."\n" if $debug;

if (-f $file_1) {
  $com3="rm -rf $file_1";
  system($com3); 
}
if (-f $file_2) {
  $com4="rm -rf $file_2";
  system($com4); 
}
$file_3="/usr/local/lib/wnn/ja_JP/dic/usr";
$file_4="/usr/local/lib/wnn/zh_CN/dic/usr";
$file_5="/usr/local/lib/wnn/zh_TW/dic/usr";
$file_6="/usr/local/lib/wnn/ko_KR/dic/usr";

if (-d $file_3) {
  $com5="rm -rf $file_3";
  print $com5."\n" if $debug;
  system($com5); 
}
if (-d $file_4) {
  $com6="rm -rf $file_4";
  print $com6."\n" if $debug;
  system($com6); 
}
if (-d $file_5) {
  $com7="rm -rf $file_5";
  print $com7."\n" if $debug;
  system($com7); 
}
if (-d $file_6) {
  $com8="rm -rf $file_6";
  print $com8."\n" if $debug;
  system($com8); 
}
