int len = CHAR_STRING (ch, work, str); \
if (dst + len <= (dst_bytes ? dst_end : src)) \
{ \
- bcopy (str, dst, len); \
- dst += len; \
+ while (len--) *dst++ = *str++; \
} \
else \
CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \
if (ic >= ccl->eof_ic)
ic = CCL_HEADER_MAIN;
+ if (ccl->buf_magnification ==0) /* We can't produce any bytes. */
+ dst = NULL;
+
#ifdef CCL_DEBUG
ccl_backtrace_idx = 0;
#endif
char msg[256];
int msglen;
+ if (!dst)
+ dst = destination;
+
switch (ccl->status)
{
case CCL_STAT_INVALID_CMD:
int j;
msglen = strlen (msg);
- if (dst + msglen <= dst_end)
+ if (dst + msglen <= (dst_bytes ? dst_end : src))
{
bcopy (msg, dst, msglen);
dst += msglen;
break;
sprintf(msg, " %d", ccl_backtrace_table[i]);
msglen = strlen (msg);
- if (dst + msglen > dst_end)
+ if (dst + msglen > (dst_bytes ? dst_end : src))
break;
bcopy (msg, dst, msglen);
dst += msglen;
}
+ goto ccl_finish;
}
#endif
- goto ccl_finish;
+ break;
case CCL_STAT_QUIT:
sprintf(msg, "\nCCL: Quited.");
}
msglen = strlen (msg);
- if (dst + msglen <= dst_end)
+ if (dst + msglen <= (dst_bytes ? dst_end : src))
{
bcopy (msg, dst, msglen);
dst += msglen;
ccl_finish:
ccl->ic = ic;
if (consumed) *consumed = src - source;
- return dst - destination;
+ return (dst ? dst - destination : 0);
}
/* Setup fields of the structure pointed by CCL appropriately for the