=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/rcs.c,v retrieving revision 1.42 retrieving revision 1.43 diff -c -r1.42 -r1.43 *** src/usr.bin/cvs/rcs.c 2005/04/07 20:50:22 1.42 --- src/usr.bin/cvs/rcs.c 2005/04/07 22:08:57 1.43 *************** *** 1,4 **** ! /* $OpenBSD: rcs.c,v 1.42 2005/04/07 20:50:22 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: rcs.c,v 1.43 2005/04/07 22:08:57 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 201,207 **** static int rcs_patch_lines (struct rcs_foo *, struct rcs_foo *); static int rcs_strprint (const u_char *, size_t, FILE *); ! static struct rcs_delta* rcs_findrev (RCSFILE *, RCSNUM *); static struct rcs_foo* rcs_splitlines (const char *); static void rcs_freefoo (struct rcs_foo *); --- 201,207 ---- static int rcs_patch_lines (struct rcs_foo *, struct rcs_foo *); static int rcs_strprint (const u_char *, size_t, FILE *); ! static struct rcs_delta* rcs_findrev (RCSFILE *, const RCSNUM *); static struct rcs_foo* rcs_splitlines (const char *); static void rcs_freefoo (struct rcs_foo *); *************** *** 441,446 **** --- 441,478 ---- } /* + * rcs_head_get() + * + * Retrieve the revision number of the head revision for the RCS file . + */ + const RCSNUM* + rcs_head_get(RCSFILE *file) + { + return (file->rf_head); + } + + /* + * rcs_head_set() + * + * Set the revision number of the head revision for the RCS file to + * , which must reference a valid revision within the file. + */ + int + rcs_head_set(RCSFILE *file, const RCSNUM *rev) + { + struct rcs_delta *rd; + + if ((rd = rcs_findrev(file, rev)) == NULL) + return (-1); + + if (rcsnum_cpy(rev, file->rf_head, 0) < 0) + return (-1); + + return (0); + } + + + /* * rcs_branch_get() * * Retrieve the default branch number for the RCS file . *************** *** 1096,1102 **** * Returns a pointer to the delta on success, or NULL on failure. */ static struct rcs_delta* ! rcs_findrev(RCSFILE *rfp, RCSNUM *rev) { u_int cmplen; struct rcs_delta *rdp; --- 1128,1134 ---- * Returns a pointer to the delta on success, or NULL on failure. */ static struct rcs_delta* ! rcs_findrev(RCSFILE *rfp, const RCSNUM *rev) { u_int cmplen; struct rcs_delta *rdp; *************** *** 1827,1833 **** return (-1); } ! TAILQ_INSERT_HEAD(&(rfp->rf_symbols), symp, rs_list); } return (0); --- 1859,1865 ---- return (-1); } ! TAILQ_INSERT_TAIL(&(rfp->rf_symbols), symp, rs_list); } return (0);