Commit 75072662 750726626abf132dd2e24ae352d165d6a5445dcb by Sergey Poznyakoff

* configure.ac: Define LOG_FACILITY_STRING, a string

representation of syslog facility.
* mailbox/cfg_lexer.l: Re-introduce pragmatic comment
#debug=, for setting debugging level in config module.
* mailbox/cfg_parser.y: Likewise.
* mailbox/gdebug.c (mu_debug_level_from_string): Ignore trailing
newline.
* mailbox/version.c (mu_conf_option): Add SYSCONFDIR, MAILSPOOLDIR
and LOG_FACILITY.

* mh/mh_init.c (mh_list_format): Reformat to make it more
readable. Use decode primitive on header fields that may be
encoded.

* doc/texinfo/mailutils.texi: Further update.
* doc/texinfo/programs.texi: Likewise.
1 parent e6135ba6
1 2008-09-22 Sergey Poznyakoff <gray@gnu.org.ua>
2
3 * configure.ac: Define LOG_FACILITY_STRING, a string
4 representation of syslog facility.
5 * mailbox/cfg_lexer.l: Re-introduce pragmatic comment
6 #debug=, for setting debugging level in config module.
7 * mailbox/cfg_parser.y: Likewise.
8 * mailbox/gdebug.c (mu_debug_level_from_string): Ignore trailing
9 newline.
10 * mailbox/version.c (mu_conf_option): Add SYSCONFDIR, MAILSPOOLDIR
11 and LOG_FACILITY.
12
13 * mh/mh_init.c (mh_list_format): Reformat to make it more
14 readable. Use decode primitive on header fields that may be
15 encoded.
16
17 * doc/texinfo/mailutils.texi: Further update.
18 * doc/texinfo/programs.texi: Likewise.
19
1 2008-09-21 Sergey Poznyakoff <gray@gnu.org.ua> 20 2008-09-21 Sergey Poznyakoff <gray@gnu.org.ua>
2 21
3 * configure.ac: Configure doc hints. 22 * configure.ac: Configure doc hints.
......
...@@ -296,7 +296,7 @@ esac]) ...@@ -296,7 +296,7 @@ esac])
296 296
297 if test "x$MU_CONF_MAILDIR" != x; then 297 if test "x$MU_CONF_MAILDIR" != x; then
298 AC_DEFINE_UNQUOTED(MU_CONF_MAILDIR,$MU_CONF_MAILDIR, 298 AC_DEFINE_UNQUOTED(MU_CONF_MAILDIR,$MU_CONF_MAILDIR,
299 [Pathname of the configuration directory]) 299 [Pathname of the mail spool directory])
300 fi 300 fi
301 AH_BOTTOM([ 301 AH_BOTTOM([
302 #ifdef HAVE_PATHS_H 302 #ifdef HAVE_PATHS_H
...@@ -363,7 +363,11 @@ AC_ARG_WITH([log-facility], ...@@ -363,7 +363,11 @@ AC_ARG_WITH([log-facility],
363 [AC_TRY_COMPILE([#include <syslog.h>], int lf = $withval, 363 [AC_TRY_COMPILE([#include <syslog.h>], int lf = $withval,
364 log_facility=$withval)]) 364 log_facility=$withval)])
365 AC_DEFINE_UNQUOTED(LOG_FACILITY, $log_facility, 365 AC_DEFINE_UNQUOTED(LOG_FACILITY, $log_facility,
366 [Default syslog facility to use]) 366 [Default syslog facility])
367 fstr=`echo "$log_facility" | tr A-Z a-z | sed 's/log_//'`
368 AC_DEFINE_UNQUOTED(LOG_FACILITY_STRING, "$fstr",
369 [String representation of the default syslog facility])
370
367 AC_MSG_RESULT($log_facility) 371 AC_MSG_RESULT($log_facility)
368 372
369 dnl Check for headers 373 dnl Check for headers
......
...@@ -10,10 +10,18 @@ ...@@ -10,10 +10,18 @@
10 @include macros.texi 10 @include macros.texi
11 @include rendition.texi 11 @include rendition.texi
12 12
13 @c Combine indices. 13 @c Define indices
14 @defcodeindex op 14 @defcodeindex op
15 @defcodeindex fl
16 @c Same as ky, but used for configuration keywords.
17 @defcodeindex kw
18
19 @c Combine indices.
15 @syncodeindex op fn 20 @syncodeindex op fn
16 @syncodeindex tp fn 21 @syncodeindex tp fn
22 @syncodeindex fl cp
23 @c FIXME: Should kw be separate?
24 @syncodeindex kw ky
17 25
18 @ifinfo 26 @ifinfo
19 @dircategory Email 27 @dircategory Email
......
...@@ -41,6 +41,14 @@ void _mu_line_begin (void); ...@@ -41,6 +41,14 @@ void _mu_line_begin (void);
41 void _mu_line_add (char *text, size_t len); 41 void _mu_line_add (char *text, size_t len);
42 char *_mu_line_finish (void); 42 char *_mu_line_finish (void);
43 43
44 extern void mu_cfg_set_debug (void);
45 static void
46 mu_cfg_set_lex_debug (void)
47 {
48 yy_flex_debug = mu_debug_check_level (mu_cfg_get_debug (),
49 MU_DEBUG_TRACE2);
50 }
51
44 static void _mu_line_add_unescape_last (char *text, size_t len); 52 static void _mu_line_add_unescape_last (char *text, size_t len);
45 static void multiline_begin (char *p); 53 static void multiline_begin (char *p);
46 static char *multiline_strip_tabs (char *text); 54 static char *multiline_strip_tabs (char *text);
...@@ -72,6 +80,16 @@ P [1-9][0-9]* ...@@ -72,6 +80,16 @@ P [1-9][0-9]*
72 <COMMENT>\n ++mu_cfg_locus.line; 80 <COMMENT>\n ++mu_cfg_locus.line;
73 <COMMENT>"*"+"/" BEGIN (INITIAL); 81 <COMMENT>"*"+"/" BEGIN (INITIAL);
74 /* End-of-line comments */ 82 /* End-of-line comments */
83 #debug=.*\n {
84 mu_log_level_t lev;
85 mu_debug_t dbg = mu_cfg_get_debug ();
86 if (mu_debug_level_from_string (yytext + 7, &lev, dbg) == 0)
87 {
88 mu_debug_set_level (dbg, lev);
89 mu_cfg_set_debug ();
90 mu_cfg_set_lex_debug ();
91 }
92 }
75 #.*\n { mu_cfg_locus.line++; } 93 #.*\n { mu_cfg_locus.line++; }
76 #.* /* end-of-file comment */; 94 #.* /* end-of-file comment */;
77 "//".*\n { mu_cfg_locus.line++; } 95 "//".*\n { mu_cfg_locus.line++; }
...@@ -317,7 +335,7 @@ mu_get_config (const char *file, const char *progname, ...@@ -317,7 +335,7 @@ mu_get_config (const char *file, const char *progname,
317 if (flags & MU_PARSE_CONFIG_VERBOSE) 335 if (flags & MU_PARSE_CONFIG_VERBOSE)
318 mu_error (_("Info: parsing file `%s'"), file); 336 mu_error (_("Info: parsing file `%s'"), file);
319 337
320 yy_flex_debug = mu_debug_check_level (mu_cfg_get_debug (), MU_DEBUG_TRACE2); 338 mu_cfg_set_lex_debug ();
321 339
322 /* Parse configuration */ 340 /* Parse configuration */
323 mu_cfg_locus.file = (char*) file; 341 mu_cfg_locus.file = (char*) file;
......
...@@ -392,19 +392,25 @@ mu_cfg_get_debug () ...@@ -392,19 +392,25 @@ mu_cfg_get_debug ()
392 { 392 {
393 mu_debug_create (&_mu_cfg_debug, NULL); 393 mu_debug_create (&_mu_cfg_debug, NULL);
394 mu_debug_set_print (_mu_cfg_debug, _cfg_default_printer, NULL); 394 mu_debug_set_print (_mu_cfg_debug, _cfg_default_printer, NULL);
395 mu_debug_set_level (_mu_cfg_debug, mu_global_debug_level ("config"));
395 } 396 }
396 mu_debug_set_level (_mu_cfg_debug, mu_global_debug_level ("config"));
397 return _mu_cfg_debug; 397 return _mu_cfg_debug;
398 } 398 }
399 399
400 void
401 mu_cfg_set_debug ()
402 {
403 if (mu_debug_check_level (mu_cfg_get_debug (), MU_DEBUG_TRACE7))
404 yydebug = 1;
405 }
406
400 int 407 int
401 mu_cfg_parse (mu_cfg_tree_t **ptree) 408 mu_cfg_parse (mu_cfg_tree_t **ptree)
402 { 409 {
403 int rc; 410 int rc;
404 mu_cfg_tree_t *tree; 411 mu_cfg_tree_t *tree;
405 412
406 if (mu_debug_check_level (mu_cfg_get_debug (), MU_DEBUG_TRACE7)) 413 mu_cfg_set_debug ();
407 yydebug = 1;
408 414
409 _mu_cfg_errcnt = 0; 415 _mu_cfg_errcnt = 0;
410 rc = yyparse (); 416 rc = yyparse ();
......
...@@ -121,7 +121,9 @@ mu_debug_level_from_string (const char *string, mu_log_level_t *plev, ...@@ -121,7 +121,9 @@ mu_debug_level_from_string (const char *string, mu_log_level_t *plev,
121 else 121 else
122 { 122 {
123 char *p = strdup (string); 123 char *p = strdup (string);
124 124 size_t len = strlen (p);
125 if (len > 0 && p[len-1] == '\n')
126 p[len-1] = 0;
125 for (q = strtok (p, ","); q; q = strtok (NULL, ",")) 127 for (q = strtok (p, ","); q; q = strtok (NULL, ","))
126 { 128 {
127 int flag; 129 int flag;
......
...@@ -45,6 +45,9 @@ char *mu_license_text = ...@@ -45,6 +45,9 @@ char *mu_license_text =
45 45
46 static struct mu_conf_option mu_conf_option[] = { 46 static struct mu_conf_option mu_conf_option[] = {
47 { "VERSION=" VERSION, N_("Version of this package") }, 47 { "VERSION=" VERSION, N_("Version of this package") },
48 { "SYSCONFDIR=" SYSCONFDIR, N_("System configuration directory") },
49 { "MAILSPOOLDIR=" MU_PATH_MAILDIR, N_("Default mail spool directory") },
50 { "LOG_FACILITY=" LOG_FACILITY_STRING, N_("Default syslog facility") },
48 #ifdef USE_LIBPAM 51 #ifdef USE_LIBPAM
49 { "USE_LIBPAM", N_("PAM support") }, 52 { "USE_LIBPAM", N_("PAM support") },
50 #endif 53 #endif
......
...@@ -32,12 +32,14 @@ ...@@ -32,12 +32,14 @@
32 #include <fnmatch.h> 32 #include <fnmatch.h>
33 33
34 char mh_list_format[] = 34 char mh_list_format[] =
35 "%4(msg)%<(cur)+%| %>%<{replied}-%?{encrypted}E%| %>" 35 "%4(msg)"
36 "%02(mon{date})/%02(mday{date})" 36 "%<(cur)+%| %>"
37 "%<{date} %|*%>" 37 "%<{replied}-%?{encrypted}E%| %>"
38 "%<(mymbox{from})%<{to}To:%14(friendly{to})%>%>" 38 "%02(mon{date})/%02(mday{date})"
39 "%<(zero)%17(friendly{from})%>" 39 "%<{date} %|*%>"
40 " %{subject}%<{body}<<%{body}>>%>"; 40 "%<(mymbox{from})%<{to}To:%14(decode(friendly{to}))%>%>"
41 "%<(zero)%17(decode(friendly{from}))%>"
42 " %(decode{subject})%<{body}<<%{body}>>%>";
41 43
42 void 44 void
43 mh_init () 45 mh_init ()
......