diff options
author | Niall O'Higgins <niallo@cvs.openbsd.org> | 2005-10-29 19:05:52 +0000 |
---|---|---|
committer | Niall O'Higgins <niallo@cvs.openbsd.org> | 2005-10-29 19:05:52 +0000 |
commit | 31ef90eb4062a339cbde7db5a621f87aed51245e (patch) | |
tree | 98d144010753a9a35fb27a95e8a4fcf95da28c0d /usr.bin/rcs | |
parent | 0a0e0ff8f3f77f57bef157a71b2ffb2533de15ba (diff) |
- add two new functions to RCS api: rcs_state_set() and rcs_state_check()
- use these two new functions to implement -s<state> option in ci
ok joris@
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r-- | usr.bin/rcs/ci.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c index 7f1a3c55bd5..784943eb621 100644 --- a/usr.bin/rcs/ci.c +++ b/usr.bin/rcs/ci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ci.c,v 1.50 2005/10/27 07:43:56 xsa Exp $ */ +/* $OpenBSD: ci.c,v 1.51 2005/10/29 19:05:51 niallo Exp $ */ /* * Copyright (c) 2005 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -79,19 +79,20 @@ checkin_main(int argc, char **argv) RCSNUM *frev, *newrev; char fpath[MAXPATHLEN]; char *rcs_msg, *filec, *deltatext, *username, rbuf[16]; - const char *symbol = NULL; + const char *symbol, *state; struct rcs_lock *lkp; BUF *bp; date = DATE_NOW; file = NULL; rcs_msg = username = NULL; + state = symbol = NULL; newrev = NULL; fmode = force = lkmode = rflag = status = symforce = 0; interactive = 1; - while ((ch = rcs_getopt(argc, argv, "d::f::j:k:l::m:M:N:n:qr::u::Vw:")) != -1) { + while ((ch = rcs_getopt(argc, argv, "d::f::j:k:l::m:M:N:n:qr::s:u::Vw:")) != -1) { switch (ch) { case 'd': if (rcs_optarg == NULL) @@ -144,6 +145,13 @@ checkin_main(int argc, char **argv) rcs_set_rev(rcs_optarg, &newrev); rflag = 1; break; + case 's': + state = rcs_optarg; + if (rcs_state_check(state) < 0) { + cvs_log(LP_ERR, "invalid state `%'", state); + exit(1); + } + break; case 'u': rcs_set_rev(rcs_optarg, &newrev); lkmode = LOCK_UNLOCK; @@ -358,6 +366,12 @@ checkin_main(int argc, char **argv) } } + /* + * Set the state of this revision if specified. + */ + if (state != NULL) + (void)rcs_state_set(file, newrev, state); + free(deltatext); free(filec); (void)unlink(argv[i]); |