summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-08-05 13:39:02 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-08-05 13:39:02 +0000
commit2c9b68e921249b9b533ba5a4eec5e642130e1c5c (patch)
treeeb7a7978721f99cffdeff67c1544f066aa43fd02 /usr.bin
parentec2b1798d5010477d8accf0b8af5073ceaff6b50 (diff)
Add a new log level LP_ABORT, which modifies the behaviour of prefix
generation by outputting something similar to GNU CVS: cvs [<command> aborted]: message
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/log.c24
-rw-r--r--usr.bin/cvs/log.h5
2 files changed, 18 insertions, 11 deletions
diff --git a/usr.bin/cvs/log.c b/usr.bin/cvs/log.c
index ca5a305d117..a2dec0a2af8 100644
--- a/usr.bin/cvs/log.c
+++ b/usr.bin/cvs/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.3 2004/08/05 13:32:08 jfb Exp $ */
+/* $OpenBSD: log.c,v 1.4 2004/08/05 13:39:01 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -48,7 +48,8 @@ static char *cvs_log_levels[] = {
"warning",
"error",
"alert",
- "error"
+ "error",
+ "abort",
};
#endif
@@ -60,6 +61,7 @@ static int cvs_slpriomap[] = {
LOG_ERR,
LOG_ALERT,
LOG_ERR,
+ LOG_ERR,
};
@@ -211,24 +213,28 @@ cvs_vlog(u_int level, const char *fmt, va_list vap)
char prefix[64], buf[1024], ebuf[32];
FILE *out;
- ecp = 0;
-
- if (level > LP_MAX) {
+ if (level > LP_MAX)
return (-1);
- }
+
/* apply any filters */
- if (cvs_log_filters[level] == 1)
+ if (cvs_log_filters[level] != 0)
return (0);
if (level == LP_ERRNO)
ecp = errno;
+ else
+ ecp = 0;
#ifdef CVS
/* The cvs program appends the command name to the program name */
if (cvs_command != NULL) {
- snprintf(prefix, sizeof(prefix), "%s %s", __progname,
- cvs_command);
+ if (level == LP_ABORT)
+ snprintf(prefix, sizeof(prefix), "%s [%s aborted]",
+ __progname, cvs_command);
+ else
+ snprintf(prefix, sizeof(prefix), "%s %s", __progname,
+ cvs_command);
}
else /* just use the standard strlcpy */
#endif
diff --git a/usr.bin/cvs/log.h b/usr.bin/cvs/log.h
index f3c186ce593..21afc300647 100644
--- a/usr.bin/cvs/log.h
+++ b/usr.bin/cvs/log.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.h,v 1.2 2004/07/27 16:19:41 jfb Exp $ */
+/* $OpenBSD: log.h,v 1.3 2004/08/05 13:39:01 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -53,8 +53,9 @@
#define LP_ERR LP_ERROR
#define LP_ALERT 5
#define LP_ERRNO 6
+#define LP_ABORT 7
-#define LP_MAX 6
+#define LP_MAX 7
#define LP_ALL 255
/* filtering methods */