
_SUB READINI // [-f filename[=%READINI_STORE%]]  [-ret UsrRetName] TAG NAME  [DEF_VAL]
   SET &I=1
   FIND $%~1=-f, TEAM CALC #&I=%&I%+2| SET &READINI_STORE=%~2
   MSTR &&V,&&Vi=<~%I%*>%*
   SET &RetName=
   FIND $%&&V%=-ret, TEAM CALC #&I=%&I%+2| SET RetName=%&Vi%
   FIND $%&READINI_STORE%=,EXIT _SUB //²خت‎´يخَ
   SET &V=
   MSTR &&TAG,&&NM,&&V=<~%&I%*>%*
   FIND $[ '%&&TAG%'='' | ''='%&&NM%' ], EXIT _SUB   //²خت‎´يخَ
   FIND $%&RetName%=, SET RetName=%&NM%
   STRL &len=%NM%=
   CALC #&&off=%&len%+1
   SET &fnd=0
   READ  %&READINI_STORE%,*,&&VS
   FORX *NL &&VS,&&Vi,
   {
       @FIND $%&Vi%=[%&TAG%], TEAM SET fnd=1| EXIT -
       @MSTR * &&c1=1,1,&Vi
       @FIND $%&&c1%=[,  TEAM SET fnd=0| EXIT -
       @MSTR * &&c1=1,%&len%,&Vi
       @IFEX #[ %&fnd%=1 & '%&&c1%'='%&NM%=' ],TEAM SET fnd=2| MSTR &V=%&off%,0,%&Vi%| EXIT FORX
   }
   ENVI-ret %&RetName%=%&&V%
_END


SET &V=error
READINI -f A.INI -ret &&V   setup name  "(null)"
MESS. [setup]:name=[%&&V%]

SET &name=error
READINI -f A.INI setup name  "(null)"
MESS. [setup]:name=[%name%]


SET &title=error
@TEAM SET &READINI_STORE=A.INI
READINI setup title  "(null)"
MESS. [setup]:title=[%title%]

SET &V=error
READINI -ret &&V setup title  "(null)"
MESS. [setup]:title=[%&&V%]

