some muttbug remains
[apps/madmutt.git] / makedoc.c
index 88305db..df72d5d 100644 (file)
--- a/makedoc.c
+++ b/makedoc.c
@@ -31,6 +31,7 @@
 #include <ctype.h>
 
 #include <errno.h>
+#include <lib-lib/str.h>
 
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
@@ -191,7 +192,7 @@ static void add_var (const char *name)
 {
   outbuf = realloc (outbuf, (++outcount) * sizeof (var_t));
   outbuf[outcount - 1].seen = 0;
-  outbuf[outcount - 1].name = strdup (name);
+  outbuf[outcount - 1].name = strdup(name);
   outbuf[outcount - 1].descr = NULL;
 }
 
@@ -207,7 +208,7 @@ static int add_s (const char *s)
   }
 
   if (lold == 0)
-    outbuf[outcount - 1].descr = strdup (s);
+    outbuf[outcount - 1].descr = strdup(s);
   else {
     outbuf[outcount - 1].descr =
       realloc (outbuf[outcount - 1].descr, lold + lnew + 1);
@@ -513,13 +514,13 @@ static void handle_confline (char *s)
       return;
   }
 
-  memset (val, 0, sizeof (val));
+  memset(val, 0, sizeof(val));
 
   do {
     if (!strcmp (buff, "}"))
       break;
 
-    strncpy (val + STRLEN (val), buff, sizeof (val) - STRLEN (val));
+    m_strcat(val, sizeof(val), buff);
   }
   while ((s = get_token (buff, sizeof (buff), s)));
 
@@ -608,14 +609,17 @@ static int sgml_fputc (int c)
     return add_s ("&lt;");
   case '>':
     return add_s ("&gt;");
+#if 0
   case '$':
     return add_s ("&dollar;");
   case '_':
     return add_s ("&lowbar;");
   case '%':
     return add_s ("&percnt;");
+#endif
   case '&':
     return add_s ("&amp;");
+#if 0
   case '\\':
     return add_s ("&bsol;");
   case '"':
@@ -626,6 +630,7 @@ static int sgml_fputc (int c)
     return add_s ("&rsqb;");
   case '~':
     return add_s ("&tilde;");
+#endif
   default:
     return add_c (c);
   }
@@ -733,16 +738,11 @@ static void print_confline (const char *varname, int type, const char *val)
     /* SGML based manual */
   case F_SGML:
     {
-      add_s ("\n<sect1 id=\"");
-      sgml_id_fputs (varname);
-      add_s ("\">\n<title>");
+      add_s ("\n<madmutt-doc:vardef name=\"");
       sgml_fputs (varname);
-      add_s ("</title>\n<para>Type: <literal>");
+      add_s ("\">\n<para>Type: <literal>");
       add_s (type2human (type));
       add_s ("</literal></para>\n");
-      add_s ("<indexterm><primary>Configuration Variables</primary><secondary>");
-      sgml_fputs (varname);
-      add_s ("</secondary></indexterm>\n\n");
 
       if (type == DT_STR || type == DT_RX || type == DT_ADDR
           || type == DT_PATH) {
@@ -1164,7 +1164,7 @@ static int print_it (int special, char *str, int docstat)
         }
       case SP_END_SECT:
         {
-          add_s ("</sect1>\n");
+          add_s ("</madmutt-doc:vardef>\n");
           break;
         }
       case SP_STR:
@@ -1201,7 +1201,7 @@ void print_ref (int output_dollar, const char *ref)
     sgml_id_fputs (ref);
     add_s ("\">\n");
     if (output_dollar)
-      add_s ("&dollar;");
+      add_s ("$");
     sgml_fputs (ref);
     add_s ("</link>");
     break;