diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-02-27 00:22:09 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-02-27 00:22:09 +0000 |
commit | b7aef825f62a7a94ddfc3f5ec9d0861f8429a4b4 (patch) | |
tree | ce6402f52828eb03a79ea8f26b45a0fd0a1965b0 | |
parent | 6ad71f0dcaf6b13e5d2488013f723e6f320e6190 (diff) |
Many improvements to the RCS support:
- make it possible to specify creation and the file mode
in rcs_open()
- implicitly write the contents to disk on rcs_close() if the
RCS handle has been changed
- fix a bug in the output of the `expand' keyword
- add functions to retrieve and modify the expansion mode
- rcs_parse() shouldn't be available to the outside
- empty string instead of `(null)' if there is no description
ok Joris
-rw-r--r-- | usr.bin/cvs/diff.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/getlog.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/init.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 271 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.h | 44 | ||||
-rw-r--r-- | usr.bin/cvs/status.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/tag.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 4 |
8 files changed, 209 insertions, 130 deletions
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c index 83dab55c144..2deefe08358 100644 --- a/usr.bin/cvs/diff.c +++ b/usr.bin/cvs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.21 2005/02/25 20:32:48 jfb Exp $ */ +/* $OpenBSD: diff.c,v 1.22 2005/02/27 00:22:08 jfb Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -566,7 +566,7 @@ cvs_diff_file(struct cvs_file *cfp, void *arg) snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s", root->cr_dir, repo, diff_file, RCS_FILE_EXT); - rf = rcs_open(rcspath, RCS_MODE_READ); + rf = rcs_open(rcspath, RCS_READ); if (rf == NULL) { cvs_ent_free(entp); return (-1); diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c index 1fe6ab95afa..b9800d66720 100644 --- a/usr.bin/cvs/getlog.c +++ b/usr.bin/cvs/getlog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getlog.c,v 1.13 2004/12/21 18:32:10 jfb Exp $ */ +/* $OpenBSD: getlog.c,v 1.14 2005/02/27 00:22:08 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -193,7 +193,7 @@ cvs_getlog_file(CVSFILE *cf, void *arg) snprintf(fpath, sizeof(fpath), "%s/%s/%s%s", root->cr_dir, repo, CVS_FILE_NAME(cf), RCS_FILE_EXT); - rf = rcs_open(fpath, RCS_MODE_READ); + rf = rcs_open(fpath, RCS_READ); if (rf == NULL) { cvs_ent_free(entp); return (-1); diff --git a/usr.bin/cvs/init.c b/usr.bin/cvs/init.c index d053900b02b..d843143c25d 100644 --- a/usr.bin/cvs/init.c +++ b/usr.bin/cvs/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.9 2005/01/05 18:34:01 jfb Exp $ */ +/* $OpenBSD: init.c,v 1.10 2005/02/27 00:22:08 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -128,7 +128,7 @@ cvs_init(int argc, char **argv) (void)close(fd); strlcat(path, RCS_FILE_EXT, sizeof(path)); - rfp = rcs_open(path, RCS_MODE_WRITE); + rfp = rcs_open(path, RCS_WRITE, 0644); if (rfp == NULL) { return (EX_CANTCREAT); } diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 7531243d10e..9f0e39e51af 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.25 2005/02/25 20:32:48 jfb Exp $ */ +/* $OpenBSD: rcs.c,v 1.26 2005/02/27 00:22:08 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -32,12 +32,13 @@ #include <stdio.h> #include <ctype.h> #include <stdlib.h> +#include <stdarg.h> #include <string.h> #include "rcs.h" #include "log.h" -#define RCS_BUFSIZE 16384 +#define RCS_BUFSIZE 16384 #define RCS_BUFEXTSIZE 8192 @@ -104,25 +105,6 @@ struct rcs_foo { struct rcs_tqh rl_lines; }; -static int rcs_parse_admin (RCSFILE *); -static int rcs_parse_delta (RCSFILE *); -static int rcs_parse_deltatext (RCSFILE *); - -static int rcs_parse_access (RCSFILE *); -static int rcs_parse_symbols (RCSFILE *); -static int rcs_parse_locks (RCSFILE *); -static int rcs_parse_branches (RCSFILE *, struct rcs_delta *); -static void rcs_freedelta (struct rcs_delta *); -static void rcs_freepdata (struct rcs_pdata *); -static int rcs_gettok (RCSFILE *); -static int rcs_pushtok (RCSFILE *, const char *, int); -static int rcs_growbuf (RCSFILE *); -static int rcs_patch_lines (struct rcs_foo *, struct rcs_foo *); - -static struct rcs_delta* rcs_findrev (RCSFILE *, RCSNUM *); -static struct rcs_foo* rcs_splitlines (const char *); -static void rcs_freefoo (struct rcs_foo *); - #define RCS_TOKSTR(rfp) ((struct rcs_pdata *)rfp->rf_pdata)->rp_buf #define RCS_TOKLEN(rfp) ((struct rcs_pdata *)rfp->rf_pdata)->rp_blen @@ -165,66 +147,100 @@ static struct rcs_key { #define RCS_NKEYS (sizeof(rcs_keys)/sizeof(rcs_keys[0])) +static int rcs_parse (RCSFILE *); +static int rcs_parse_admin (RCSFILE *); +static int rcs_parse_delta (RCSFILE *); +static int rcs_parse_deltatext (RCSFILE *); + +static int rcs_parse_access (RCSFILE *); +static int rcs_parse_symbols (RCSFILE *); +static int rcs_parse_locks (RCSFILE *); +static int rcs_parse_branches (RCSFILE *, struct rcs_delta *); +static void rcs_freedelta (struct rcs_delta *); +static void rcs_freepdata (struct rcs_pdata *); +static int rcs_gettok (RCSFILE *); +static int rcs_pushtok (RCSFILE *, const char *, int); +static int rcs_growbuf (RCSFILE *); +static int rcs_patch_lines (struct rcs_foo *, struct rcs_foo *); + +static struct rcs_delta* rcs_findrev (RCSFILE *, RCSNUM *); +static struct rcs_foo* rcs_splitlines (const char *); +static void rcs_freefoo (struct rcs_foo *); + + /* * rcs_open() * * Open a file containing RCS-formatted information. The file's path is - * given in <path>, and the opening mode is given in <mode>, which is either - * RCS_MODE_READ, RCS_MODE_WRITE, or RCS_MODE_RDWR. If the mode requests write - * access and the file does not exist, it will be created. - * The file isn't actually parsed by rcs_open(); parsing is delayed until the - * first operation that requires information from the file. + * given in <path>, and the opening flags are given in <flags>, which is either + * RCS_READ, RCS_WRITE, or RCS_RDWR. If the open requests write access and + * the file does not exist, the RCS_CREATE flag must also be given, in which + * case it will be created with the mode specified in a third argument of + * type mode_t. If the file exists and RCS_CREATE is passed, the open will + * fail. * Returns a handle to the opened file on success, or NULL on failure. */ RCSFILE* -rcs_open(const char *path, u_int mode) +rcs_open(const char *path, int flags, ...) { + int ret; + mode_t fmode; RCSFILE *rfp; struct stat st; + va_list vap; - if ((stat(path, &st) == -1) && (errno == ENOENT) && - !(mode & RCS_MODE_WRITE)) { - cvs_log(LP_ERRNO, "cannot open RCS file `%s'", path); + fmode = 0; + flags &= 0xffff; /* ditch any internal flags */ + + if (((ret = stat(path, &st)) == -1) && (errno == ENOENT)) { + if (flags & RCS_CREATE) { + va_start(vap, flags); + fmode = va_arg(vap, mode_t); + va_end(vap); + } else { + cvs_log(LP_ERR, "RCS file `%s' does not exist", path); + return (NULL); + } + } else if ((ret == 0) && (flags & RCS_CREATE)) { + cvs_log(LP_ERR, "RCS file `%s' exists", path); return (NULL); } - rfp = (RCSFILE *)malloc(sizeof(*rfp)); - if (rfp == NULL) { + if ((rfp = (RCSFILE *)malloc(sizeof(*rfp))) == NULL) { cvs_log(LP_ERRNO, "failed to allocate RCS file structure"); return (NULL); } memset(rfp, 0, sizeof(*rfp)); - rfp->rf_head = rcsnum_alloc(); - if (rfp->rf_head == NULL) { + if ((rfp->rf_head = rcsnum_parse(RCS_HEAD_INIT)) == NULL) { free(rfp); return (NULL); } - rfp->rf_branch = rcsnum_alloc(); - if (rfp->rf_branch == NULL) { - rcs_close(rfp); + if ((rfp->rf_branch = rcsnum_alloc()) == NULL) { + rcsnum_free(rfp->rf_head); + free(rfp); return (NULL); } - rfp->rf_path = strdup(path); - if (rfp->rf_path == NULL) { + if ((rfp->rf_path = strdup(path)) == NULL) { cvs_log(LP_ERRNO, "failed to duplicate RCS file path"); - rcs_close(rfp); + rcsnum_free(rfp->rf_branch); + rcsnum_free(rfp->rf_head); + free(rfp); return (NULL); } - rcsnum_aton(RCS_HEAD_INIT, NULL, rfp->rf_head); - rfp->rf_ref = 1; - rfp->rf_flags |= RCS_RF_SLOCK; - rfp->rf_mode = mode; + rfp->rf_flags = flags | RCS_SLOCK; + rfp->rf_mode = fmode; TAILQ_INIT(&(rfp->rf_delta)); TAILQ_INIT(&(rfp->rf_symbols)); TAILQ_INIT(&(rfp->rf_locks)); - if (rcs_parse(rfp) < 0) { + if (rfp->rf_flags & RCS_CREATE) { + } else if (rcs_parse(rfp) < 0) { rcs_close(rfp); return (NULL); } @@ -250,6 +266,9 @@ rcs_close(RCSFILE *rfp) return; } + if ((rfp->rf_flags & RCS_WRITE) && !(rfp->rf_flags & RCS_SYNCED)) + rcs_write(rfp); + while (!TAILQ_EMPTY(&(rfp->rf_delta))) { rdp = TAILQ_FIRST(&(rfp->rf_delta)); TAILQ_REMOVE(&(rfp->rf_delta), rdp, rd_list); @@ -304,7 +323,7 @@ rcs_write(RCSFILE *rfp) struct rcs_sym *symp; struct rcs_delta *rdp; - if (rfp->rf_flags & RCS_RF_SYNCED) + if ((rfp->rf_flags & RCS_SYNCED) || (rfp->rf_ndelta == 0)) return (0); fp = fopen(rfp->rf_path, "w"); @@ -330,7 +349,7 @@ rcs_write(RCSFILE *rfp) fprintf(fp, "locks;"); - if (rfp->rf_flags & RCS_RF_SLOCK) + if (rfp->rf_flags & RCS_SLOCK) fprintf(fp, " strict;"); fputc('\n', fp); @@ -356,7 +375,8 @@ rcs_write(RCSFILE *rfp) numbuf, sizeof(numbuf))); } - fprintf(fp, "\ndesc\n@%s@\n\n", rfp->rf_desc); + fprintf(fp, "\ndesc\n@%s@\n\n", + (rfp->rf_desc == NULL) ? "" : rfp->rf_desc); /* deltatexts */ TAILQ_FOREACH(rdp, &(rfp->rf_delta), rd_list) { @@ -375,21 +395,21 @@ rcs_write(RCSFILE *rfp) } fclose(fp); - rfp->rf_flags |= RCS_RF_SYNCED; + rfp->rf_flags |= RCS_SYNCED; return (0); } /* - * rcs_addsym() + * rcs_sym_add() * * Add a symbol to the list of symbols for the RCS file <rfp>. The new symbol * is named <sym> and is bound to the RCS revision <snum>. * Returns 0 on success, or -1 on failure. */ int -rcs_addsym(RCSFILE *rfp, const char *sym, RCSNUM *snum) +rcs_sym_add(RCSFILE *rfp, const char *sym, RCSNUM *snum) { struct rcs_sym *symp; @@ -426,7 +446,7 @@ rcs_addsym(RCSFILE *rfp, const char *sym, RCSNUM *snum) TAILQ_INSERT_HEAD(&(rfp->rf_symbols), symp, rs_list); /* not synced anymore */ - rfp->rf_flags &= ~RCS_RF_SYNCED; + rfp->rf_flags &= ~RCS_SYNCED; return (0); } @@ -600,50 +620,50 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *rev) if (res == 1) { cvs_log(LP_ERR, "sorry, can't travel in the future yet"); return (NULL); - } else { - rdp = rcs_findrev(rfp, rfp->rf_head); - if (rdp == NULL) { - cvs_log(LP_ERR, "failed to get RCS HEAD revision"); - return (NULL); - } + } - len = strlen(rdp->rd_text); - rbuf = cvs_buf_alloc(len, BUF_AUTOEXT); - if (rbuf == NULL) - return (NULL); - cvs_buf_append(rbuf, rdp->rd_text, len); + rdp = rcs_findrev(rfp, rfp->rf_head); + if (rdp == NULL) { + cvs_log(LP_ERR, "failed to get RCS HEAD revision"); + return (NULL); + } - if (res != 0) { - /* Apply patches backwards to get the right version. - * This will need some rework to support sub branches. - */ - if ((crev = rcsnum_alloc()) == NULL) { + len = strlen(rdp->rd_text); + if ((rbuf = cvs_buf_alloc(len, BUF_AUTOEXT)) == NULL) + return (NULL); + + cvs_buf_append(rbuf, rdp->rd_text, len); + + if (res != 0) { + /* Apply patches backwards to get the right version. + * This will need some rework to support sub branches. + */ + if ((crev = rcsnum_alloc()) == NULL) { + cvs_buf_free(rbuf); + return (NULL); + } + rcsnum_cpy(rfp->rf_head, crev, 0); + do { + crev->rn_id[crev->rn_len - 1]--; + rdp = rcs_findrev(rfp, crev); + if (rdp == NULL) { + rcsnum_free(crev); cvs_buf_free(rbuf); return (NULL); } - rcsnum_cpy(rfp->rf_head, crev, 0); - do { - crev->rn_id[crev->rn_len - 1]--; - rdp = rcs_findrev(rfp, crev); - if (rdp == NULL) { - rcsnum_free(crev); - cvs_buf_free(rbuf); - return (NULL); - } - if (cvs_buf_putc(rbuf, '\0') < 0) { - rcsnum_free(crev); - cvs_buf_free(rbuf); - return (NULL); - } - bp = cvs_buf_release(rbuf); - rbuf = rcs_patch((char *)bp, rdp->rd_text); - if (rbuf == NULL) - break; - } while (rcsnum_cmp(crev, rev, 0) != 0); + if (cvs_buf_putc(rbuf, '\0') < 0) { + rcsnum_free(crev); + cvs_buf_free(rbuf); + return (NULL); + } + bp = cvs_buf_release(rbuf); + rbuf = rcs_patch((char *)bp, rdp->rd_text); + if (rbuf == NULL) + break; + } while (rcsnum_cmp(crev, rev, 0) != 0); - rcsnum_free(crev); - } + rcsnum_free(crev); } return (rbuf); @@ -688,7 +708,7 @@ rcs_findrev(RCSFILE *rfp, RCSNUM *rev) struct rcs_delta *rdp; struct rcs_dlist *hp; int found; - + cmplen = 2; hp = &(rfp->rf_delta); @@ -712,6 +732,58 @@ rcs_findrev(RCSFILE *rfp, RCSNUM *rev) /* + * rcs_kwexp_set() + * + * Set the keyword expansion mode to use on the RCS file <file> to <mode>. + * Returns 0 on success, or -1 on failure. + */ +int +rcs_kwexp_set(RCSFILE *file, int mode) +{ + int i; + char *tmp, buf[8] = ""; + + if (RCS_KWEXP_INVAL(mode)) + return (-1); + + i = 0; + if (mode == RCS_KWEXP_NONE) + buf[0] = 'b'; + else if (mode == RCS_KWEXP_OLD) + buf[0] = 'o'; + else { + if (mode & RCS_KWEXP_NAME) + buf[i++] = 'k'; + if (mode & RCS_KWEXP_VAL) + buf[i++] = 'v'; + if (mode & RCS_KWEXP_LKR) + buf[i++] = 'l'; + } + + if ((tmp = strdup(buf)) == NULL) { + cvs_log(LP_ERRNO, "%s: failed to copy expansion mode", + file->rf_path); + return (-1); + } + + free(file->rf_expand); + file->rf_expand = tmp; + + return (0); +} + +/* + * rcs_kwexp_get() + * + * Retrieve the keyword expansion mode to be used for the RCS file <file>. + */ +int +rcs_kwexp_get(RCSFILE *file) +{ + return rcs_kflag_get(file->rf_expand); +} + +/* * rcs_kflag_get() * * Get the keyword expansion mode from a set of character flags given in @@ -762,23 +834,23 @@ rcs_kflag_usage(void) "\t-kb\tGenerate binary file unmodified (merges not allowed).\n"); } + /* * rcs_parse() * * Parse the contents of file <path>, which are in the RCS format. * Returns 0 on success, or -1 on failure. */ -int +static int rcs_parse(RCSFILE *rfp) { int ret; struct rcs_pdata *pdp; - if (rfp->rf_flags & RCS_RF_PARSED) + if (rfp->rf_flags & RCS_PARSED) return (0); - pdp = (struct rcs_pdata *)malloc(sizeof(*pdp)); - if (pdp == NULL) { + if ((pdp = (struct rcs_pdata *)malloc(sizeof(*pdp))) == NULL) { cvs_log(LP_ERRNO, "failed to allocate RCS parser data"); return (-1); } @@ -804,7 +876,7 @@ rcs_parse(RCSFILE *rfp) pdp->rp_bufend = pdp->rp_buf + pdp->rp_blen - 1; /* ditch the strict lock */ - rfp->rf_flags &= ~RCS_RF_SLOCK; + rfp->rf_flags &= ~RCS_SLOCK; rfp->rf_pdata = pdp; if (rcs_parse_admin(rfp) < 0) { @@ -861,7 +933,7 @@ rcs_parse(RCSFILE *rfp) rcs_freepdata(pdp); rfp->rf_pdata = NULL; - rfp->rf_flags |= RCS_RF_PARSED|RCS_RF_SYNCED; + rfp->rf_flags |= RCS_PARSED | RCS_SYNCED; return (0); } @@ -945,7 +1017,7 @@ rcs_parse_admin(RCSFILE *rfp) if (ntok != RCS_TOK_SCOLON) { cvs_log(LP_ERR, "missing semi-colon after RCS `%s' key", - rk->rk_str); + rk->rk_str); return (-1); } break; @@ -1086,7 +1158,7 @@ rcs_parse_delta(RCSFILE *rfp) if (ntok != RCS_TOK_SCOLON) { cvs_log(LP_ERR, "missing semi-colon after RCS `%s' key", - rk->rk_str); + rk->rk_str); rcs_freedelta(rdp); return (-1); } @@ -1139,6 +1211,7 @@ rcs_parse_delta(RCSFILE *rfp) free(tokstr); TAILQ_INSERT_TAIL(&(rfp->rf_delta), rdp, rd_list); + rfp->rf_ndelta++; return (ret); } @@ -1396,7 +1469,7 @@ rcs_parse_locks(RCSFILE *rfp) if (type != RCS_TOK_STRICT) { rcs_pushtok(rfp, RCS_TOKSTR(rfp), type); } else { - rfp->rf_flags |= RCS_RF_SLOCK; + rfp->rf_flags |= RCS_SLOCK; type = rcs_gettok(rfp); if (type != RCS_TOK_SCOLON) { diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h index 002892460bf..3731ff98965 100644 --- a/usr.bin/cvs/rcs.h +++ b/usr.bin/cvs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.8 2005/02/25 20:05:41 jfb Exp $ */ +/* $OpenBSD: rcs.h,v 1.9 2005/02/27 00:22:08 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -53,23 +53,25 @@ #define RCS_KWEXP_DEFAULT (RCS_KWEXP_NAME | RCS_KWEXP_VAL) #define RCS_KWEXP_KVL (RCS_KWEXP_NAME | RCS_KWEXP_VAL | RCS_KWEXP_LKR) -#define RCS_KWEXP_INVAL(k) (k & RCS_KWEXP_ERR) +#define RCS_KWEXP_INVAL(k) \ + ((k & RCS_KWEXP_ERR) || ((k & RCS_KWEXP_OLD) != RCS_KWEXP_OLD)) + #define RCSNUM_MAXNUM USHRT_MAX #define RCSNUM_MAXLEN 64 -/* open modes */ -#define RCS_MODE_READ 0x01 -#define RCS_MODE_WRITE 0x02 -#define RCS_MODE_RDWR (RCS_MODE_READ|RCS_MODE_WRITE) - - /* file flags */ -#define RCS_RF_PARSED 0x01 /* file has been parsed */ -#define RCS_RF_SYNCED 0x02 /* in-memory copy is in sync with disk copy */ -#define RCS_RF_SLOCK 0x04 /* strict lock */ +#define RCS_READ 0x01 +#define RCS_WRITE 0x02 +#define RCS_RDWR (RCS_READ|RCS_WRITE) +#define RCS_CREATE 0x04 /* create the file */ + +/* internal flags */ +#define RCS_PARSED 0x010000 /* file has been parsed */ +#define RCS_SYNCED 0x020000 /* in-memory copy is in sync with disk copy */ +#define RCS_SLOCK 0x040000 /* strict lock */ /* delta flags */ #define RCS_RD_DEAD 0x01 /* dead */ @@ -124,7 +126,7 @@ struct rcs_delta { typedef struct rcs_file { char *rf_path; u_int rf_ref; - u_int rf_mode; + mode_t rf_mode; u_int rf_flags; RCSNUM *rf_head; @@ -133,26 +135,30 @@ typedef struct rcs_file { char *rf_expand; char *rf_desc; - struct rcs_dlist rf_delta; - TAILQ_HEAD(rcs_slist, rcs_sym) rf_symbols; - TAILQ_HEAD(rcs_llist, rcs_lock) rf_locks; + u_int rf_ndelta; + struct rcs_dlist rf_delta; + TAILQ_HEAD(rcs_slist, rcs_sym) rf_symbols; + TAILQ_HEAD(rcs_llist, rcs_lock) rf_locks; + void *rf_pdata; } RCSFILE; -RCSFILE* rcs_open (const char *, u_int); +RCSFILE* rcs_open (const char *, int, ...); void rcs_close (RCSFILE *); -int rcs_parse (RCSFILE *); int rcs_write (RCSFILE *); -int rcs_addsym (RCSFILE *, const char *, RCSNUM *); -int rcs_rmsym (RCSFILE *, const char *); +int rcs_sym_add (RCSFILE *, const char *, RCSNUM *); +int rcs_sym_remove (RCSFILE *, const char *); BUF* rcs_getrev (RCSFILE *, RCSNUM *); BUF* rcs_gethead (RCSFILE *); RCSNUM* rcs_getrevbydate (RCSFILE *, struct tm *); +int rcs_kwexp_set (RCSFILE *, int); +int rcs_kwexp_get (RCSFILE *); int rcs_kflag_get (const char *); void rcs_kflag_usage (void); +int rcs_kw_expand (RCSFILE *, u_char *, size_t, size_t *); BUF* rcs_patch (const char *, const char *); size_t rcs_stresc (int, const char *, char *, size_t *); diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c index 5cf616a7ac2..e197513475a 100644 --- a/usr.bin/cvs/status.c +++ b/usr.bin/cvs/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.7 2005/01/06 20:39:27 jfb Exp $ */ +/* $OpenBSD: status.c,v 1.8 2005/02/27 00:22:08 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -194,7 +194,7 @@ cvs_status_file(CVSFILE *cfp, void *arg) snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s", root->cr_dir, repo, CVS_FILE_NAME(cfp), RCS_FILE_EXT); - rf = rcs_open(rcspath, RCS_MODE_READ); + rf = rcs_open(rcspath, RCS_READ); if (rf == NULL) { cvs_ent_free(entp); return (-1); diff --git a/usr.bin/cvs/tag.c b/usr.bin/cvs/tag.c index 67c2ed8a32c..fa23ea63ee9 100644 --- a/usr.bin/cvs/tag.c +++ b/usr.bin/cvs/tag.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tag.c,v 1.3 2005/01/14 18:02:04 jfb Exp $ */ +/* $OpenBSD: tag.c,v 1.4 2005/02/27 00:22:08 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2004 Joris Vink <amni@pandora.be> @@ -223,7 +223,7 @@ cvs_tag_file(CVSFILE *cfp, void *arg) snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s", root->cr_dir, repo, CVS_FILE_NAME(cfp), RCS_FILE_EXT); - rf = rcs_open(rcspath, RCS_MODE_READ); + rf = rcs_open(rcspath, RCS_READ); if (rf == NULL) { cvs_ent_free(entp); return (-1); diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index ea89591275a..236b8a55bca 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.16 2005/02/22 23:31:13 jfb Exp $ */ +/* $OpenBSD: update.c,v 1.17 2005/02/27 00:22:08 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -193,7 +193,7 @@ cvs_update_file(CVSFILE *cf, void *arg) snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s", root->cr_dir, repo, fname, RCS_FILE_EXT); - rf = rcs_open(rcspath, RCS_MODE_READ); + rf = rcs_open(rcspath, RCS_READ); if (rf == NULL) { cvs_ent_free(entp); return (-1); |