Add file save counter to undo information. Add undotree() function.
diff --git a/src/message.c b/src/message.c
index f234a9d..c00846e 100644
--- a/src/message.c
+++ b/src/message.c
@@ -3973,6 +3973,47 @@
/* When generating prototypes all of this is skipped, cproto doesn't
* understand this. */
#ifndef PROTO
+
+# ifdef HAVE_STDARG_H
+/* Like vim_vsnprintf() but append to the string. */
+ int
+vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
+{
+ va_list ap;
+ int str_l;
+ size_t len = STRLEN(str);
+ size_t space;
+
+ if (str_m <= len)
+ space = 0;
+ else
+ space = str_m - len;
+ va_start(ap, fmt);
+ str_l = vim_vsnprintf(str + len, space, fmt, ap, NULL);
+ va_end(ap);
+ return str_l;
+}
+# else
+/* Like vim_vsnprintf() but append to the string. */
+ int
+vim_snprintf_add(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
+ char *str;
+ size_t str_m;
+ char *fmt;
+ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
+{
+ size_t len = STRLEN(str);
+ size_t space;
+
+ if (str_m <= len)
+ space = 0;
+ else
+ space = str_m - len;
+ return vim_vsnprintf(str + len, space, fmt,
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
+}
+# endif
+
# ifdef HAVE_STDARG_H
int
vim_snprintf(char *str, size_t str_m, char *fmt, ...)