summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-10-10 13:06:25 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-10-10 13:06:25 +0000
commitc151662310f91158b80f0d78196f66159ce21292 (patch)
tree607aa61fd6256e074f84b150ddbebefbad48572d /usr.bin
parentb7c7fc0bd7b2a8590867c5e3060bfae9606020c7 (diff)
add rcsnum_dec() api call, decreases a revision number by one.
ok niallo@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/rcs.h3
-rw-r--r--usr.bin/cvs/rcsnum.c17
2 files changed, 18 insertions, 2 deletions
diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h
index f76e621ac67..aaa78cf38fe 100644
--- a/usr.bin/cvs/rcs.h
+++ b/usr.bin/cvs/rcs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.h,v 1.32 2005/10/07 23:59:56 niallo Exp $ */
+/* $OpenBSD: rcs.h,v 1.33 2005/10/10 13:06:24 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -226,6 +226,7 @@ RCSNUM *rcsnum_parse(const char *);
RCSNUM *rcsnum_brtorev(const RCSNUM *);
RCSNUM *rcsnum_revtobr(const RCSNUM *);
RCSNUM *rcsnum_inc(RCSNUM *);
+RCSNUM *rcsnum_dec(RCSNUM *);
void rcsnum_free(RCSNUM *);
int rcsnum_aton(const char *, char **, RCSNUM *);
char *rcsnum_tostr(const RCSNUM *, char *, size_t);
diff --git a/usr.bin/cvs/rcsnum.c b/usr.bin/cvs/rcsnum.c
index 3c1d0998f87..5bcd5cac6fd 100644
--- a/usr.bin/cvs/rcsnum.c
+++ b/usr.bin/cvs/rcsnum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsnum.c,v 1.16 2005/09/19 15:45:16 niallo Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.17 2005/10/10 13:06:24 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -327,6 +327,21 @@ rcsnum_inc(RCSNUM *num)
}
/*
+ * rcsnum_dec()
+ *
+ * Decreases the revision number specified in <num>
+ * Returns pointer to the <num> on success, or NULL on failure.
+ */
+RCSNUM *
+rcsnum_dec(RCSNUM *num)
+{
+ if (num->rn_id[num->rn_len - 1] <= 0)
+ return (NULL);
+ num->rn_id[num->rn_len - 1]--;
+ return (num);
+}
+
+/*
* rcsnum_revtobr()
*
* Retrieve the branch number associated with the revision number <num>.