[net.sources] RCS modifications to assign symbolic name to highest rev

olson@fortune.UUCP (Dave Olson) (10/05/85)

In article <5611@fortune.UUCP> olson@fortune.UUCP (Dave olson) writes:
>>I implemented a new option -Ssymbolic_name to do this.
>>The modifications are relatively minor (if, of course, you have 
>>source :-) ).  If you would like the mods, send me mail.  If enough
>>people want them, I'll post them to net.sources.
>
>OK, so far I've gotten 16 requests for the modifications.  I'll post
>them to net.sources within the next few days.  (I'll try to
>acknowledge all the individual requests, but I may miss a few.)

And here are the context diffs.  My version is 3.13, the base version
was 3.9 of 83/02/15.
It's not in shar or patch format, sorry...  The actual diffs are
relatively minor, you should have no problem integrating them.

 *** /tmp/,RCSt1000142	Fri Oct  4 20:15:31 1985
 --- rcs.c	Fri Oct  4 20:14:45 1985
 ***************
 *** 2,8
    *                      RCS create/change operation
    */
    static char rcsid[]=
 !  "$Header: /usr/spool/uucppublic/rcs/rcs.c,v 3.9 83/02/15 15:38:39 wft Exp $ Purdue CS";
   /***************************************************************************
    *                       create RCS files or change RCS file attributes
    *                       Compatibility with release 2: define COMPAT2
 
 --- 2,8 -----
    *                      RCS create/change operation
    */
    static char rcsid[]=
 !  "$Header: /usr/spool/uucppublic/rcs/rcs.c,v 3.13 84/04/16 17:47:03 root Exp $ Purdue CS";
   /***************************************************************************
    *                       create RCS files or change RCS file attributes
    *                       Compatibility with release 2: define COMPAT2
 ***************
 *** 21,26
   
   
   /* $Log:	/usr/spool/uucppublic/rcs/rcs.c,v $
    * Revision 3.9  83/02/15  15:38:39  wft
    * initial
    * 
 
 --- 21,43 -----
   
   
   /* $Log:	/usr/spool/uucppublic/rcs/rcs.c,v $
 +  * Revision 3.13  84/04/16  17:47:03  root
 +  * Finally got the -S stuff right.  fortune!olson
 +  * 
 +  * Revision 3.12  84/04/16  16:54:30  root
 +  * same as 3.11
 +  * 
 +  * Revision 3.11  84/04/16  16:33:56  root
 +  * fixed some botches in previous version caused by misunderstanding of
 +  * control flow, etc.
 +  * 
 +  * Revision 3.10  84/04/16  15:48:34  root
 +  * added new option -S, behaves like -n except that a null revision means the
 +  * highest revision on the trunk (like most of the other RCS commands and
 +  * options.  This is useful for assigning a symbolic name to the highest rev
 +  * level of all your sources: rcs -SRELEASE_1.8 -sRELEASED *,v
 +  * fortune!olsno
 +  * 
    * Revision 3.9  83/02/15  15:38:39  wft
    * initial
    * 
 ***************
 *** 149,155
   char    command[80], * commsyml;
   char    * headstate;
   int     headoverride, lockhead, unlockcaller, chgheadstate, commentflag;
 ! int     delaccessflag;
   enum    stringwork {copy, edit, empty}; /* expand and edit_expand not needed */
   
   
 
 --- 166,172 -----
   char    command[80], * commsyml;
   char    * headstate;
   int     headoverride, lockhead, unlockcaller, chgheadstate, commentflag;
 ! int     delaccessflag, Uselastrev;
   enum    stringwork {copy, edit, empty}; /* expand and edit_expand not needed */
   
   
 ***************
 *** 169,175
   	catchints();
           cmdid = "rcs";
           quietflag = false;
 !         comdusge ="command format:\nrcs -i -alogins -Alogins -e[logins] -c[commentleader] -l[rev] -u[rev] -L -U -nname[:rev] -Nname[:rev] -orange -sstate[:rev] -t[textfile] file....";
           rplaccessor = nil;     delstrt = nil;
           accessfile = textfile = caller = nil;
           commentflag = chgheadstate = false;
 
 --- 186,192 -----
   	catchints();
           cmdid = "rcs";
           quietflag = false;
 !         comdusge ="command format:\nrcs -i -alogins -Alogins -e[logins] -c[commentleader] -l[rev] -u[rev] -L -U -Sname[:rev] -nname[:rev] -Nname[:rev] -orange -sstate[:rev] -t[textfile] file....";
           rplaccessor = nil;     delstrt = nil;
           accessfile = textfile = caller = nil;
           Uselastrev = commentflag = chgheadstate = false;
 ***************
 *** 172,178
           comdusge ="command format:\nrcs -i -alogins -Alogins -e[logins] -c[commentleader] -l[rev] -u[rev] -L -U -nname[:rev] -Nname[:rev] -orange -sstate[:rev] -t[textfile] file....";
           rplaccessor = nil;     delstrt = nil;
           accessfile = textfile = caller = nil;
 !         commentflag = chgheadstate = false;
           lockhead = false; unlockcaller=false;
           initflag= textflag = false;
           strict_selected = 0;
 
 --- 189,195 -----
           comdusge ="command format:\nrcs -i -alogins -Alogins -e[logins] -c[commentleader] -l[rev] -u[rev] -L -U -Sname[:rev] -nname[:rev] -Nname[:rev] -orange -sstate[:rev] -t[textfile] file....";
           rplaccessor = nil;     delstrt = nil;
           accessfile = textfile = caller = nil;
 !         Uselastrev = commentflag = chgheadstate = false;
           lockhead = false; unlockcaller=false;
           initflag= textflag = false;
           strict_selected = 0;
 ***************
 *** 304,309
   			    strictlock = false;
                           break;
   
                   case 'n':    /*  add new association: error, if name exits  */
                           if ( (*argv)[2] == '\0') {
                               error("Missing symbolic name after -n");
 
 --- 321,336 -----
   			    strictlock = false;
                           break;
   
 +                 case 'S':    /*  add new association: same as -n,
 + 				except that a null rev level defaults to the highest
 + 				rev level.  Added by fortune!olson */
 +                         if ( (*argv)[2] == '\0') {
 +                             error("Missing symbolic name after -S");
 +                             break;
 +                         }
 +                         getassoclst(false, (*argv)+1, true);
 +                         break;
 + 
                   case 'n':    /*  add new association: error, if name exits  */
                           if ( (*argv)[2] == '\0') {
                               error("Missing symbolic name after -n");
 ***************
 *** 309,315
                               error("Missing symbolic name after -n");
                               break;
                           }
 !                         getassoclst(false, (*argv)+1);
                           break;
   
                   case 'N':   /*  add or change association   */
 
 --- 336,342 -----
                               error("Missing symbolic name after -n");
                               break;
                           }
 !                         getassoclst(false, (*argv)+1, false);
                           break;
   
                   case 'N':   /*  add or change association   */
 ***************
 *** 317,323
                               error("Missing symbolic name after -N");
                               break;
                           }
 !                         getassoclst(true, (*argv)+1);
                           break;
   
                   case 'o':   /*  delete revisins  */
 
 --- 344,350 -----
                               error("Missing symbolic name after -N");
                               break;
                           }
 !                         getassoclst(true, (*argv)+1, false);
                           break;
   
                   case 'o':   /*  delete revisins  */
 ***************
 *** 533,539
   
   
   
 ! getassoclst(flag, sp)
   int     flag;
   char    * sp;
   /*  Function:   associate a symbolic name to a revision or branch,      */
 
 --- 560,570 -----
   
   
   
 ! /* modified to be usable with a null rev level by adding the third
 ! arg.  lastrevok is false with -n, and -N to preserve backwards
 ! compatiblity; added -S which sets lastrevok == true.  fortune!olson
 ! */
 ! getassoclst(flag, sp, lastrevok)
   int     flag;
   char    * sp;
   int		lastrevok;
 ***************
 *** 536,541
   getassoclst(flag, sp)
   int     flag;
   char    * sp;
   /*  Function:   associate a symbolic name to a revision or branch,      */
   /*              and store in assoclst                                   */
   
 
 --- 567,573 -----
   getassoclst(flag, sp, lastrevok)
   int     flag;
   char    * sp;
 + int		lastrevok;
   /*  Function:   associate a symbolic name to a revision or branch,      */
   /*              and store in assoclst                                   */
   
 ***************
 *** 551,557
           while( c == ' ' || c == '\t' || c == '\n')  c = *++sp;
   
           if ( c != ':' && c != '\0') {
 ! 	    error("Invalid string %s after option -n or -N",sp);
               return;
           }
   
 
 --- 583,589 -----
           while( c == ' ' || c == '\t' || c == '\n')  c = *++sp;
   
           if ( c != ':' && c != '\0') {
 ! 	    error("Invalid symbolic name string %s",sp);
               return;
           }
   
 ***************
 *** 558,569
           pt = (struct Symrev *)malloc(sizeof(struct Symrev));
           pt->ssymbol = temp;
           pt->override = flag;
 ! 	if (c == '\0')  /*  delete symbol  */
 !             pt->revno = nil;
 !         else {
 !             while( (c = *++sp) == ' ' || c == '\n' || c == '\t')  ;
 ! 	    if ( c == '\0' )
 !                 pt->revno = nil;
   	    else
                   pt->revno = sp;
           }
 
 --- 590,606 -----
           pt = (struct Symrev *)malloc(sizeof(struct Symrev));
           pt->ssymbol = temp;
           pt->override = flag;
 ! 
 ! 		if (c != '\0') 
 ! 			sp++;
 ! 		while( (c = *sp) == ' ' || c == '\n' || c == '\t')
 ! 			sp++;
 ! 	    if ( c == '\0' ) {
 ! 			pt->revno = nil;
 ! 			if(lastrevok == true)  /*  delete symbol if false, use
 ! 				highest rev number if true */
 ! 				Uselastrev = true;
 ! 		}
   	    else
                   pt->revno = sp;
   
 ***************
 *** 566,572
                   pt->revno = nil;
   	    else
                   pt->revno = sp;
 !         }
           pt->nextsym = nil;
           if (lastassoc)
               lastassoc->nextsym = pt;
 
 --- 603,609 -----
   		}
   	    else
                   pt->revno = sp;
 ! 
           pt->nextsym = nil;
           if (lastassoc)
               lastassoc->nextsym = pt;
 ***************
 *** 1242,1247
           /*  add new associations   */
           curassoc = assoclst;
           while( curassoc ) {
               if ( curassoc->revno == nil ) {  /* delete symbol  */
   		pre = pt = Symbols;
                   while( pt && strcmp(pt->symbol,curassoc->ssymbol) ) {
 
 --- 1279,1288 -----
           /*  add new associations   */
           curassoc = assoclst;
           while( curassoc ) {
 + 			/* fortune!olson addition: null revno MAY be associated
 + 			with latest rev on trunk (-SSymbolic_name) */
 + 			if(Uselastrev && Head && curassoc->revno == nil)
 + 				curassoc->revno = Head->num;
               if ( curassoc->revno == nil ) {  /* delete symbol  */
   		pre = pt = Symbols;
                   while( pt && strcmp(pt->symbol,curassoc->ssymbol) ) {

======================== End of diffs =============================

	Dave Olson, Fortune Systems
	UUCP: {ihnp4,ucbvax!dual}!fortune!olson
	ARPA: dual!fortune!olson@BERKELEY