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

Diff for /src/usr.bin/rcs/rcsnum.c between version 1.9 and 1.10

version 1.9, 2008/01/22 08:31:18 version 1.10, 2008/01/31 16:36:11
Line 56 
Line 56 
 }  }
   
 /*  /*
    * rcsnum_addmagic()
    *
    * Adds a magic branch number to an RCS number.
    * Returns 0 on success, or -1 on failure.
    */
   int
   rcsnum_addmagic(RCSNUM *rn)
   {
           if (!rn->rn_len || rn->rn_len > RCSNUM_MAXLEN - 1)
                   return -1;
           rcsnum_setsize(rn, rn->rn_len + 1);
           rn->rn_id[rn->rn_len - 1] = rn->rn_id[rn->rn_len - 2];
           rn->rn_id[rn->rn_len - 2] = 0;
   
           return 0;
   }
   
   /*
  * rcsnum_parse()   * rcsnum_parse()
  *   *
  * Parse a string specifying an RCS number and return the corresponding RCSNUM.   * Parse a string specifying an RCS number and return the corresponding RCSNUM.
Line 214 
Line 232 
 {  {
         u_int32_t val;          u_int32_t val;
         const char *sp;          const char *sp;
           char *s;
   
         if (nump->rn_id == NULL)          if (nump->rn_id == NULL)
                 nump->rn_id = xmalloc(sizeof(*(nump->rn_id)));                  nump->rn_id = xmalloc(sizeof(*(nump->rn_id)));
Line 261 
Line 280 
          * about this, cvs does this for "efficiency reasons", i'd like           * about this, cvs does this for "efficiency reasons", i'd like
          * to hear one.           * to hear one.
          *           *
            * We just make sure we remove the .0. from in the branch number.
            *
          * XXX - for compatibility reasons with GNU cvs we _need_           * XXX - for compatibility reasons with GNU cvs we _need_
          * to add these magic branch numbers.           * to skip this part for the 'log' command, apparently it does
            * show the magic branches for an unknown and probably
            * completely insane and not understandable reason in that output.
            *
          */           */
         if (nump->rn_len > 1 && !(nump->rn_len % 2)) {          if (nump->rn_len > 2 && nump->rn_id[nump->rn_len - 1] == 0
                 nump->rn_len++;              && !(rcsnum_flags & RCSNUM_NO_MAGIC)) {
                 nump->rn_id = xrealloc(nump->rn_id, nump->rn_len + 1,                  /*
                     sizeof(*(nump->rn_id)));                   * Look for ".0.x" at the end of the branch number.
                 nump->rn_id[nump->rn_len] = nump->rn_id[nump->rn_len - 1];                   */
                 nump->rn_id[nump->rn_len - 1] = 0;                  if ((s = strrchr(str, '.')) != NULL) {
                           s--;
                           while (*s != '.')
                                   s--;
   
                           /*
                            * If we have a "magic" branch, adjust it
                            * so the .0. is removed.
                            */
                           if (!strncmp(s, RCS_MAGIC_BRANCH,
                               strlen(RCS_MAGIC_BRANCH))) {
                                   nump->rn_id[nump->rn_len - 1] =
                                       nump->rn_id[nump->rn_len];
                                   nump->rn_len--;
                           }
                   }
         }          }
   
         /* We can't have a single-digit rcs number. */          /* We can't have a single-digit rcs number. */

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10