      function ccall.getstr(ptr, maxlen)
*
*
*
*
*
*
*
*
*
$catalog local
*
$include ccall.common
*
      equate libname to 'libc.so.6'
      equate fnname  to 'strncpy'

      $include ccall.getfn.include

      s1 = str(CC$NUL,maxlen+1)
      s2 = CC$FN.PUSHOFF : cc$0 :              ~
           CC$FN.PUSHVAL : ptr :               ~
           CC$FN.PUSHVAL : int2bin(maxlen,4) : ~
           CC$FN.CALLFN : fn.handle :          ~
           CC$FN.EXIT
      res = field(ccall(s1,s2),CC$NUL,1)

      return(res)
   end
