lseek(ofd, (off_t)0, SEEK_SET);
opentemp(const char *file){	char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN];	ssize_t nread;	int ifd, ofd;	if (strcmp(file, "-") == 0)		ifd = STDIN_FILENO;	else if ((ifd = open(file, O_RDONLY, 0644)) < 0)		return (NULL);	if ((tempdir = getenv("TMPDIR")) == NULL)		tempdir = _PATH_TMP;	if (snprintf(tempfile, sizeof(tempfile), "%s/diff.XXXXXXXX",	    tempdir) >= sizeof(tempfile)) {		close(ifd);		errno = ENAMETOOLONG;		return (NULL);	}	if ((ofd = mkstemp(tempfile)) < 0)		return (NULL);	unlink(tempfile);	while ((nread = read(ifd, buf, BUFSIZ)) > 0) {		if (write(ofd, buf, nread) != nread) {			close(ifd);			close(ofd);			return (NULL);		}	}	close(ifd);	return (fdopen(ofd, "r"));}