[BACK]Return to misc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / m4

Diff for /src/usr.bin/m4/misc.c between version 1.3 and 1.4

version 1.3, 1996/06/26 05:36:15 version 1.4, 1996/07/01 20:40:28
Line 46 
Line 46 
 #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>
Line 155 
Line 154 
 {  {
         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);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4