home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / ONLINE / SREFPRC1 / HOMEDIR.SRF < prev    next >
Text File  |  1996-12-14  |  780b  |  28 lines

  1. /* Do HOME_DIR for ~substitution, with $ replacement too */
  2.  
  3. sref_homedir:
  4.  
  5. parse arg asel,homedir
  6.  
  7. if pos('~',asel)=0 then return asel  /* trivial case */
  8.  
  9. if pos('$',homedir)>0 then do   /* $ mode */
  10.    parse var asel a1 '~' a2 '/' a3    /* break asel into pre, ~, and post compomnents */
  11.    if a3<>"" then a3='/'||a3
  12. /* replace $ with this stuff (might mean removal with no replacement)*/
  13.    homedir2=strip(sref_replacestrg(homedir,'$',a2,'ALL'))
  14. end
  15. else do                 /* standard mode */
  16.    parse var asel a1 '~' a3
  17.    homedir2=strip(homedir)
  18. end
  19.  
  20. /* check for // */
  21. if right(a1,1)='/' then homedir2=strip(homedir2,'l','/')
  22. if left(a3,1)='/' then homedir2=strip(homedir2,'t','/')
  23. afoo=a1||homedir2
  24. if a3<>' ' then afoo=afoo||a3
  25.  
  26. return afoo
  27.  
  28.