version 1.12, 1999/09/06 13:10:48 |
version 1.13, 1999/09/06 13:20:40 |
|
|
#include <unistd.h> |
#include <unistd.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
|
#include <stddef.h> |
#include <string.h> |
#include <string.h> |
#include <fcntl.h> |
#include <fcntl.h> |
#include <err.h> |
#include <err.h> |
|
|
if (n < 0 || n >= MAXOUT) |
if (n < 0 || n >= MAXOUT) |
n = 0; /* bitbucket */ |
n = 0; /* bitbucket */ |
if (outfile[n] == NULL) { |
if (outfile[n] == NULL) { |
m4temp[UNIQUE] = n + '0'; |
char fname[] = _PATH_DIVNAME; |
if ((fd = open(m4temp, O_CREAT|O_EXCL|O_WRONLY, 0600)) < 0 || |
|
(outfile[n] = fdopen(fd, "w")) == NULL) |
if ((fd = mkstemp(fname)) < 0 || |
err(1, "%s: cannot divert", m4temp); |
(outfile[n] = fdopen(fd, "w+")) == NULL) |
|
err(1, "%s: cannot divert", fname); |
|
if (unlink(fname) == -1) |
|
err(1, "%s: cannot unlink", fname); |
} |
} |
active = outfile[n]; |
active = outfile[n]; |
} |
} |