summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2006-02-06 16:21:44 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2006-02-06 16:21:44 +0000
commita52eddc5717d3788811e94473e2d1e05407b1ec5 (patch)
tree7a0d16a7ecf5025e71b1cbf3852cf104c2fc801e /usr.bin
parent10de7bfefd643f3e4cc63a7c928cc539c7bf6343 (diff)
- use bitwise flags
- add missing option in remote handler
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/getlog.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c
index f2a38f7a010..71262f5ea55 100644
--- a/usr.bin/cvs/getlog.c
+++ b/usr.bin/cvs/getlog.c
@@ -1,6 +1,7 @@
-/* $OpenBSD: getlog.c,v 1.54 2006/01/30 17:58:47 xsa Exp $ */
+/* $OpenBSD: getlog.c,v 1.55 2006/02/06 16:21:43 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
+ * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,14 +32,16 @@
#include "proto.h"
-#define CVS_GLOG_RFONLY 0x01
-#define CVS_GLOG_HDONLY 0x02
-
-
#define CVS_GETLOG_REVSEP "----------------------------"
#define CVS_GETLOG_REVEND \
"============================================================================="
+#define GLOG_BRANCH (1<<0)
+#define GLOG_HEADER (1<<1)
+#define GLOG_HEADER_DESCR (1<<2)
+#define GLOG_NAME (1<<3)
+#define GLOG_NOTAGS (1<<4)
+
static int cvs_getlog_init(struct cvs_cmd *, int, char **, int *);
static int cvs_getlog_remote(CVSFILE *, void *);
static int cvs_getlog_local(CVSFILE *, void *);
@@ -79,10 +82,7 @@ struct cvs_cmd cvs_cmd_rlog = {
CVS_CMD_SENDDIR | CVS_CMD_ALLOWSPEC | CVS_CMD_SENDARGS2
};
-static int log_rfonly = 0;
-static int log_honly = 0;
-static int log_lhonly = 0;
-static int log_notags = 0;
+static int runflags = 0;
static int
cvs_getlog_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg)
@@ -92,27 +92,28 @@ cvs_getlog_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg)
while ((ch = getopt(argc, argv, cmd->cmd_opts)) != -1) {
switch (ch) {
case 'b':
+ runflags |= GLOG_BRANCH;
break;
case 'd':
break;
case 'h':
- log_honly = 1;
+ runflags |= GLOG_HEADER;
break;
case 'l':
cmd->file_flags &= ~CF_RECURSE;
break;
case 'N':
- log_notags = 1;
+ runflags |= GLOG_NOTAGS;
break;
case 'R':
- log_rfonly = 1;
+ runflags |= GLOG_NAME;
break;
case 'r':
break;
case 's':
break;
case 't':
- log_lhonly = 1;
+ runflags |= GLOG_HEADER_DESCR;
break;
case 'w':
break;
@@ -129,13 +130,19 @@ static int
cvs_getlog_pre_exec(struct cvsroot *root)
{
if (root->cr_method != CVS_METHOD_LOCAL) {
- if (log_honly == 1)
+ if (runflags & GLOG_BRANCH)
+ cvs_sendarg(root, "-b", 0);
+
+ if (runflags & GLOG_HEADER)
cvs_sendarg(root, "-h", 0);
- if (log_notags == 1)
+
+ if (runflags & GLOG_NOTAGS)
cvs_sendarg(root, "-N", 0);
- if (log_rfonly == 1)
+
+ if (runflags & GLOG_NAME)
cvs_sendarg(root, "-R", 0);
- if (log_lhonly == 1)
+
+ if (runflags & GLOG_HEADER_DESCR)
cvs_sendarg(root, "-t", 0);
}
return (0);
@@ -218,7 +225,7 @@ cvs_getlog_local(CVSFILE *cf, void *arg)
cvs_rcs_getpath(cf, rcspath, sizeof(rcspath));
- if (log_rfonly == 1) {
+ if (runflags & GLOG_NAME) {
cvs_printf("%s\n", rcspath);
return (0);
}
@@ -245,7 +252,7 @@ cvs_getlog_local(CVSFILE *cf, void *arg)
TAILQ_FOREACH(acp, &(rf->rf_access), ra_list)
cvs_printf("\t%s\n", acp->ra_name);
- if (log_notags == 0) {
+ if (!(runflags & GLOG_NOTAGS)) {
cvs_printf("symbolic names:\n");
TAILQ_FOREACH(sym, &(rf->rf_symbols), rs_list)
cvs_printf("\t%s: %s\n", sym->rs_name,
@@ -257,15 +264,15 @@ cvs_getlog_local(CVSFILE *cf, void *arg)
cvs_printf("total revisions: %u", rf->rf_ndelta);
- if ((log_honly == 0) && (log_lhonly == 0))
+ if (!(runflags & GLOG_HEADER) && !(runflags & GLOG_HEADER_DESCR))
cvs_printf(";\tselected revisions: %u", nrev);
cvs_printf("\n");
- if ((log_honly == 0) || (log_lhonly == 1))
+ if (!(runflags & GLOG_HEADER) || (runflags & GLOG_HEADER_DESCR))
cvs_printf("description:\n%s", rf->rf_desc);
- if ((log_honly == 0) && (log_lhonly == 0)) {
+ if (!(runflags & GLOG_HEADER) && !(runflags & GLOG_HEADER_DESCR)) {
TAILQ_FOREACH(rdp, &(rf->rf_delta), rd_list) {
rcsnum_tostr(rdp->rd_num, numbuf, sizeof(numbuf));
cvs_printf(CVS_GETLOG_REVSEP "\nrevision %s\n", numbuf);