more tweaks and fixes.
authorPierre Habouzit <madcoder@debian.org>
Sun, 26 Nov 2006 22:13:15 +0000 (23:13 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 26 Nov 2006 22:13:15 +0000 (23:13 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Makefile.am
makedoc.c

index 22c1888..ba97c23 100644 (file)
@@ -116,14 +116,14 @@ install-exec-hook:
                { echo "Can't fix madmutt_dotlock's permissions!" >&2 ; } \
        fi
 
                { echo "Can't fix madmutt_dotlock's permissions!" >&2 ; } \
        fi
 
-install-data-local: madmuttrc
+install-data-local: Madmuttrc
        $(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir)
        $(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir)
-       -if [ -f $(DESTDIR)$(pkgdatadir)/madmuttrc ] ; then \
-               mv $(DESTDIR)$(pkgdatadir)/madmuttrc* $(DESTDIR)$(sysconfdir) ; \
-       elif [ -f $(DESTDIR)$(pkgdatadir)/../madmuttrc ] ; then \
-               mv $(DESTDIR)$(pkgdatadir)/../madmuttrc* $(DESTDIR)$(sysconfdir) ; \
-       elif [ ! -f $(DESTDIR)$(sysconfdir)/madmuttrc ] ; then \
-               $(INSTALL) -m 644 madmuttrc $(DESTDIR)$(sysconfdir) ; \
+       -if [ -f $(DESTDIR)$(pkgdatadir)/Madmuttrc ] ; then \
+               mv $(DESTDIR)$(pkgdatadir)/Madmuttrc* $(DESTDIR)$(sysconfdir) ; \
+       elif [ -f $(DESTDIR)$(pkgdatadir)/../Madmuttrc ] ; then \
+               mv $(DESTDIR)$(pkgdatadir)/../Madmuttrc* $(DESTDIR)$(sysconfdir) ; \
+       elif [ ! -f $(DESTDIR)$(sysconfdir)/Madmuttrc ] ; then \
+               $(INSTALL) -m 644 Madmuttrc $(DESTDIR)$(sysconfdir) ; \
        fi
        -if [ ! -f $(DESTDIR)$(sysconfdir)/madmutt-mime.types ]; then \
                $(INSTALL) -m 644 $(srcdir)/mime.types $(DESTDIR)$(sysconfdir)/madmutt-mime.types; \
        fi
        -if [ ! -f $(DESTDIR)$(sysconfdir)/madmutt-mime.types ]; then \
                $(INSTALL) -m 644 $(srcdir)/mime.types $(DESTDIR)$(sysconfdir)/madmutt-mime.types; \
@@ -141,12 +141,12 @@ mutt-dist:
 update-doc: stamp-doc-rc
        (cd doc && $(MAKE) update-doc)
 
 update-doc: stamp-doc-rc
        (cd doc && $(MAKE) update-doc)
 
-madmuttrc: stamp-doc-rc
+Madmuttrc: stamp-doc-rc
 
 
-stamp-doc-rc: $(srcdir)/init.h makedoc madmuttrc.head
-       -rm -f madmuttrc stamp-doc-rc
+stamp-doc-rc: $(srcdir)/init.h makedoc Madmuttrc.head
+       -rm -f Madmuttrc stamp-doc-rc
        $(CPP) $(INCLUDES) $(DEFS) $(CPPFLAGS) -D_MAKEDOC -C \
        $(CPP) $(INCLUDES) $(DEFS) $(CPPFLAGS) -D_MAKEDOC -C \
-               $(srcdir)/init.h | ./makedoc -c | cat madmuttrc.head - > madmuttrc
+               $(srcdir)/init.h | ./makedoc -c | cat Madmuttrc.head - > Madmuttrc
        touch stamp-doc-rc
 
 
        touch stamp-doc-rc
 
 
index b8a120f..69df277 100644 (file)
--- a/makedoc.c
+++ b/makedoc.c
 # include <getopt.h>
 #endif
 
 # include <getopt.h>
 #endif
 
-#ifndef HAVE_STRERROR
-#ifndef STDC_HEADERS
-extern int sys_nerr;
-extern char *sys_errlist[];
-#endif
-
-#define strerror(x) ((x) > 0 && (x) < sys_nerr) ? sys_errlist[(x)] : 0
-#endif /* !HAVE_STRERROR */
-
-extern int optind;
-
-#define BUFFSIZE 2048
-
-#define STRLEN(s) (s ? strlen(s) : 0)
-
 typedef struct {
   short seen;
   char *name;
 typedef struct {
   short seen;
   char *name;
@@ -180,7 +165,7 @@ static void add_var (const char *name)
 
 static int add_s (const char *s)
 {
 
 static int add_s (const char *s)
 {
-  size_t lnew = STRLEN (s), lold = STRLEN (outbuf[outcount - 1].descr);
+  size_t lnew = m_strlen(s), lold = m_strlen(outbuf[outcount - 1].descr);
 
   if (lnew == 0)
     return (0);
 
   if (lnew == 0)
     return (0);
@@ -210,8 +195,8 @@ static int add_c (int c)
 
 static void makedoc (FILE * in, FILE * out)
 {
 
 static void makedoc (FILE * in, FILE * out)
 {
-  char buffer[BUFFSIZE];
-  char token[BUFFSIZE];
+  char buffer[BUFSIZ];
+  char token[BUFSIZ];
   char *p;
   int active = 0;
   int line = 0;
   char *p;
   int active = 0;
   int line = 0;
@@ -274,7 +259,6 @@ static char *get_token (char *d, size_t l, char *s)
 {
   char *t;
   short is_quoted = 0;
 {
   char *t;
   short is_quoted = 0;
-  char *dd = d;
 
   s = skip_ws (s);
 
 
   s = skip_ws (s);
 
@@ -363,26 +347,24 @@ enum {
 };
 
 struct {
 };
 
 struct {
-  char *machine;
-  char *human;
+  const char *machine;
+  const char *human;
 } types[] = {
 } types[] = {
-  {
-  "DT_NONE", "-none-"}, {
-  "DT_BOOL", "boolean"}, {
-  "DT_NUM", "number"}, {
-  "DT_STR", "string"}, {
-  "DT_PATH", "path"}, {
-  "DT_QUAD", "quadoption"}, {
-  "DT_SORT", "sort order"}, {
-  "DT_RX", "regular expression"}, {
-  "DT_MAGIC", "folder magic"}, {
-  "DT_SYN", NULL}, {
-  "DT_ADDR", "e-mail address"}, {
-  "DT_SYS", "system property"}, {
-  NULL, NULL}
+  {"DT_NONE",  "-none-"},
+  {"DT_BOOL",  "boolean"},
+  {"DT_NUM",   "number"},
+  {"DT_STR",   "string"},
+  {"DT_PATH",  "path"},
+  {"DT_QUAD",  "quadoption"},
+  {"DT_SORT",  "sort order"},
+  {"DT_RX",    "regular expression"},
+  {"DT_MAGIC", "folder magic"},
+  {"DT_SYN",   NULL},
+  {"DT_ADDR",  "e-mail address"},
+  {"DT_SYS",   "system property"},
+  {NULL, NULL}
 };
 
 };
 
-
 static int buff2type (const char *s)
 {
   int type;
 static int buff2type (const char *s)
 {
   int type;
@@ -400,11 +382,11 @@ static const char *type2human (int type)
 }
 static void handle_confline (char *s)
 {
 }
 static void handle_confline (char *s)
 {
-  char varname[BUFFSIZE];
-  char buff[BUFFSIZE];
+  char varname[BUFSIZ];
+  char buff[BUFSIZ];
   int type;
 
   int type;
 
-  char val[BUFFSIZE];
+  char val[BUFSIZ];
 
   /* xxx - put this into an actual state machine? */
 
 
   /* xxx - put this into an actual state machine? */
 
@@ -853,7 +835,7 @@ static int print_it (int special, char *str, int docstat)
           if (docstat & D_DT) {
             int i;
 
           if (docstat & D_DT) {
             int i;
 
-            for (i = STRLEN (str); i < 8; i++)
+            for (i = m_strlen(str); i < 8; i++)
               add_c (' ');
             docstat &= ~D_DT;
             docstat |= D_NL;
               add_c (' ');
             docstat &= ~D_DT;
             docstat |= D_NL;
@@ -1114,7 +1096,7 @@ static int print_it (int special, char *str, int docstat)
   return docstat;
 }
 
   return docstat;
 }
 
-void print_ref (int output_dollar, const char *ref)
+static void print_ref (int output_dollar, const char *ref)
 {
   switch (OutputFormat) {
   case F_CONF:
 {
   switch (OutputFormat) {
   case F_CONF:
@@ -1152,7 +1134,7 @@ static int commit_buff (char *buff, char **d, int docstat)
 
 static int handle_docline (char *l, int docstat)
 {
 
 static int handle_docline (char *l, int docstat)
 {
-  char buff[BUFFSIZE];
+  char buff[BUFSIZ];
   char *s, *d;
 
   l = skip_ws (l);
   char *s, *d;
 
   l = skip_ws (l);