i have a little problem with this code

Code:
      while ($bfind(&buffer,1,10)) {
        set %pos $ifmatch
        if (%pos == 1) {
          bset &binvar $calc($bvar(&binvar,0) + 1) 13 10
          bcopy -cz &binvar $calc($bvar(&binvar,0) + 1) &buffer 2 -1
        }
        else {
          bcopy -cz &binvar $calc($bvar(&binvar,0) + 1) &buffer 1 -1
          bset &binvar $calc($bvar(&binvar,0) + 1) 13 10
        }
        bcopy -cz &buffer 1 &buffer $calc(%pos + 1) -1
      }
      bcopy &buffer 1 &binvar 1 -1


it should replace all LF code with CRLF but it does not work like it should be. have someone an idea how i can resolve it?


Charlie