On Wednesday, 05 September 2007 at 16:29, Rocco Rutte wrote: > Hi, > > the attached patch pretty-prints values for string based options. I'm not > really sure if we really need this for all cases (esp. pretty-printing for > paths), but to me it simply looks better if \r, \n and \t are pretty-printed > and " as well as \ are properly escaped. Good idea, especially considering the set my_foo=$foo construction. > diff --git a/init.c b/init.c > index 100caf7..be14882 100644 > +++ b/init.c > @@ -1676,6 +1676,47 @@ static void mutt_restore_default (struct option_t *p) > set_option (OPTREDRAWTREE); > } > > +static void pretty_var (char *dst, size_t len, const char *option, const > char *val) > +{ > + char *p = dst; > + size_t l = mutt_strlen (option); > + > + len -= 2; /* save room for "\0 */ Is this safe if len starts out less than 2? Not that it's likely, but...
Attachment:
pgpiksUl4Q61V.pgp
Description: PGP signature