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

Diff for /src/usr.bin/rcs/ci.c between version 1.166 and 1.167

version 1.166, 2006/04/29 05:31:28 version 1.167, 2006/04/29 06:32:00
Line 841 
Line 841 
     char **state)      char **state)
 {  {
         size_t end;          size_t end;
         u_int j, found;          u_int j;
         char *c, *kwstr, *start, buf[128];          char *c, *kwstr, *start, buf[128];
   
         c = start = kwstr = NULL;          kwstr = NULL;
   
         found = 0;          for (c = data; (c = strchr(c, '$')) != NULL;) {
                   size_t len;
   
         for (c = data; *c != '\0'; c++) {                  start = c;
                 if (*c == '$') {                  c++;
                         start = c;                  if (!isalpha(*c))
                         c++;                          continue;
                         if (!isalpha(*c)) {  
                                 c = start;  
                                 continue;  
                         }  
                         /* look for any matching keywords */  
                         found = 0;  
                         for (j = 0; j < 10; j++) {  
                                 if (!strncmp(c, rcs_expkw[j].kw_str,  
                                     strlen(rcs_expkw[j].kw_str))) {  
                                         found = 1;  
                                         kwstr = rcs_expkw[j].kw_str;  
                                         break;  
                                 }  
                         }  
   
                         /* unknown keyword, continue looking */                  /* look for any matching keywords */
                         if (found == 0) {                  for (j = 0; j < 10; j++) {
                                 c = start;                          len = strlen(rcs_expkw[j].kw_str);
                                 continue;                          if (strncmp(c, rcs_expkw[j].kw_str, len) != 0) {
                                   kwstr = rcs_expkw[j].kw_str;
                                   break;
                         }                          }
                   }
   
                         c += strlen(kwstr);                  /* unknown keyword, continue looking */
                         if (*c != ':' && *c != '$') {                  if (kwstr == NULL)
                                 c = start;                          continue;
                                 continue;  
                         }  
   
                         if (*c == ':') {                  c += len;
                                 while (*c++) {                  if (*c != ':')
                                         if (*c == '$') {                          continue;
                                                 end = c - start + 2;  
                                                 if (strlcpy(buf, start, end) >= end)  
                                                         errx(1, "keyword buffer"  
                                                             " too small!");  
                                                 checkin_parsekeyword(buf, rev,  
                                                     date, author, state);  
                                                 break;  
                                         }  
                                 }  
   
                                 if (*c != '$') {                  /* Find end of line or end of keyword. */
                                         c = start;                  c += strcspn(c, "$\n");
                                         continue;                  if (*c != '$')
                                 }                          continue;
                         }  
                 }                  end = c - start + 2;
                   if (strlcpy(buf, start, end) >= end)
                           errx(1, "keyword buffer too small!");
                   checkin_parsekeyword(buf, rev, date, author, state);
         }          }
         if (found == 0)          if (kwstr == NULL)
                 return (-1);                  return (-1);
         else          else
                 return (0);                  return (0);

Legend:
Removed from v.1.166  
changed lines
  Added in v.1.167