diff src/message.c @ 2280:941ff1cd317a vim73

Add file save counter to undo information. Add undotree() function.
author Bram Moolenaar <bram@vim.org>
date Sun, 27 Jun 2010 01:15:55 +0200
parents f42e0b5ff9e9
children ccda151dde4e
line wrap: on
line diff
--- a/src/message.c
+++ b/src/message.c
@@ -3973,6 +3973,47 @@ tv_float(tvs, idxp)
 /* 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, ...)