diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-09-29 18:55:59 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-09-29 18:55:59 +0000 |
commit | e0bf3a5e4f6bbf1e500266e81bb2cc626f4ad19e (patch) | |
tree | 3ce5e0c9e233e17c3efbca727553000bb04d89aa | |
parent | d482c65ebc371b07d64450d169b513d389185d0d (diff) | |
download | mailutils-e0bf3a5e4f6bbf1e500266e81bb2cc626f4ad19e.tar.gz mailutils-e0bf3a5e4f6bbf1e500266e81bb2cc626f4ad19e.tar.bz2 |
Bugfixes.
* config/mailutils-config.c (main): Do not print flag descriptions
on --info, this breaks existing scripts.
New option --verbose makes --info print verbose descriptions.
* include/mailutils/version.h (mu_fprint_options)
(mu_fprint_conf_option): Take additional argument.
* mailbox/argcv.c (quote_transtab): Handle \".
* mailbox/cfg_driver.c (mu_cfg_string_value_cb): Bugfix
* mailbox/cfg_lexer.l: Allow * and = in non-quoted words.
Improve 'stray character' diagnostics'.
(unescape_to_line): Handle \\ and \".
* mailbox/version.c (mu_fprint_options)
(mu_fprint_conf_option): New argument `verbose' instructs whether
to print textual descriptions.
(mu_fprint_conf_option): Print single space after the flag to
facilitate writing parser scripts.
* testsuite/lib/mailutils.exp: Reflect this change.
-rw-r--r-- | config/mailutils-config.c | 11 | ||||
-rw-r--r-- | include/mailutils/version.h | 5 | ||||
-rw-r--r-- | lib/.cvsignore | 3 | ||||
-rw-r--r-- | m4/.cvsignore | 2 | ||||
-rw-r--r-- | mailbox/argcv.c | 2 | ||||
-rw-r--r-- | mailbox/cfg_driver.c | 10 | ||||
-rw-r--r-- | mailbox/cfg_lexer.l | 13 | ||||
-rw-r--r-- | mailbox/version.c | 12 | ||||
-rw-r--r-- | testsuite/lib/mailutils.exp | 2 |
9 files changed, 43 insertions, 17 deletions
diff --git a/config/mailutils-config.c b/config/mailutils-config.c index d5dc36dd7..49160d251 100644 --- a/config/mailutils-config.c +++ b/config/mailutils-config.c @@ -40,6 +40,8 @@ static struct argp_option options[] = { "for. In this case the program prints those options from this list that " "have been defined. It exits with zero status if all of the " "specified options are defined. Otherwise, the exit status is 1."), 0}, + {"verbose", 'v', NULL, 0, + N_("Increase output verbosity"), 0}, {0, 0, 0, 0} }; @@ -51,6 +53,7 @@ enum config_mode { }; enum config_mode mode; +int verbose; static error_t parse_opt (int key, char *arg, struct argp_state *state) @@ -68,6 +71,10 @@ parse_opt (int key, char *arg, struct argp_state *state) case 'i': mode = MODE_INFO; break; + + case 'v': + verbose++; + break; default: return ARGP_ERR_UNKNOWN; @@ -269,7 +276,7 @@ main (int argc, char **argv) case MODE_INFO: if (argc == 0) - mu_print_options (); + mu_fprint_options (stdout, verbose); else { int i, found = 0; @@ -280,7 +287,7 @@ main (int argc, char **argv) if (opt) { found++; - mu_fprint_conf_option (stdout, opt); + mu_fprint_conf_option (stdout, opt, verbose); } } return found == argc ? 0 : 1; diff --git a/include/mailutils/version.h b/include/mailutils/version.h index 156dc04dc..d875f4d25 100644 --- a/include/mailutils/version.h +++ b/include/mailutils/version.h @@ -33,8 +33,9 @@ struct mu_conf_option extern char *mu_license_text; extern void mu_print_options (void); -extern void mu_fprint_options (FILE *fp); -extern void mu_fprint_conf_option (FILE *fp, const struct mu_conf_option *opt); +extern void mu_fprint_options (FILE *fp, int verbose); +extern void mu_fprint_conf_option (FILE *fp, const struct mu_conf_option *opt, + int verbose); extern const struct mu_conf_option *mu_check_option (char *name); #ifdef __cplusplus diff --git a/lib/.cvsignore b/lib/.cvsignore index 9056b919a..c077bd59e 100644 --- a/lib/.cvsignore +++ b/lib/.cvsignore @@ -40,6 +40,8 @@ dirname.c dirname.h dup-safer.c dup2.c +errno.h +errno.in.h error.c error.h exitfail.c @@ -138,6 +140,7 @@ stdbool.in.h stdint.h stdint.in.h stdio-impl.h +stdio-write.c stdio.h stdio.in.h stdlib.h diff --git a/m4/.cvsignore b/m4/.cvsignore index 45617ed7c..75a247768 100644 --- a/m4/.cvsignore +++ b/m4/.cvsignore @@ -19,6 +19,7 @@ dup2.m4 eealloc.m4 environ.m4 eoverflow.m4 +errno_h.m4 error.m4 exitfail.m4 extensions.m4 @@ -103,6 +104,7 @@ strnlen.m4 strtok_r.m4 sys_stat_h.m4 sysexits.m4 +threadlib.m4 unistd-safer.m4 unistd_h.m4 vasnprintf.m4 diff --git a/mailbox/argcv.c b/mailbox/argcv.c index 4fbc31964..8921bfb1e 100644 --- a/mailbox/argcv.c +++ b/mailbox/argcv.c @@ -159,7 +159,7 @@ argcv_scan (struct argcv_info *ap) return ap->save; } -static char quote_transtab[] = "\\\\a\ab\bf\fn\nr\rt\t"; +static char quote_transtab[] = "\\\\\"\"a\ab\bf\fn\nr\rt\t"; int argcv_unquote_char (int c) diff --git a/mailbox/cfg_driver.c b/mailbox/cfg_driver.c index 052455252..8ec67291c 100644 --- a/mailbox/cfg_driver.c +++ b/mailbox/cfg_driver.c @@ -693,6 +693,8 @@ mu_cfg_string_value_cb (mu_debug_t debug, mu_config_value_t *val, int (*fun) (mu_debug_t, const char *, void *), void *data) { + int rc = 0; + switch (val->type) { case MU_CFG_STRING: @@ -723,10 +725,14 @@ mu_cfg_string_value_cb (mu_debug_t debug, mu_config_value_t *val, mu_config_value_t *pval; mu_iterator_current (itr, (void*) &pval); if (mu_cfg_assert_value_type (pval, MU_CFG_STRING, debug)) - fun (debug, pval->v.string, data); + { + rc = 1; + break; + } + fun (debug, pval->v.string, data); } mu_iterator_destroy (&itr); } } - return 0; + return rc; } diff --git a/mailbox/cfg_lexer.l b/mailbox/cfg_lexer.l index ec1202564..0e4789f1c 100644 --- a/mailbox/cfg_lexer.l +++ b/mailbox/cfg_lexer.l @@ -101,7 +101,7 @@ P [1-9][0-9]* yylval.string = _mu_line_finish (); return MU_TOK_IDENT; } /* Strings */ -[a-zA-Z0-9_\./:-]+ { _mu_line_begin (); +[a-zA-Z0-9_\./:\*=-]+ { _mu_line_begin (); _mu_line_add (yytext, yyleng); yylval.string = _mu_line_finish (); return MU_TOK_STRING; } @@ -149,7 +149,14 @@ P [1-9][0-9]* /* Other tokens */ \n { mu_cfg_locus.line++; } [,;{}()] return yytext[0]; -. mu_cfg_perror (&mu_cfg_locus, _("stray character \\%03o"), yytext[0]); +. { if (isascii (yytext[0]) && isprint (yytext[0])) + mu_cfg_perror (&mu_cfg_locus, + _("stray character %c"), yytext[0]); + else + mu_cfg_perror (&mu_cfg_locus, + _("stray character \\%03o"), + (unsigned char) yytext[0]); + } %% int @@ -164,7 +171,7 @@ unescape_to_line (int c) if (c != '\n') { char t = mu_argcv_unquote_char (c); - if (t == c) + if (t == c && t != '\\' && t != '\"') mu_cfg_perror (&mu_cfg_locus, _("unknown escape sequence '\\%c'"), c); mu_opool_append_char (pool, t); } diff --git a/mailbox/version.c b/mailbox/version.c index dca5c9ed9..179ec8faf 100644 --- a/mailbox/version.c +++ b/mailbox/version.c @@ -127,27 +127,27 @@ static struct mu_conf_option mu_conf_option[] = { }; void -mu_fprint_conf_option (FILE *fp, const struct mu_conf_option *opt) +mu_fprint_conf_option (FILE *fp, const struct mu_conf_option *opt, int verbose) { fprintf (fp, "%s", opt->name); - if (opt->descr) - fprintf (fp, "\t- %s", _(opt->descr)); + if (verbose && opt->descr) + fprintf (fp, " \t- %s", _(opt->descr)); fputc('\n', fp); } void -mu_fprint_options (FILE *fp) +mu_fprint_options (FILE *fp, int verbose) { int i; for (i = 0; mu_conf_option[i].name; i++) - mu_fprint_conf_option (fp, mu_conf_option + i); + mu_fprint_conf_option (fp, mu_conf_option + i, verbose); } void mu_print_options () { - mu_fprint_options (stdout); + mu_fprint_options (stdout, 1); } const struct mu_conf_option * diff --git a/testsuite/lib/mailutils.exp b/testsuite/lib/mailutils.exp index 97cd47803..24d7cfa9b 100644 --- a/testsuite/lib/mailutils.exp +++ b/testsuite/lib/mailutils.exp @@ -372,7 +372,7 @@ proc mu_version {} { set output [remote_exec host "$MU_TOOL --show-config-options"] set flg [split [lindex $output 1] "\n"] for {set i 0} {$i < [llength $flg]} {incr i} { - regsub "(\t.*)?\r" [lindex $flg $i] "" string + regsub "( .*)?\r" [lindex $flg $i] "" string if [regexp "(.*)=(.*)" $string var name value] { set MU_CAPABILITY($name) $value } elseif {$string != ""} { |