Created
December 7, 2018 02:06
-
-
Save liushapku/063ef225a3e9f301b00c725e28a3c28a to your computer and use it in GitHub Desktop.
a patch make vim able to log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/ex_docmd.c b/src/ex_docmd.c | |
index 9040c0d07..e7f040fc2 100644 | |
--- a/src/ex_docmd.c | |
+++ b/src/ex_docmd.c | |
@@ -1,3 +1,23 @@ | |
+#include <stdio.h> | |
+#include <stdarg.h> | |
+int shouldout = 0; | |
+int mprintf(char *fmt, ...) | |
+{ | |
+ static FILE * pf = NULL; | |
+ if (shouldout) | |
+ { | |
+ if (pf == NULL) | |
+ pf = fopen("/dev/pts/26", "w"); | |
+ int ret; | |
+ va_list myargs; | |
+ va_start(myargs, fmt); | |
+ ret = vfprintf(pf, fmt, myargs); | |
+ va_end(myargs); | |
+ return ret; | |
+ } | |
+ return 0; | |
+} | |
+ | |
/* vi:set ts=8 sts=4 sw=4 noet: | |
* | |
* VIM - Vi IMproved by Bram Moolenaar | |
diff --git a/src/vim.h b/src/vim.h | |
index be86c6b10..f2ce16ff7 100644 | |
--- a/src/vim.h | |
+++ b/src/vim.h | |
@@ -1,3 +1,6 @@ | |
+extern int shouldout; | |
+int mprintf(char * fmt, ...); | |
+ | |
/* vi:set ts=8 sts=4 sw=4 noet: | |
* | |
* VIM - Vi IMproved by Bram Moolenaar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment