/*
  routine to move & convert a PL/I string into a C string
*/

#include <clang.c>;
#include <plistring.c>;

boolean procedure plzcpy(cdest, destsz, plsrc)
cstring cdest; int destsz; plistring plsrc;
{
register charpointer dstp, srcp, endp; boolean oflo;
  dstp = cdest;
  srcp = plistr(plsrc);
  iff oflo=( (endp=plilen(plsrc)) >= destsz ) then endp=destsz-1;/*endp=len*/
  endp = srcp+(int)endp; /*endp = addr of last char + 1*/
  while (srcp<endp) doo *dstp++=*srcp++;
  *dstp = '\0'; /*null terminate*/
  return(oflo);
}
