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

Diff for /src/usr.bin/indent/indent.c between version 1.6 and 1.6.4.1

version 1.6, 1999/05/19 03:17:16 version 1.6.4.1, 2000/10/06 21:16:13
Line 190 
Line 190 
                 in_name = argv[i];      /* remember name of input file */                  in_name = argv[i];      /* remember name of input file */
                 input = fopen(in_name, "r");                  input = fopen(in_name, "r");
                 if (input == NULL)              /* check for open error */                  if (input == NULL)              /* check for open error */
                         err(1, in_name);                          err(1, "%s", in_name);
                 continue;                  continue;
             }              }
             else if (output == 0) {     /* we have the output file */              else if (output == 0) {     /* we have the output file */
Line 200 
Line 200 
                         errx(1, "input and output files must be different");                          errx(1, "input and output files must be different");
                 output = fopen(out_name, "w");                  output = fopen(out_name, "w");
                 if (output == NULL)     /* check for create error */                  if (output == NULL)     /* check for create error */
                         err(1, out_name);                          err(1, "%s", out_name);
                 continue;                  continue;
             }              }
             errx(1, "unknown parameter: %s", argv[i]);              errx(1, "unknown parameter: %s", argv[i]);
Line 1155 
Line 1155 
     /* copy in_name to backup file */      /* copy in_name to backup file */
     bakchn = creat(bakfile, 0600);      bakchn = creat(bakfile, 0600);
     if (bakchn < 0)      if (bakchn < 0)
         err(1, bakfile);          err(1, "%s", bakfile);
     while ((n = read(fileno(input), buff, sizeof buff)) > 0)      while ((n = read(fileno(input), buff, sizeof buff)) > 0)
         if (write(bakchn, buff, n) != n)          if (write(bakchn, buff, n) != n)
             err(1, bakfile);              err(1, "%s", bakfile);
     if (n < 0)      if (n < 0)
         err(1, in_name);          err(1, "%s", in_name);
     close(bakchn);      close(bakchn);
     fclose(input);      fclose(input);
   
     /* re-open backup file as the input file */      /* re-open backup file as the input file */
     input = fopen(bakfile, "r");      input = fopen(bakfile, "r");
     if (input == NULL)      if (input == NULL)
         err(1, bakfile);          err(1, "%s", bakfile);
     /* now the original input file will be the output */      /* now the original input file will be the output */
     output = fopen(in_name, "w");      output = fopen(in_name, "w");
     if (output == NULL) {      if (output == NULL) {
         unlink(bakfile);          unlink(bakfile);
         err(1, in_name);          err(1, "%s", in_name);
     }      }
 }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.6.4.1