#!/bin/sh

echo "yes" > tmp@
texmfcnffile=`kpsexpand -w cnf texmf.cnf`
TEXMFCNF=`
gawk  '
{texmfcnfloc=index(texmfcnffile,"/texmf.cnf")
 print substr(texmfcnffile,1,texmfcnfloc-1)
}' texmfcnffile=$texmfcnffile tmp@ `

echo $TEXMFCNF > tmp@
TEXMF=`
gawk '
{
  inline=$0
  gsub(/web2c/,"",inline)
  inline=substr(inline,1,length(inline)-1)
  print inline
}' tmp@ `

#echo $TEXMF

 if test ! "$LOGNAME" = "root"; then
    Hdir="/home/$LOGNAME"
 else
    Hdir="/root"
 fi
 
  if test ! -d $Hdir/.config/xm1; then
     mkdir $Hdir/.config/xm1
  fi
   
  if test -s $Hdir/.config/xm1/texmaker.ini; then
     chitexstr=`grep "chitex" $Hdir/.config/xm1/texmaker.ini`
  fi

  if test "$chitexstr" = ""; then
     cp $TEXMF/tex/chinese/texmaker.ini $Hdir/.config/xm1
  fi   

  texmaker.bin $*
  
  