X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=makedoc.c;h=71864be87269720128d7a043bcd8d7d64767a012;hp=54f35494e5e2a0fea8cfe6208ca887070ea196d6;hb=452ffdd4bbcd8f2dd9e4811c115824b556814ebb;hpb=11dfc0aa39e31496da16c708f972a6718dd7ee5c diff --git a/makedoc.c b/makedoc.c index 54f3549..71864be 100644 --- a/makedoc.c +++ b/makedoc.c @@ -114,7 +114,6 @@ static int print_it (int, char *, int); static void print_confline (const char *, int, const char *); static void handle_confline (char *); static void makedoc (FILE *, FILE *); -static void pretty_default (char *, size_t, const char *, int); static int sgml_fputc (int); static int sgml_fputs (const char *); static void add_var (const char *); @@ -397,7 +396,8 @@ enum { DT_RX, DT_MAGIC, DT_SYN, - DT_ADDR + DT_ADDR, + DT_SYS }; struct { @@ -416,6 +416,7 @@ struct { "DT_MAGIC", "folder magic"}, { "DT_SYN", NULL}, { "DT_ADDR", "e-mail address"}, { + "DT_SYS", "system property"}, { NULL, NULL} }; @@ -439,7 +440,6 @@ static void handle_confline (char *s) { char varname[BUFFSIZE]; char buff[BUFFSIZE]; - char tmp[BUFFSIZE]; int type; char val[BUFFSIZE]; @@ -507,80 +507,20 @@ static void handle_confline (char *s) return; } - memset (tmp, 0, sizeof (tmp)); + memset (val, 0, sizeof (val)); do { if (!strcmp (buff, "}")) break; - strncpy (tmp + STRLEN (tmp), buff, sizeof (tmp) - STRLEN (tmp)); + strncpy (val + STRLEN (val), buff, sizeof (val) - STRLEN (val)); } while ((s = get_token (buff, sizeof (buff), s))); - pretty_default (val, sizeof (val), tmp, type); add_var (varname); print_confline (varname, type, val); } -static void pretty_default (char *t, size_t l, const char *s, int type) -{ - memset (t, 0, l); - l--; - - switch (type) { - case DT_QUAD: - { - if (!strcasecmp (s, "M_YES")) - strncpy (t, "yes", l); - else if (!strcasecmp (s, "M_NO")) - strncpy (t, "no", l); - else if (!strcasecmp (s, "M_ASKYES")) - strncpy (t, "ask-yes", l); - else if (!strcasecmp (s, "M_ASKNO")) - strncpy (t, "ask-no", l); - break; - } - case DT_BOOL: - { - if (atoi (s)) - strncpy (t, "yes", l); - else - strncpy (t, "no", l); - break; - } - case DT_SORT: - { - /* heuristic! */ - strncpy (t, s + 5, l); - for (; *t; t++) - *t = tolower ((unsigned char) *t); - break; - } - case DT_MAGIC: - { - /* heuristic! */ - strncpy (t, s + 2, l); - for (; *t; t++) - *t = tolower ((unsigned char) *t); - break; - } - case DT_STR: - case DT_RX: - case DT_ADDR: - case DT_PATH: - { - if (!strcmp (s, "0")) - break; - /* fallthrough */ - } - default: - { - strncpy (t, s, l); - break; - } - } -} - static void char_to_escape (char *dest, unsigned int c) { switch (c) { @@ -703,11 +643,18 @@ static void print_confline (const char *varname, int type, const char *val) /* configuration file */ case F_CONF: { + if (type == DT_SYS) { + add_s ("\n# set ?"); + add_s (varname); + add_s (" prints "); + add_s (val); + break; + } if (type == DT_STR || type == DT_RX || type == DT_ADDR || type == DT_PATH) { add_s ("\n# set "); add_s (varname); - add_s ("\""); + add_s ("=\""); conf_print_strval (val); add_s ("\""); } @@ -753,7 +700,7 @@ static void print_confline (const char *varname, int type, const char *val) add_s ("\\(rq\n"); } else { - add_s ("Default: "); + add_s (type == DT_SYS ? "Value: " : "Default: "); add_s (val); add_c ('\n'); } @@ -781,7 +728,9 @@ static void print_confline (const char *varname, int type, const char *val) add_s ("&dquot;"); } else { - add_s ("

\nDefault: "); + add_s ("

\n"); + add_s (type == DT_SYS ? "Value: " : "Default: "); + add_s (""); add_s (val); add_s (""); }