$NetBSD: patch-as,v 1.2 2004/11/29 05:09:43 taca Exp $ --- sbr/concat.c.orig 1993-12-01 13:01:21.000000000 +0900 +++ sbr/concat.c @@ -2,34 +2,40 @@ #include "../h/mh.h" #include -#include +#include /* VARARGS */ -char *concat (va_alist) -va_dcl +char *concat (char *first, ...) { register char *cp, *dp, *sp; register unsigned len; - register va_list list; + va_list list; len = 1; - va_start (list); - while (cp = va_arg (list, char *)) - len += strlen (cp); - va_end (list); + if (first) { + len += strlen(first); + va_start (list, first); + while (cp = va_arg (list, char *)) + len += strlen (cp); + va_end (list); + } dp = sp = malloc (len); if (dp == NULL) adios (NULLCP, "unable to allocate string storage"); - va_start (list); - while (cp = va_arg (list, char *)) - sp = copy (cp, sp); - va_end (list); + *sp = '\0'; + if (first) { + sp = copy (first, sp); + va_start (list, first); + while (cp = va_arg (list, char *)) + sp = copy (cp, sp); + va_end (list); + } return dp; }