warn(tempname);
warn("%s", tempname);
outof(names, fo, hp)	struct name *names;	FILE *fo;	struct header *hp;{	int c, ispipe;	struct name *np, *top;	time_t now;	char *date, *fname;	FILE *fout, *fin;	top = names;	np = names;	(void)time(&now);	date = ctime(&now);	while (np != NIL) {		if (!isfileaddr(np->n_name) && np->n_name[0] != '|') {			np = np->n_flink;			continue;		}		ispipe = np->n_name[0] == '|';		if (ispipe)			fname = np->n_name+1;		else			fname = expand(np->n_name);		/*		 * See if we have copied the complete message out yet.		 * If not, do so.		 */		if (image < 0) {			int fd;			char tempname[PATHSIZE];			(void)snprintf(tempname, sizeof(tempname),			    "%s/mail.ReXXXXXXXXXX", tmpdir);			if ((fd = mkstemp(tempname)) == -1 ||			    (fout = Fdopen(fd, "a")) == NULL) {				warn(tempname);				senderr++;				goto cant;			}			image = open(tempname, O_RDWR);			(void)rm(tempname);			if (image < 0) {				warn(tempname);				senderr++;				(void)Fclose(fout);				goto cant;			}			(void)fcntl(image, F_SETFD, 1);			fprintf(fout, "From %s %s", myname, date);			puthead(hp, fout, GTO|GSUBJECT|GCC|GNL);			while ((c = getc(fo)) != EOF)				(void)putc(c, fout);			rewind(fo);			(void)putc('\n', fout);			(void)fflush(fout);			if (ferror(fout))				warn(tempname);			(void)Fclose(fout);		}		/*		 * Now either copy "image" to the desired file		 * or give it as the standard input to the desired		 * program as appropriate.		 */		if (ispipe) {			int pid;			char *shell;			sigset_t nset;			/*			 * XXX			 * We can't really reuse the same image file,			 * because multiple piped recipients will			 * share the same lseek location and trample			 * on one another.			 */			if ((shell = value("SHELL")) == NULL)				shell = _PATH_CSHELL;			sigemptyset(&nset);			sigaddset(&nset, SIGHUP);			sigaddset(&nset, SIGINT);			sigaddset(&nset, SIGQUIT);			pid = start_command(shell, &nset,				image, -1, "-c", fname, NULL);			if (pid < 0) {				senderr++;				goto cant;			}			free_child(pid);		} else {			int f;			if ((fout = Fopen(fname, "a")) == NULL) {				warn(fname);				senderr++;				goto cant;			}			if ((f = dup(image)) < 0) {				warn("dup");				fin = NULL;			} else				fin = Fdopen(f, "r");			if (fin == NULL) {				fputs("Can't reopen image\n", stderr);				(void)Fclose(fout);				senderr++;				goto cant;			}			rewind(fin);			while ((c = getc(fin)) != EOF)				(void)putc(c, fout);			if (ferror(fout)) {				senderr++;				warn(fname);			}			(void)Fclose(fout);			(void)Fclose(fin);		}cant:		/*		 * In days of old we removed the entry from the		 * the list; now for sake of header expansion		 * we leave it in and mark it as deleted.		 */		np->n_type |= GDEL;		np = np->n_flink;	}	if (image >= 0) {		(void)close(image);		image = -1;	}	return(top);}