=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/rcs.c,v retrieving revision 1.29 retrieving revision 1.30 diff -c -r1.29 -r1.30 *** src/usr.bin/cvs/rcs.c 2005/03/04 18:21:00 1.29 --- src/usr.bin/cvs/rcs.c 2005/03/05 03:30:29 1.30 *************** *** 1,4 **** ! /* $OpenBSD: rcs.c,v 1.29 2005/03/04 18:21:00 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: rcs.c,v 1.30 2005/03/05 03:30:29 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 592,597 **** --- 592,635 ---- } return (num); + } + + + /* + * rcs_lock_getmode() + * + * Retrieve the locking mode of the RCS file . + */ + int + rcs_lock_getmode(RCSFILE *file) + { + return (file->rf_flags & RCS_SLOCK) ? RCS_LOCK_STRICT : RCS_LOCK_LOOSE; + } + + + /* + * rcs_lock_setmode() + * + * Set the locking mode of the RCS file to , which must either + * be RCS_LOCK_LOOSE or RCS_LOCK_STRICT. + * Returns the previous mode on success, or -1 on failure. + */ + int + rcs_lock_setmode(RCSFILE *file, int mode) + { + int pmode; + pmode = rcs_lock_getmode(file); + + if (mode == RCS_LOCK_STRICT) + file->rf_flags |= RCS_SLOCK; + else if (mode == RCS_LOCK_LOOSE) + file->rf_flags &= ~RCS_SLOCK; + else { + cvs_log(LP_ERRNO, "invalid lock mode %d", mode); + return (-1); + } + + return (pmode); }