diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-04-07 22:08:58 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-04-07 22:08:58 +0000 |
commit | b435fafd41d9d31bd7c3f896e03775e797ff5998 (patch) | |
tree | 0895ff482f3f18d6c43a97d7bd836dfb3e3466e3 /usr.bin | |
parent | 1c61c41b98f3d69bb0a38abee5da3091b93207d3 (diff) |
* reverse symbol list order
* allow retrieval and setting of the head revision number
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/rcs.c | 40 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.h | 4 |
2 files changed, 39 insertions, 5 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index f8f76c2e5bb..f9f9ef4a317 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.42 2005/04/07 20:50:22 jfb Exp $ */ +/* $OpenBSD: rcs.c,v 1.43 2005/04/07 22:08:57 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -201,7 +201,7 @@ static int rcs_growbuf (RCSFILE *); 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_delta* rcs_findrev (RCSFILE *, const RCSNUM *); static struct rcs_foo* rcs_splitlines (const char *); static void rcs_freefoo (struct rcs_foo *); @@ -441,6 +441,38 @@ rcs_write(RCSFILE *rfp) } /* + * rcs_head_get() + * + * Retrieve the revision number of the head revision for the RCS file <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 <file> to + * <rev>, 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 <file>. @@ -1096,7 +1128,7 @@ rcs_getrevbydate(RCSFILE *rfp, struct tm *date) * Returns a pointer to the delta on success, or NULL on failure. */ static struct rcs_delta* -rcs_findrev(RCSFILE *rfp, RCSNUM *rev) +rcs_findrev(RCSFILE *rfp, const RCSNUM *rev) { u_int cmplen; struct rcs_delta *rdp; @@ -1827,7 +1859,7 @@ rcs_parse_symbols(RCSFILE *rfp) return (-1); } - TAILQ_INSERT_HEAD(&(rfp->rf_symbols), symp, rs_list); + TAILQ_INSERT_TAIL(&(rfp->rf_symbols), symp, rs_list); } return (0); diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h index b3f4839ca5a..5b38cedd6ab 100644 --- a/usr.bin/cvs/rcs.h +++ b/usr.bin/cvs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.18 2005/04/07 20:50:22 jfb Exp $ */ +/* $OpenBSD: rcs.h,v 1.19 2005/04/07 22:08:57 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -178,6 +178,8 @@ extern int rcs_errno; RCSFILE* rcs_open (const char *, int, ...); void rcs_close (RCSFILE *); +const RCSNUM* rcs_head_get (RCSFILE *); +int rcs_head_set (RCSFILE *, const RCSNUM *); const RCSNUM* rcs_branch_get (RCSFILE *); int rcs_branch_set (RCSFILE *, const RCSNUM *); int rcs_access_add (RCSFILE *, const char *); |