On Sun, Aug 03, 2014 at 06:00:45PM +0200, Fritjof Bornebusch wrote:
Ping?
> Hi tech,
> 
> the OpenRCS rcs command produces the following output if -l and -u is used in 
> the
> same command:
> 
> $ rcs -l1.1 -u1.1 foo.txt 
> RCS file: foo.txt,v
> 1.1 locked
> 1.1 unlocked
> 
> $ rcs -u1.1 -l1.1 foo.txt 
> RCS file: foo.txt,v
> 1.1 locked
> 1.1 unlocked
> 
> I've looked at GnuRCS and it has another way to handle these parameters (it 
> seems the other BSDs
> use GnuRCS, too).
> 
> Debian 7.5:
> $ rcs -l1.1 -u1.1 foo.txt 
> RCS file: foo.txt,v
> rcs: foo.txt,v: no lock set on revision 1.1
> 1.1 locked
> 
> $ rcs -u1.1 -l1.1 foo.txt 
> Segmentation fault
> 
> Well, I think the "Segmentation fault" isn't that important, but GnuRCS does 
> not lock and unlock
> a file by using the same command like OpenRCS.
> 
> I think the different implementations of RCS should share the same behaviour, 
> so I changed OpenRCS:
> 
> $ rcs -l1.1 -u1.1 foo.txt 
> RCS file: foo.txt,v
> 1.1 locked
> done
> 
> $ rcs -u1.1 -l1.1 foo.txt  
> RCS file: foo.txt,v
> 1.1 unlocked
> done
> 
> fritjof
> 
> Index: rcsprog.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/rcs/rcsprog.c,v
> retrieving revision 1.151
> diff -u -p -r1.151 rcsprog.c
> --- rcsprog.c 12 Jul 2011 21:00:32 -0000      1.151
> +++ rcsprog.c 3 Aug 2014 15:42:34 -0000
> @@ -234,9 +234,10 @@ rcs_main(int argc, char **argv)
>                       lkmode = RCS_LOCK_STRICT;
>                       break;
>               case 'l':
> -                     /* XXX - Check with -u flag. */
> -                     lrev = rcs_optarg;
> -                     rcsflags |= RCSPROG_LFLAG;
> +                     if (!(rcsflags & RCSPROG_UFLAG)) {
> +                             lrev = rcs_optarg;
> +                             rcsflags |= RCSPROG_LFLAG;
> +                     }
>                       break;
>               case 'm':
>                       if (logstr != NULL)
> @@ -272,9 +273,10 @@ rcs_main(int argc, char **argv)
>                       lkmode = RCS_LOCK_LOOSE;
>                       break;
>               case 'u':
> -                     /* XXX - Check with -l flag. */
> -                     urev = rcs_optarg;
> -                     rcsflags |= RCSPROG_UFLAG;
> +                     if (!(rcsflags & RCSPROG_LFLAG)) {
> +                             urev = rcs_optarg;
> +                             rcsflags |= RCSPROG_UFLAG;
> +                     }
>                       break;
>               case 'V':
>                       printf("%s\n", rcs_version);
> 

Reply via email to