From: Philipp Takacs Date: Sun, 30 Dec 2018 01:37:25 +0000 (+0100) Subject: Merge branch 'pick' into master X-Git-Tag: mmh-0.4~10 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=c5368b86d4a3a42f9efe8aa56374d953a7faa9a4;hp=-c Merge branch 'pick' into master scan and pick is merged and pick matching is streamlined --- c5368b86d4a3a42f9efe8aa56374d953a7faa9a4 diff --combined h/prototypes.h index 6526582,50d8a8b..fad1af4 --- a/h/prototypes.h +++ b/h/prototypes.h @@@ -107,7 -107,6 +107,7 @@@ char *snprintb(char *, size_t, unsigned int stringdex(char *, char *); char *toabsdir(char *); char *trim(unsigned char *); +char *rtrim(char *); char *trimcpy(unsigned char *); int unputenv(char *); void unquote_string(const char *input, char *output); @@@ -163,4 -162,4 +163,4 @@@ int is_readonly(struct msgs *) void set_readonly(struct msgs *); int other_files(struct msgs *); void set_other_files(struct msgs *); - + char *getthreadid(const char *); diff --combined man/pick.man1 index 2390984,ea63a75..5e20903 --- a/man/pick.man1 +++ b/man/pick.man1 @@@ -4,6 -4,7 +4,7 @@@ .TH PICK %manext1% "%nmhdate%" MH.6.8 [%nmhversion%] .SH NAME pick \- select messages by content + scan \- produce a one line per message scan listing .SH SYNOPSIS .HP 5 .na @@@ -39,6 -40,14 +40,14 @@@ .IR date ] .RB [ \-datefield .IR field ] + .RB [ \-format + .IR formatfile ] + .RB [ \-width + .IR columns ] + .RB [ \-thread + .RI [ +folder ] messages "|" files ] + .RB [ \-file + .IR mboxfilename ] .RB [ \-sequence .I name \&...] @@@ -47,13 -56,18 +56,18 @@@ .RB [ \-list " | " \-nolist ] .RB [ \-Version ] .RB [ \-help ] + .PP + .HP 5 + .B scan + is equivalent to + .B pick -format scan.default .ad .PP typical usage: .PP .RS 5 .nf - scan\0`pick\0\-from\0jones` + scan\0\-from\0jones` pick\0\-to\0holloway\0\-sequence\0select show\0`pick\0\-before\0friday` .fi @@@ -66,50 -80,35 +80,35 @@@ contents, and then identifies those mes primitives are available: pattern matching and date constraint operations. .PP - A modified - .BR grep (1) + The default + .BR regex (7) is used to perform the matching, so the - full regular expression (see - .BR ed (1)) - facility is available + full regular expression facility is available within - .IR pattern . + .IR pattern. With .BR \-search , .I pattern - is used directly, and with the others, the grep pattern constructed is: - .PP - .RS 5 - `component[ \\t]*:\&.*pattern' - .RE - .PP - This means that the pattern specified for a - .B \-search - will be found - everywhere in the message, including the header and the body, while - the other pattern matching requests are limited to the single specified - component. The expression - .PP - .RS 5 - `\-\|\-component\ pattern' - .RE - .PP - is a shorthand for specifying - .PP - .RS 5 - `\-search `component[ \\t]*:\&.*pattern'\ ' - .RE + is used directly, but only for the body of the Mail. + With the others, + .B pick + compares the header field name case insensitive + and the tries to match the field body with the + .IR patern. .PP + With + .BR --componend + you can sepcify the exact header field name you are looking for. It is used to pick a component which is not one of `To:', `Cc:', `Date:', `From:', or `Subject:'. An example is .RB ` "pick\0\-\|\-reply\-to\0pooh" '. .PP - Pattern matching is performed on a per\-line basis. Within the header - of the message, each component is treated as one long line, but in the - body, each line is separate. Lower\-case letters in the search pattern - will match either lower or upper case in the message, while upper case - will match only upper case. + Pattern matching is performed on a per\-header-field basis. Within the header + of the message, each field is treated as one long line, but in the + body, each line is separate. The + .IR patern + will match any case. .PP Note that since the .B \-date @@@ -223,7 -222,7 +222,7 @@@ switches are provided, which act just l parentheses in logical expressions. .PP If no search criteria are given, all the messages specified on the -command line are selected (this defaults to `all'). +command line are selected (this defaults to `a'). .PP Once the search has been performed, if the .B \-list @@@ -238,20 -237,20 +237,20 @@@ programs by using th `backquoting' syntax of the shell. For example, the command .PP .RS 5 - scan\0`pick\0+todo\0\-after\0`31 Mar 83 0123 PST'` + show\0`pick\0+todo\0\-after\0`31 Mar 83 0123 PST'` .RE .PP says to - .B scan + .B show those messages in the indicated folder which meet the appropriate criterion. Note that since .BR pick 's context changes are written out prior to - .BR scan 's + .BR show 's invocation, you need not give the folder argument to - .B scan + .B show as well. .PP The @@@ -293,6 -292,137 +292,137 @@@ same wa .B mark uses them. + .B Scan + and + .B pick + produces a one\-line\-per\-message listing of the specified and selected + folder or messages. + The default format is for + .B pick + is to print the message number for each message. + The default + .B Scan + line contains the message number + (name), the date, the `From:' field and the `Subject' field. + The folowing example shows the default output of + .B scan + .PP + .RS 5 + .nf + .ta \w'15+- 'u +\w'07/\|05x 'u +\w'Dcrocker 'u + 15+ 10/\|05 crocker nned + 16\- 10/\|05 crocker message id format + 18 10/\|06 brien Re: Exit status from mkdir + 19 10/\|07*brien `scan' listing format in mmh + .fi + .RE + .PP + The `+' on message 15 indicates that it is the current message. + The `\-' on message 16 indicates that it has been replied to, as indicated + by a `Replied:' component (produced by the + .B \-annotate + switch + to the + .B repl + command). + The `*' on message 19 indicates that no `Date:' header was + present. The time of last modification of the message is given instead. + .B Scan + actually reads each of the specified messages and parses them to extract + the desired fields. During parsing, appropriate error messages will be + produced if there are format errors in any of the messages. + .PP + By default, + .B scan + will decode RFC-2047 (MIME) encoding in + these scan listings. + .B Scan + will only decode these fields if your + terminal can natively display the character set used in the encoding. + You should set the MM_CHARSET environment variable to your native + character set, if it is not US-ASCII. See the mh-profile(5) man + page for details about this environment variable. + .PP + The + .B \-file + .I filename + switch allows the user to obtain a + .B scan + listing of a maildrop file as produced by + .BR packf . + This listing + includes every message in the file (you can't scan individual messages). + .PP + The switch + .B \-width + .I columns + may be used to specify the width of + the scan line. The default is to use the width of the terminal. + .PP + The command: + .PP + .RS 5 + (scan | pr ; show a \-showproc pr) | lpr + .RE + .PP + produces a scan listing of the current folder, + followed by a formatted listing of all messages in the folder, one + per page. Omitting + .RB ` "\-showproc\ pr" ' + will cause the messages to be + concatenated, separated by a one\-line header and two blank lines. + .PP + To override the output format used by + .BR scan , + the + .B \-form + .I file + switch is used. This permits individual fields of + the scan listing to be extracted with ease. + .I file + is either the name of a format file or a format string directly, + if prepended with an equal sign `='. + See + .BR mh\-format (5) + for the details. + .PP + In addition to the standard + .BR mh\-format (5) + escapes, + .B scan + also recognizes the following additional + .I component + escapes: + .PP + .RS 5 + .nf + .ta \w'Dtimenow 'u +\w'Returns 'u + .I "Escape Returns Description + dtimenow date the current date + folder string the name of the current folder + .fi + .RE + .PP + If no date header is present in the message, the + .I function + escapes + which operate on + .RB { date } + will return values for the date of last + modification of the message file itself. This feature is handy for + scanning a draft folder, as message drafts usually aren't allowed + to have dates in them. + .PP + .B scan + will update the + .B mmh + context prior to starting the listing, + so interrupting a long + .B scan + listing preserves the new context. + .B nmh + purists hate this idea. + .SH FILES .fc ^ ~ .nf @@@ -306,6 -436,7 +436,7 @@@ .ta 2.4i .ta \w'ExtraBigProfileName 'u ^Path:~^To determine the user's mail storage + ^Alternate\-Mailboxes:~^To determine the user's mailboxes ^Current\-Folder:~^To find the default current folder .fi @@@ -315,10 -446,11 +446,11 @@@ mark(1 .SH DEFAULTS .nf .RB ` +folder "' defaults to the current folder" -.RB ` msgs "' defaults to all" +.RB ` msgs "' defaults to all messages" .RB ` "\-datefield date" ' .RB ` \-zero ' .RB ` \-list "' is the default if no `\-sequence', `\-nolist' otherwise" + .RB ` "\-format pick\.default" "' if the programm is called with scan `scan.default' is used .fi .SH CONTEXT @@@ -366,9 -498,33 +498,33 @@@ show\0fea .fi .RE .PP - Finally, timezones used to be ignored when comparing dates: they aren't + Also, timezones used to be ignored when comparing dates: they aren't any more. - + .PP + In + .B MH + , + .B nmh + and old + .B mmh + versions scan and pick where two diffrent tools. So instand of typing + .PP + .RS 5 + .nf + scan\0\-from\0philipp + .fi + .RE + .PP + you had typed + .PP + .RS 5 + .nf + scan\0`pick\0\-from\0philipp` + .fi + .RE + .PP + With the default config the old style usage is still supported, so + you can write scripts for both mmh and nmh. .SH "HELPFUL HINTS" Use .RB ` "pick sequence \-list" ' @@@ -417,16 -573,5 +573,16 @@@ was given, and if its standard output i outputs the illegal message number `0' when it fails. This lets the outer command fail gracefully as well. .PP +To account for this case when combining +.B pick +with regular shell tools, filter out the message number `0'. +For example, do +.PP +.RS 5 +pick\0...\0|\0fgrep\0-vx\0\&0\0|\0wc\0-l +.RE +.PP +to count the number of messages picked. +.PP The pattern syntax `[l-r]' is not supported; each letter to be matched must be included within the square brackets. diff --combined uip/Makefile.in index e0c280f,a758fe0..f037ec1 --- a/uip/Makefile.in +++ b/uip/Makefile.in @@@ -54,10 -54,10 +54,10 @@@ CMDS = ali anno burst comp dist flist f mhbuild mhl mhsign mhpgp \ mhlist mhmail mhparam mhpath mhstore new packf pick \ print-mimetype prompter rcvdist rcvpack rcvstore refile repl rmf \ - rmm scan send sendfiles show slocal sortm spost whatnow whom + rmm send sendfiles show slocal sortm spost whatnow whom # commands that are links to other commands - LCMDS = flists folders next prev fnext fprev unseen + LCMDS = flists folders next prev fnext fprev unseen scan # misc support binaries MISC = ap dp fmtdump mhtest mmhwrap whatnow2 @@@ -74,7 -74,7 +74,7 @@@ SRCS = ali.c aliasbr.c anno.c ap.c burs mhpath.c mhshow.c mhshowsbr.c mhstore.c mhtest.c \ new.c packf.c pick.c print-mimetype.sh \ prompter.c rcvdist.c rcvpack.c rcvstore.c \ - refile.c repl.c rmf.c rmm.c scan.c scansbr.c send.c \ + refile.c repl.c rmf.c rmm.c scansbr.c send.c \ sendfiles.sh slocal.c sortm.c spost.c termsbr.c \ whatnow.c whatnowproc.c whom.c whatnow2.sh @@@ -172,8 -172,8 +172,8 @@@ new: new.o $(LOCALLIBS packf: packf.o dropsbr.o $(LOCALLIBS) $(LINK) packf.o dropsbr.o $(LINKLIBS) - pick: pick.o $(LOCALLIBS) - $(LINK) pick.o $(LINKLIBS) + pick: pick.o scansbr.o termsbr.o $(LOCALLIBS) + $(LINK) pick.o scansbr.o termsbr.o $(LINKLIBS) $(TERMLIB) print-mimetype: print-mimetype.sh cp $(srcdir)/print-mimetype.sh print-mimetype @@@ -203,9 -203,6 +203,6 @@@ rmf: rmf.o $(LOCALLIBS rmm: rmm.o $(LOCALLIBS) $(LINK) rmm.o $(LINKLIBS) - scan: scan.o scansbr.o termsbr.o $(LOCALLIBS) - $(LINK) scan.o scansbr.o termsbr.o $(LINKLIBS) $(TERMLIB) - send: send.o distsbr.o $(LOCALLIBS) $(LINK) send.o distsbr.o $(LINKLIBS) @@@ -244,7 -241,7 +241,7 @@@ install-cmds done # install links -install-lcmds: +install-lcmds: install-cmds rm -f $(DESTDIR)$(bindir)/flists rm -f $(DESTDIR)$(bindir)/folders rm -f $(DESTDIR)$(bindir)/fnext @@@ -252,6 -249,7 +249,7 @@@ rm -f $(DESTDIR)$(bindir)/unseen rm -f $(DESTDIR)$(bindir)/prev rm -f $(DESTDIR)$(bindir)/next + rm -f $(DESTDIR)$(bindir)/scan $(LN) $(DESTDIR)$(bindir)/flist $(DESTDIR)$(bindir)/flists $(LN) $(DESTDIR)$(bindir)/folder $(DESTDIR)$(bindir)/folders $(LN) $(DESTDIR)$(bindir)/new $(DESTDIR)$(bindir)/fnext @@@ -259,6 -257,7 +257,7 @@@ $(LN) $(DESTDIR)$(bindir)/new $(DESTDIR)$(bindir)/unseen $(LN) $(DESTDIR)$(bindir)/show $(DESTDIR)$(bindir)/prev $(LN) $(DESTDIR)$(bindir)/show $(DESTDIR)$(bindir)/next + $(LN) $(DESTDIR)$(bindir)/pick $(DESTDIR)$(bindir)/scan # install misc support binaries install-misc: