summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/rcs.c
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2005-11-22 11:49:03 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2005-11-22 11:49:03 +0000
commit5ebfeb516ed416f744a705daa0e24286685ce7f2 (patch)
treecdf925675db4a35c120534869d45b2f77e677a12 /usr.bin/cvs/rcs.c
parentbb76f74956fe60e8ce58011926a3848c10f71890 (diff)
- ci(1) can intialise RCS files now!
- support for -j added - support for -i added ok joris@ xsa@
Diffstat (limited to 'usr.bin/cvs/rcs.c')
-rw-r--r--usr.bin/cvs/rcs.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 9d6047740fd..6b717e425f3 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.100 2005/11/16 08:15:21 xsa Exp $ */
+/* $OpenBSD: rcs.c,v 1.101 2005/11/22 11:49:02 niallo Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1390,8 +1390,18 @@ rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date,
return (-1);
if (rev == RCS_HEAD_REV) {
- rcsnum_cpy(rf->rf_head, old, 0);
- rev = rcsnum_inc(rf->rf_head);
+ if (rf->rf_flags & RCS_CREATE) {
+ if ((rev = rcsnum_parse(RCS_HEAD_INIT)) == NULL)
+ return (-1);
+ if ((rf->rf_head = rcsnum_alloc()) == NULL) {
+ rcsnum_free(rev);
+ return (-1);
+ }
+ rcsnum_cpy(rev, rf->rf_head, 0);
+ } else {
+ rcsnum_cpy(rf->rf_head, old, 0);
+ rev = rcsnum_inc(rf->rf_head);
+ }
} else {
if ((rdp = rcs_findrev(rf, rev)) != NULL) {
rcs_errno = RCS_ERR_DUPENT;
@@ -1438,7 +1448,9 @@ rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date,
return (-1);
}
- rcsnum_cpy(old, rdp->rd_next, 0);
+ if (!(rf->rf_flags & RCS_CREATE))
+ rcsnum_cpy(old, rdp->rd_next, 0);
+
rcsnum_free(old);
if (username == NULL)