put old m_snsubst into file.c as m_file_fmt.
[apps/madmutt.git] / lib-lib / str.c
index 6537746..7b57305 100644 (file)
@@ -178,30 +178,3 @@ int ascii_strncasecmp (const char *a, const char *b, ssize_t n)
 
     return 0;
 }
-
-ssize_t m_snsubst(char *dst, ssize_t n, const char *fmt, const char *src)
-{
-    ssize_t pos = 0;
-    const char *p;
-
-    p = strchr(fmt, '%');
-    if (!p)
-        return snprintf(dst, n, "%s %s", fmt, src);
-
-    for (;;) {
-        if (p[1] == 's') {
-            pos += m_strncpy(dst + pos, n - pos, fmt, p - fmt);
-            pos += m_strcpy(dst + pos, n - pos, src);
-            fmt = p + 2;
-        } else {
-            pos += m_strncpy(dst + pos, n - pos, fmt, p + 1 - fmt);
-            fmt = p + 1;
-            if (p[1] == '%')
-                p++;
-        }
-
-        p = strchr(fmt, '%');
-        if (!p)
-            return pos + m_strcpy(dst + pos, n - pos, fmt);
-    }
-}