/* Copy arg vector into a new buffer, concatenating arguments with spaces.  */
static char* copy_argv(register char **argv)
/* Copy arg vector into a new buffer, concatenating arguments with spaces.  */
static char* copy_argv(register char **argv)
{
	register char **p;
	register u_int len = 0;
	char *buf;
	char *src, *dst;
	p = argv;
	if (*p == NULL)
		return 0;
	while (*p)
		len += strlen(*p++) + 1;
	buf = (char *)malloc(len);
	if (buf == NULL)
		error("copy_argv: malloc");
	p = argv;
	dst = buf;
	while ((src = *p++) != NULL) {
		while ((*dst++ = *src++) != '\0')
			;
		dst[-1] = ' ';
	}
	dst[-1] = '\0';
	return buf;
}