diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-03-05 18:25:31 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-03-05 18:25:31 +0000 |
commit | fa3a0f43c8dfa471d41a778e9e0bd0675b6d3a35 (patch) | |
tree | 696bc1bd822de566cec6686b4f8455c9dfaf5fad /usr.bin/cvs | |
parent | de6908704e90d9203ed10495e1bb51a877bab833 (diff) |
add functions to retrieve and set the comment leader for an RCS
file
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/rcs.c | 56 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.h | 4 |
2 files changed, 58 insertions, 2 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 2aaab689cbd..b8a3e4fe2c6 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.32 2005/03/05 05:58:39 jfb Exp $ */ +/* $OpenBSD: rcs.c,v 1.33 2005/03/05 18:25:30 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -109,6 +109,7 @@ struct rcs_foo { #define RCS_TOKLEN(rfp) ((struct rcs_pdata *)rfp->rf_pdata)->rp_blen +#ifdef notyet static struct rcs_kfl { char rk_char; int rk_val; @@ -119,6 +120,7 @@ static struct rcs_kfl { { 'o', RCS_KWEXP_OLD }, { 'b', RCS_KWEXP_NONE }, }; +#endif static struct rcs_key { char rk_str[16]; @@ -146,6 +148,26 @@ static struct rcs_key { #define RCS_NKEYS (sizeof(rcs_keys)/sizeof(rcs_keys[0])) +#ifdef notyet +/* + * Keyword expansion table + */ +static struct rcs_kw { + char kw_str[16]; +} rcs_expkw[] = { + { "Author" }, + { "Date" }, + { "Header" }, + { "Id" }, + { "Log" }, + { "Name" }, + { "RCSfile" }, + { "Revision" }, + { "Source" }, + { "State" } +}; +#endif + static const char *rcs_errstrs[] = { "No error", "No such entry", @@ -677,6 +699,38 @@ rcs_desc_set(RCSFILE *file, const char *desc) return (0); } +/* + * rcs_comment_get() + * + * Retrieve the comment leader for the RCS file <file>. + */ +const char* +rcs_comment_get(RCSFILE *file) +{ + return (file->rf_comment); +} + +/* + * rcs_comment_set() + * + * Set the comment leader for the RCS file <file>. + * Returns 0 on success, or -1 on failure. + */ +int +rcs_comment_set(RCSFILE *file, const char *comment) +{ + char *tmp; + + if ((tmp = strdup(comment)) == NULL) + return (-1); + + if (file->rf_comment != NULL) + free(file->rf_comment); + file->rf_comment = tmp; + file->rf_flags &= ~RCS_SYNCED; + + return (0); +} /* * rcs_patch() diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h index 092eb656dba..6c623a8e719 100644 --- a/usr.bin/cvs/rcs.h +++ b/usr.bin/cvs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.14 2005/03/05 05:58:39 jfb Exp $ */ +/* $OpenBSD: rcs.h,v 1.15 2005/03/05 18:25:30 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -184,6 +184,8 @@ BUF* rcs_gethead (RCSFILE *); RCSNUM* rcs_getrevbydate (RCSFILE *, struct tm *); const char* rcs_desc_get (RCSFILE *); int rcs_desc_set (RCSFILE *, const char *); +const char* rcs_comment_get (RCSFILE *); +int rcs_comment_set (RCSFILE *, const char *); int rcs_kwexp_set (RCSFILE *, int); int rcs_kwexp_get (RCSFILE *); const char* rcs_errstr (int); |