<p><pre><code>  &#x2F;&#x2F; This code is licensed under CC0.
  &#x2F;&#x2F; A copy of the license can be obtained at https:&#x2F;&#x2F;creativecommons.org&#x2F;publicdomain&#x2F;zero&#x2F;1.0&#x2F;
  &#x2F;&#x2F; May you forever catenate in peace.
  #define strncatm(dest, sz, ...) strncat_multi((dest), (sz), __VA_ARGS__, NULL);
  char* strncat_multi(char *dest, size_t dest_sz, ...) {
    va_list srcs;
    char *dest_end;
    const char *src;
    size_t src_sz;
    size_t dest_off;
    size_t copy_sz;
    va_start(srcs, dest_sz);
    for (dest_end = dest, dest_off = 0; *dest_end &amp;&amp; dest_off &lt; dest_sz; dest_end++, dest_sz++);
    for (src = va_arg(srcs, const char *); src &amp;&amp; dest_off &lt; dest_sz; src = va_arg(srcs, const char *)) {
      src_sz = strlen(src);
      copy_sz = src_sz &lt; (dest_sz - dest_off) ? src_sz : (dest_sz - dest_off);
      memmove(dest_end, src, copy_sz);
      dest_end += copy_sz;
      dest_off += copy_sz;
      if (dest_off &lt; dest_sz)
      {
        *dest_end = &#x27;\0&#x27;;
      }
    }
    va_end(srcs);
    return dest_end;
  }</code></pre>