1SCAN(1) General Commands Manual SCAN(1)
2
3
4
6 scan - produce a summary listing of nmh messages
7
9 scan [-help] [-version] [+folder] [msgs] [-clear | -noclear] [-form
10 formatfile] [-format string] [-header | -noheader] [-width col‐
11 umns] [-reverse | -noreverse] [-file filename]
12
14 scan produces a one-line-per-message listing of the specified folder or
15 messages. Each scan line contains the message number (name), the date,
16 the “From:” field, the “Subject” field, and, if room allows, some of
17 the body of the message. For example:
18
19 15+ 10/05 crocker nned <<Last week I asked some of
20 16- 10/05 crocker message id format <<I recommend
21 18 10/06 brien Re: Exit status from mkdir
22 19 10/07*brien “scan” listing format in nmh
23
24 The `+' on message 15 indicates that it is the current message.
25
26 The `-' on message 16 indicates that it has been replied to, as indi‐
27 cated by a “Replied:” component (produced by the -annotate switch to
28 the repl command).
29
30 The `*' on message 19 indicates that no “Date:” header was present.
31 The time of last modification of the message is given instead.
32
33 If there is sufficient room left on the scan line after the subject,
34 the line will be filled with text from the body, preceded by “<<”, and
35 terminated by “>>” if the body is sufficiently short. scan actually
36 reads each of the specified messages and parses them to extract the de‐
37 sired fields. During parsing, appropriate error messages will be pro‐
38 duced if there are format errors in any of the messages.
39
40 By default, scan will decode RFC 2047 (MIME) encoding in these scan
41 listings. scan will only decode these fields if your terminal can na‐
42 tively display the character set used in the encoding. You should set
43 the appropriate locale(1) environment variables to your native charac‐
44 ter set, if it is not US-ASCII. See locale(1) for more details on the
45 appropriate environment variables.
46
47 The switch -reverse, makes scan list the messages in reverse order.
48
49 The -file filename switch allows the user to obtain a scan listing of a
50 mail drop. This listing includes every message in the mail drop (you
51 can't scan individual messages). The switch -reverse is ignored with
52 this option. If filename is a file, it can be in mbox or MMDF format,
53 as produced by packf. If filename is a directory, it is considered to
54 be in Maildir format.
55
56 The switch -width columns may be used to specify the width of the scan
57 line. The default is to use the width of the terminal.
58
59 The -header switch produces a header line prior to the scan listing.
60 Currently, the name of the folder and the current date and time are
61 output (see the HISTORY section for more information).
62
63 If the -clear switch is used and scan's output is directed to a termi‐
64 nal, then scan will consult the environment variables $TERM and $TERM‐
65 CAP to determine your terminal type in order to find out how to clear
66 the screen prior to exiting. If the -clear switch is used and scan's
67 output is not directed to a terminal (e.g., a pipe or a file), then
68 scan will send a formfeed prior to exiting.
69
70 For example, the command:
71
72 (scan -clear -header; show all -show pr -f) | lpr
73
74 produces a scan listing of the current folder, followed by a formfeed,
75 followed by a formatted listing of all messages in the folder, one per
76 page. Omitting “-show pr -f” will cause the messages to be concate‐
77 nated, separated by a one-line header and two blank lines.
78
79 To override the output format used by scan, the -format string or -form
80 file switches are used. This permits individual fields of the scan
81 listing to be extracted with ease. The string is simply a format
82 string and the file is simply a format file. See mh-format(5) for the
83 details.
84
85 In addition to the standard mh-format(5) escapes, scan also recognizes
86 the following additional component escapes:
87
88 Escape Returns Description
89 body string the (compressed) first part of the body
90 dtimenow date the current date
91 folder string the name of the current folder
92
93 {body} returns a string without MIME decoding, i.e. the MIME boundary
94 separator may be the first text shown.
95
96 If no date header is present in the message, the function escapes which
97 operate on {date} will return values for the date of last modification
98 of the message file itself. This feature is handy for scanning a draft
99 folder, as message drafts usually aren't allowed to have dates in them.
100
101 The /etc/nmh directory contains several format files as examples of
102 customized scan output.
103
104 scan will update the nmh context prior to starting the listing, so in‐
105 terrupting a long scan listing preserves the new context. nmh purists
106 hate this idea.
107
109 $HOME/.mh_profile The user profile
110
112 Path: To determine the user's nmh directory
113 Alternate-Mailboxes: To determine the user's mailboxes
114 Current-Folder: To find the default current folder
115
117 pick(1), show(1), mh-format(5)
118
120 `+folder' defaults to the current folder
121 `msgs' defaults to all
122 `-format' defaulted as described above
123 `-noheader'
124 `-width' defaulted to the width of the terminal
125
127 If a folder is given, it will become the current folder.
128
130 Prior to using the format string mechanism, -header used to generate a
131 heading saying what each column in the listing was. Format strings
132 prevent this from happening.
133
135 The value of each component escape is set by scan to the contents of
136 the first message header scan encounters with the corresponding compo‐
137 nent name; any following headers with the same component name are ig‐
138 nored.
139
140
141
142nmh-1.8 2020-02-17 SCAN(1)