From e2550f03c9679b6fcc5240f9cda48bd5a9951e3a Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Wed, 20 Apr 2016 08:19:24 +0200 Subject: [PATCH] Make default scan/inc listing file-based There's now a new format file etc/scan.default, which contains the default scan listing. Previously it was hard-coded as a define in h/scansbr.h. The default scan listing format can be set in config/config.h and can be queried with `mhparam scanformat'. --- config/config.c | 1 + etc/Makefile.in | 3 ++- etc/scan.default | 8 ++++++++ h/mh.h | 1 + h/scansbr.h | 9 --------- uip/fmtdump.c | 6 ++---- uip/inc.c | 4 ++-- uip/mhparam.c | 1 + uip/scan.c | 6 ++---- 9 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 etc/scan.default diff --git a/config/config.c b/config/config.c index 2bf7325..5e25041 100644 --- a/config/config.c +++ b/config/config.c @@ -62,6 +62,7 @@ char *digestcomps = "digestcomps"; /* forw -digest */ /* standard format (filter) files */ char *mhlformat = "mhl.format"; /* show */ char *mhlreply = "mhl.reply"; /* repl */ +char *scanformat = "scan.default"; /* scan/inc */ /* diff --git a/etc/Makefile.in b/etc/Makefile.in index da3bb51..fd00e0d 100644 --- a/etc/Makefile.in +++ b/etc/Makefile.in @@ -31,7 +31,8 @@ STATIC_FILES = components digestcomps distcomps forwcomps \ mhl.reply rcvdistcomps rcvdistcomps.outbox \ replcomps replgroupcomps scan.MMDDYY scan.YYYYMMDD \ scan.nmh scan.mailx scan.nomime scan.size scan.time \ - scan.timely scan.unseen scan.meillo mhn.defaults + scan.timely scan.unseen scan.meillo scan.default \ + mhn.defaults # ========= DEPENDENCIES FOR BUILDING ========== diff --git a/etc/scan.default b/etc/scan.default new file mode 100644 index 0000000..902998a --- /dev/null +++ b/etc/scan.default @@ -0,0 +1,8 @@ +%; +%; default scan/inc listing format +%; +%4(msg)%<(cur)+%| %>%<{replied}-%| %>\ +%4(year{date})-%02(mon{date})-%02(mday{date}) \ +%02(hour{date}):%02(min{date}) \ +%<(mymbox{from})%<{to}To:%14(decode(friendly{to}))%>%>\ +%<(zero)%17(decode(friendly{from}))%> %(decode{subject}) diff --git a/h/mh.h b/h/mh.h index 33b38ee..a5a12ce 100644 --- a/h/mh.h +++ b/h/mh.h @@ -281,6 +281,7 @@ extern char *psequence; extern char *rcvdistcomps; extern char *replcomps; extern char *replgroupcomps; +extern char *scanformat; extern char *sendmail; extern char *seq_all; extern char *seq_beyond; diff --git a/h/scansbr.h b/h/scansbr.h index 91b2ff6..5e5816d 100644 --- a/h/scansbr.h +++ b/h/scansbr.h @@ -10,15 +10,6 @@ extern char *scanl; #define SCNNUM (-2) /* number out of range */ #define SCNFAT (-3) /* fatal error */ -/* -** default format for `scan' and `inc' -*/ -# define FORMAT \ -"=%4(msg)%<(cur)+%| %>%<{replied}-%| %>\ -%4(year{date})-%02(mon{date})-%02(mday{date}) %02(hour{date}):%02(min{date}) \ -%<(mymbox{from})%<{to}To:%14(decode(friendly{to}))%>%>\ -%<(zero)%17(decode(friendly{from}))%> %(decode{subject})\n" - #define WIDTH 78 #define SCN_MBOX (-1) diff --git a/uip/fmtdump.c b/uip/fmtdump.c index 5266235..a91333b 100644 --- a/uip/fmtdump.c +++ b/uip/fmtdump.c @@ -89,10 +89,8 @@ main(int argc, char **argv) form = cp; } - /* - ** Get new format string. Must be before chdir(). - */ - fmtstr = new_fs(form, FORMAT); + /* Set format string. Must be before chdir(). */ + fmtstr = new_fs(form, scanformat); fmt_compile(fmtstr, &fmt); fmt_dump(fmt); diff --git a/uip/inc.c b/uip/inc.c index 1523a2c..36e0ab1 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -352,8 +352,8 @@ main(int argc, char **argv) dtimenow(), from); } - /* Get new format string */ - fmtstr = new_fs(form, FORMAT); + /* Set format string */ + fmtstr = new_fs(form, scanformat); if (noisy) { printf("Incorporating new mail into %s...\n\n", folder); diff --git a/uip/mhparam.c b/uip/mhparam.c index 76fe427..29d4170 100644 --- a/uip/mhparam.c +++ b/uip/mhparam.c @@ -98,6 +98,7 @@ static struct proc procs [] = { { "replgroupcomps", &replgroupcomps }, { "mhlformat", &mhlformat }, { "mhlreply", &mhlreply }, + { "scanformat", &scanformat }, { "#--Default-Sequence-Names--", &empty }, { "seq-all", &seq_all }, diff --git a/uip/scan.c b/uip/scan.c index dc54bf0..671509a 100644 --- a/uip/scan.c +++ b/uip/scan.c @@ -104,10 +104,8 @@ main(int argc, char **argv) app_msgarg(&msgs, cp); } - /* - ** Get new format string. Must be before chdir(). - */ - fmtstr = new_fs(form, FORMAT); + /* Set format string. Must be before chdir(). */ + fmtstr = new_fs(form, scanformat); /* ** We are scanning a maildrop file -- 1.7.10.4