summaryrefslogtreecommitdiff
path: root/usr.bin/mg/kbd.c
diff options
context:
space:
mode:
authorMark Lumsden <lum@cvs.openbsd.org>2019-06-10 06:52:45 +0000
committerMark Lumsden <lum@cvs.openbsd.org>2019-06-10 06:52:45 +0000
commitb4f8ec3b47b0f12a4b7eb3b7578b39d80cd6a7be (patch)
tree91a45191ebc52bba568a8126e94942af9295dac0 /usr.bin/mg/kbd.c
parent77b4a2b36270cf999ecc42277a6934e85edd94eb (diff)
Allow mg to log its internal status to a file. At the moment it only
logs line information like front and back pointers in the linked list, how many characters are used and where the cursor is placed in the file. With this diff logging is not switched on by default and has to compiled into mg. -DMGLOG has to be added to the Makefile: CFLAGS+=-Wall -DREGEX -DMGLOG And the comment character removed from: #SRCS+= log.c ok bcallah@
Diffstat (limited to 'usr.bin/mg/kbd.c')
-rw-r--r--usr.bin/mg/kbd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/mg/kbd.c b/usr.bin/mg/kbd.c
index 1d7a1a2a39c..0e733e15712 100644
--- a/usr.bin/mg/kbd.c
+++ b/usr.bin/mg/kbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kbd.c,v 1.30 2015/09/26 21:51:58 jasper Exp $ */
+/* $OpenBSD: kbd.c,v 1.31 2019/06/10 06:52:44 lum Exp $ */
/* This file is in the public domain. */
@@ -15,6 +15,10 @@
#include "key.h"
#include "macro.h"
+#ifdef MGLOG
+#include "log.h"
+#endif
+
#define METABIT 0x80
#define PROMPTL 80
@@ -152,6 +156,11 @@ doin(void)
getkey(TRUE)), &curmap)) == NULL)
/* nothing */;
+#ifdef MGLOG
+ if (!mglog(funct))
+ ewprintf("Problem with logging");
+#endif
+
if (macrodef && macrocount < MAXMACRO)
macro[macrocount++].m_funct = funct;