1: /* concat.c - concatenate a bunch of strings in managed memory */
   2: 
   3: #include "../h/mh.h"
   4: #include <stdio.h>
   5: #include <varargs.h>
   6: 
   7: 
   8: /* VARARGS */
   9: 
  10: char   *concat (va_alist)
  11: va_dcl
  12: {
  13:     register char  *cp,
  14:                    *dp,
  15:                    *sp;
  16:     register unsigned   len;
  17:     register    va_list list;
  18: 
  19:     len = 1;
  20:     va_start (list);
  21:     while (cp = va_arg (list, char *))
  22:     len += strlen (cp);
  23:     va_end (list);
  24: 
  25:     dp = sp = malloc (len);
  26:     if (dp == NULL)
  27:     adios (NULLCP, "unable to allocate string storage");
  28: 
  29:     va_start (list);
  30:     while (cp = va_arg (list, char *))
  31:     sp = copy (cp, sp);
  32:     va_end (list);
  33: 
  34:     return dp;
  35: }

Defined functions

concat defined in line 10; used 3 times
Last modified: 1985-09-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 905
Valid CSS Valid XHTML 1.0 Strict