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

Diff for /src/usr.bin/patch/pch.c between version 1.13 and 1.14

version 1.13, 2003/04/08 00:18:31 version 1.14, 2003/07/16 18:09:20
Line 404 
Line 404 
                 /* about as informative as "Syntax error" in C */                  /* about as informative as "Syntax error" in C */
 }  }
   
   /*
    * True if the line has been discarded (i.e. it is a line saying
    *  "\ No newline at end of file".)
    */
   static bool
   remove_special_line(void)
   {
           int c;
   
           c = fgetc(pfp);
           if (c == '\\') {
                   do {
                           c = fgetc(pfp);
                   } while (c != EOF && c != '\n');
   
                   return TRUE;
           }
   
           if (c != EOF)
                   fseek(pfp, -1L, SEEK_CUR);
   
           return FALSE;
   }
   
 /* True if there is more of the current diff listing to process. */  /* True if there is more of the current diff listing to process. */
   
 bool  bool
Line 612 
Line 636 
                     p_end--;                      p_end--;
                     return FALSE;                      return FALSE;
                 }                  }
                   if (p_end == p_ptrn_lines) {
                           if (remove_special_line()) {
                                   int len;
   
                                   len = strlen(p_line[p_end]) - 1;
                                   (p_line[p_end])[len] = 0;
                           }
                   }
                 break;                  break;
             case '\t': case '\n':       /* assume the 2 spaces got eaten */              case '\t': case '\n':       /* assume the 2 spaces got eaten */
                 if (repl_beginning && repl_could_be_missing &&                  if (repl_beginning && repl_could_be_missing &&
Line 739 
Line 771 
             assert(fillsrc==p_end+1 || fillsrc==repl_beginning);              assert(fillsrc==p_end+1 || fillsrc==repl_beginning);
             assert(filldst==p_end+1 || filldst==repl_beginning);              assert(filldst==p_end+1 || filldst==repl_beginning);
         }          }
           if (p_line[p_end] != NULL) {
                   if (remove_special_line()) {
                           p_len[p_end] -= 1;
                           (p_line[p_end])[p_len[p_end]] = 0;
                   }
           }
     }      }
     else if (diff_type == UNI_DIFF) {      else if (diff_type == UNI_DIFF) {
         long line_beginning = ftell(pfp);          long line_beginning = ftell(pfp);
Line 839 
Line 877 
                 p_char[fillsrc] = ch;                  p_char[fillsrc] = ch;
                 p_line[fillsrc] = s;                  p_line[fillsrc] = s;
                 p_len[fillsrc++] = strlen(s);                  p_len[fillsrc++] = strlen(s);
                   if (fillsrc > p_ptrn_lines) {
                           if (remove_special_line()) {
                                   p_len[fillsrc - 1] -= 1;
                                   s[p_len[fillsrc - 1]] = 0;
                           }
                   }
                 break;                  break;
             case '=':              case '=':
                 ch = ' ';                  ch = ' ';
Line 874 
Line 918 
                 p_char[filldst] = ch;                  p_char[filldst] = ch;
                 p_line[filldst] = s;                  p_line[filldst] = s;
                 p_len[filldst++] = strlen(s);                  p_len[filldst++] = strlen(s);
                   if (fillsrc > p_ptrn_lines) {
                           if (remove_special_line()) {
                                   p_len[fillsrc - 1] -= 1;
                                   s[p_len[fillsrc - 1]] = 0;
                           }
                   }
                 break;                  break;
             default:              default:
                 p_end = filldst;                  p_end = filldst;
Line 950 
Line 1000 
             p_len[i] = strlen(p_line[i]);              p_len[i] = strlen(p_line[i]);
             p_char[i] = '-';              p_char[i] = '-';
         }          }
   
           if (remove_special_line()) {
                   p_len[i - 1] -= 1;
                   (p_line[i - 1])[p_len[i - 1]] = 0;
           }
   
         if (hunk_type == 'c') {          if (hunk_type == 'c') {
             ret = pgets(buf, sizeof buf, pfp);              ret = pgets(buf, sizeof buf, pfp);
             p_input_line++;              p_input_line++;
Line 981 
Line 1037 
             }              }
             p_len[i] = strlen(p_line[i]);              p_len[i] = strlen(p_line[i]);
             p_char[i] = '+';              p_char[i] = '+';
           }
   
           if (remove_special_line()) {
                   p_len[i - 1] -= 1;
                   (p_line[i - 1])[p_len[i - 1]] = 0;
         }          }
     }      }
     if (reverse)                        /* backwards patch? */      if (reverse)                        /* backwards patch? */

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14