From: imiyazaki Date: Mon, 20 Oct 2003 16:10:56 +0000 (+0000) Subject: use flock. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=4b136b20c419d17b84c76aa9f316dca8d5b6c1ac;p=chise%2Fomega.git use flock. set default omega directory to /usr/local/lib/chise/omega. --- diff --git a/chise2otf/chise2otf b/chise2otf/chise2otf index 524af71..17ee581 100755 --- a/chise2otf/chise2otf +++ b/chise2otf/chise2otf @@ -14,10 +14,13 @@ use vars qw($opt_in_cs $opt_order $opt_kage $opt_replace ); use Getopt::Long; use utf8; +use Fcntl ':flock'; use Chise_utils ':all'; -my $perl="/usr/bin/perl"; -my $makefonts="/Users/izumi/.chise/makefonts.pl"; +my $omegadb_path="/usr/local/lib/chise/omega"; +$omegadb_path=~s!/$!!; + +my $makefonts="$omegadb_path/makefonts.pl"; my $exec_makefonts=0; my $geta=pack("S",8750|0x8080); @@ -118,12 +121,23 @@ if($opt_replace){ $texmacro[0x1E5D]='{\ifmmode \ucirc{\bar{r}}\else \ucirc{\={r}}\fi}'; } -$idsdata_file="idsdata.pl"; +$idsdata_file="$omegadb_path/idsdata.pl"; $ids_start=0x00; $font_start=0; if(-e $idsdata_file){ - require $idsdata_file; + open(IDSDATA,"+<$idsdata_file") or die; + flock(IDSDATA,LOCK_EX); + seek(IDSDATA,0,0); + while(){ + eval $_; + } + seek(IDSDATA,0,0); +# require $idsdata_file; +}else{ + open(IDSDATA,">$idsdata_file") or die; + flock(IDSDATA,LOCK_EX); + seek(IDSDATA,0,0); } $ids_argc=0; @@ -190,7 +204,6 @@ while(<>){ } } -open(IDSDATA,">$idsdata_file") or die; print IDSDATA 'use utf8;',"\n"; foreach $ids (keys %ids){ print IDSDATA '$ids{\'',$ids,'\'}=' @@ -204,7 +217,7 @@ print IDSDATA "1;"; if($exec_makefonts){ if(-f $makefonts){ - system($perl,$makefonts) ==0 + system("/usr/bin/env","perl",$makefonts) ==0 or die "Could not make fonts: $?"; }else{ print STDERR "cannot find $makefonts\n";