version 1.1, 1995/10/18 08:45:36 |
version 1.2, 1996/06/25 20:50:08 |
|
|
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/file.h> |
#include <errno.h> |
#include <errno.h> |
#include <unistd.h> |
#include <unistd.h> |
#include <stdio.h> |
#include <stdio.h> |
|
|
{ |
{ |
register int c; |
register int c; |
register FILE *dfil; |
register FILE *dfil; |
|
int fd; |
|
|
if (active == outfile[n]) |
if (active == outfile[n]) |
oops("%s: diversion still active.", "undivert"); |
oops("%s: diversion still active.", "undivert"); |
(void) fclose(outfile[n]); |
(void) fclose(outfile[n]); |
outfile[n] = NULL; |
outfile[n] = NULL; |
m4temp[UNIQUE] = n + '0'; |
m4temp[UNIQUE] = n + '0'; |
if ((dfil = fopen(m4temp, "r")) == NULL) |
|
|
if ((fd = open(m4temp, O_RDWR|O_EXCL|O_CREAT, 0666)) == -1 || |
|
(dfil = fdopen(fd, "r")) == NULL) { |
|
if (fd != -1) |
|
close(fd); |
oops("%s: cannot undivert.", m4temp); |
oops("%s: cannot undivert.", m4temp); |
else |
} else |
while ((c = getc(dfil)) != EOF) |
while ((c = getc(dfil)) != EOF) |
putc(c, active); |
putc(c, active); |
(void) fclose(dfil); |
(void) fclose(dfil); |