1MHSHOW(1) General Commands Manual MHSHOW(1)
2
3
4
6 mhshow - display nmh MIME messages
7
9 mhshow [-help] [-version] [+folder] [msgs] [-file file] [-part number]
10 ... [-type content] ... [-prefer content] ... [-noprefer]
11 [-concat | -noconcat] [-textonly | -notextonly] [-inlineonly |
12 -noinlineonly] [-header | -noheader] [-form formfile] [-markform
13 formfile]
14
16 The mhshow command displays contents of a MIME (multi-media) message,
17 or collection of messages.
18
19 mhshow manipulates multi-media messages as specified in RFC 2045 to RFC
20 2049. Currently mhshow only supports encodings in message bodies, and
21 does not support the encoding of message headers as specified in RFC
22 2047.
23
24 By default, mhshow will display only the text parts of a message that
25 are not marked as attachments. This behavior can be changed by the
26 -notextonly and -noinlineonly switches. In addition, by using the
27 -part, -type, and -prefer switches, you may limit and reorder the set
28 of parts to be displayed, based on part number and/or content type.
29 The inclusion of any -part or -type switches will override the default
30 settings of -textonly and -inlineonly.
31
32 The -header switch controls whether mhshow will print a message separa‐
33 tor header before each message that it displays. The header format can
34 be controlled using -headerform, to specify a file containing mh-for‐
35 mat(5) instructions. A copy of the built-in default headerform can be
36 found in /etc/nmh/mhshow.header, for reference. In addition to the
37 normal set of mh-format(5) instructions, a "%{folder}" escape provides
38 a string representing the current folder.
39
40 By default, mhshow will concatenate all content under one pager. If
41 you want each part to be displayed separately, you can override the de‐
42 fault behavior with -noconcat.
43
44 The -file file switch directs mhshow to use the specified file as the
45 source message, rather than a message from a folder. If you specify
46 this file as “-”, then mhshow will accept the source message on the
47 standard input. Note that the file, or input from standard input,
48 should be a validly formatted message, just like any other nmh message.
49 It should not be in mail drop format (to convert a file in mail drop
50 format to a folder of nmh messages, see inc(1)).
51
52 The -part switch can be given (one or more times) to restrict the set
53 of subparts that will be displayed. (Obviously with no -part switches,
54 all parts will be considered.) If a -part switch specifies a specific
55 subpart (i.e., a "leaf" in the tree of MIME parts), then that part will
56 always be displayed. If a -part switch references a multipart/alterna‐
57 tive part, then (in the absence of a -type switch) only the default
58 subpart of that multipart will be displayed.
59
60 A part specification consists of a series of numbers separated by dots.
61 For example, in a multipart content containing three parts, these would
62 be named as 1, 2, and 3, respectively. If part 2 was also a multipart
63 content containing two parts, these would be named as 2.1 and 2.2, re‐
64 spectively. Note that the -part switch is effective only for messages
65 containing a multipart content. If a message has some other kind of
66 content, or if the part is itself another multipart content, the -part
67 switch will not prevent the content from being acted upon.
68
69 The -type switch can also be used to restrict (or, when used in con‐
70 junction with -part, to further restrict) the display of parts accord‐
71 ing to content type. One or more -type switches part will only select
72 the first match from a multipart/alternative, even if there is more
73 than one subpart that matches (one of) the given content type(s).
74
75 Using either -part or -type switches alone will cause either switch to
76 select the part(s) they match. Using them together will select only
77 the part(s) matched by both (sets of) switches. In other words, the
78 result is the intersection, and not the union, of their separate match
79 results.
80
81 A content specification consists of a content type and a subtype. The
82 initial list of “standard” content types and subtypes can be found in
83 RFC 2046.
84
85 A list of commonly used contents is briefly reproduced here:
86
87 Type Subtypes
88 ---- --------
89 text plain, enriched
90 multipart mixed, alternative, digest, parallel
91 message rfc822, external-body
92 application octet-stream, postscript
93 image jpeg, gif, png
94 audio basic
95 video mpeg
96
97 A legal MIME message must contain a subtype specification.
98
99 To specify a content, regardless of its subtype, just use the name of
100 the content, e.g., “audio”. To specify a specific subtype, separate
101 the two with a slash, e.g., “audio/basic”. Note that regardless of the
102 values given to the -type switch, a multipart content (of any subtype
103 listed above) is always acted upon. Further note that if the -type
104 switch is used, and it is desirable to act on a message/external-body
105 content, then the -type switch must be used twice: once for message/ex‐
106 ternal-body and once for the content externally referenced.
107
108 In the absence of -prefer, mhshow will select the "best" displayable
109 subpart from multipart/alternative content. The -prefer switch can be
110 used (one or more times, in order of ascending preference) to let MH
111 know which content types from a multipart/alternative MIME part are
112 preferred by the user, in order to override the default selection for
113 display. For example, mail is often sent containing both plaintext and
114 HTML-formatted versions of the same content, and the HTML version is
115 usually indicated to be the "best" format for viewing. Using “-prefer
116 text/plain” will cause the plaintext version to be displayed if possi‐
117 ble, but still allow display of the HTML part if there is no plaintext
118 subpart available. Using “-prefer text/plain -prefer image/png” would
119 add a preference for PNG images, which might or might not ever appear
120 in the same multipart/alternative section with text/plain. Implementa‐
121 tion note: RFC 2046 requires that the subparts of a multipart/alterna‐
122 tive be ordered according to "faithfulness to the original content",
123 and MH by default selects the subpart ranked most "faithful" by that
124 ordering. The -prefer switch reorders the alternative parts (only in‐
125 ternally, never changing the message file) to move the user's preferred
126 part(s) to the "most faithful" position. Thus, when viewed by mhlist,
127 the ordering of multipart/alternative parts will appear to change when
128 invoked with or without various -prefer switches. Since the last of
129 multiple -prefer options "wins", a -prefer on the command line will
130 override any in a profile entry.
131
132 The -noprefer switch will cancel any previous -prefer switches.
133
134 Unseen Sequence
135 If the profile entry “Unseen-Sequence” is present and non-empty, then
136 mhshow will remove each of the messages shown from each sequence named
137 by the profile entry.
138
139 Showing the Contents
140 The headers of each message are displayed with the mhlproc (usually
141 mhl), using the standard format file, mhl.headers. You may specify an
142 alternative format file with the -form formfile switch. If the format
143 file mhl.null is specified, then the display of the message headers is
144 suppressed.
145
146 Next, the contents are extracted from the message and are stored in a
147 temporary file. Usually, the name of the temporary file is the word
148 “mhshow” followed by a string of characters. Occasionally, the method
149 used to display a content (described next), requires that the file end
150 in a specific suffix. For example, the soffice command (part of the
151 StarOffice package) can be used to display Microsoft Word content, but
152 it uses the suffix to determine how to display the file. If no suffix
153 is present, the file is not correctly loaded. Similarly, older ver‐
154 sions of the gs command append a “.ps” suffix to the filename if one
155 was missing. As a result, these cannot be used to read the default
156 temporary file.
157
158 To get around this, your profile can contain lines of the form:
159
160 mhshow-suffix-<type>/<subtype>: <suffix>
161
162 or
163
164 mhshow-suffix-<type>: <suffix>
165
166 to specify a suffix which can be automatically added to the temporary
167 file created for a specific content type. For example, the following
168 lines might appear in your profile:
169
170 mhshow-suffix-text: .txt
171 mhshow-suffix-application/msword: .doc
172 mhshow-suffix-application/PostScript: .ps
173
174 to automatically append a suffix to the temporary files.
175
176 The matching with the content type identifier is case-insensitive, both
177 in mhshow-suffix-<type> and mhshow-show-<type> (below) profile entries.
178
179 The method used to display the different contents in the messages bod‐
180 ies will be determined by a “display string”. To find the display
181 string, mhshow will first search your profile for an entry of the form:
182
183 mhshow-show-<type>/<subtype>
184
185 If this isn't found, mhshow will search for an entry of the form:
186
187 mhshow-show-<type>
188
189 to determine the display string.
190
191 If a display string is found, any escapes (given below) will be ex‐
192 panded. The result will be executed under “/bin/sh”, with the standard
193 input set to the content.
194
195 The display string may contain the following escapes:
196
197 %a Insert parameters from Content-Type field
198 %{parameter} Insert the parameter value from the Content-Type field
199 %f Insert filename containing content
200 %F %f, and stdin is terminal not content
201 %l display listing prior to displaying content
202 %s Insert content subtype
203 %d Insert content description
204 %% Insert the character %
205
206 mhshow will execute at most one display string at any given time, and
207 wait for the current display string to finish execution before execut‐
208 ing the next display string.
209
210 The {parameter} escape is typically used in a command line argument
211 that should only be present if it has a non-null value. It is highly
212 recommended that the entire escape be wrapped in double quotes. Shell
213 parameter expansion can construct the argument only when it is non-
214 null, e.g.,
215
216 mhshow-show-text/html: charset="%{charset}";
217 w3m ${charset:+-I $charset} -T text/html %F
218
219 That example also shows the use of indentation to signify continuation:
220 the two text lines combine to form a single entry. Note that when
221 dealing with text that has been converted internally by iconv(3), the
222 “charset” parameter will reflect the target character set of the text,
223 rather than the original character set in the message.
224
225 Note that if the content being displayed is multipart, but not one of
226 the subtypes listed above, then the f- and F-escapes expand to multiple
227 filenames, one for each subordinate content. Furthermore, stdin is not
228 redirected from the terminal to the content.
229
230 If a display string is not found, mhshow behaves as if these profile
231 entries were supplied and supported:
232
233 mhshow-show-text/plain: %lmoreproc %F
234 mhshow-show-message/rfc822: %lshow -file %F
235
236 Note that “moreproc” is not supported in user profile display strings.
237
238 If a subtype of type text doesn't have a profile entry, it will be
239 treated as text/plain.
240
241 mhshow has default methods for handling multipart messages of subtype
242 mixed, alternative, parallel, and digest. Any unknown subtype of type
243 multipart (without a profile entry), will be treated as multi‐
244 part/mixed.
245
246 If none of these apply, then mhshow will check to see if the message
247 has an application/octet-stream content with parameter “type=tar”. If
248 so, mhshow will use an appropriate command. If not, mhshow will com‐
249 plain.
250
251 Example entries might be:
252
253 mhshow-show-audio/basic: raw2audio 2>/dev/null | play
254 mhshow-show-image: xv %f
255 mhshow-show-application/PostScript: lpr -Pps
256
257 If an f- or F-escape is not quoted with single quotes, its expansion
258 will be wrapped with single quotes.
259
260 Finally, mhshow will process each message serially -- it won't start
261 showing the next message until all the commands executed to display the
262 current message have terminated.
263
264 Showing Alternate Character Sets
265 If mhshow was built with iconv(3), then all text/plain parts of the
266 message(s) will be displayed using the character set of the current lo‐
267 cale. See mhparam(1) for how to determine whether your nmh installa‐
268 tion includes iconv(3) support. To convert text parts other than
269 text/plain, or if mhshow was not built with iconv, an external program
270 can be used, as described next.
271
272 Because a content of type text might be in a non-ASCII character set,
273 when mhshow encounters a “charset” parameter for this content, it
274 checks if your terminal can display this character set natively.
275 mhshow checks this by examining the current character set defined by
276 the locale(1) environment variables. If the value of the locale char‐
277 acter set is equal to the value of the charset parameter, then mhshow
278 assumes it can display this content without any additional setup. If
279 the locale is not set properly, mhshow will assume a value of “US-
280 ASCII”. If the character set cannot be displayed natively, then mhshow
281 will look for an entry of the form:
282
283 mhshow-charset-<charset>
284
285 which should contain a command creating an environment to render the
286 character set. This command string should containing a single “%s”,
287 which will be filled-in with the command to display the content.
288
289 Example entries might be:
290
291 mhshow-charset-iso-8859-1: xterm -fn '-*-*-medium-r-nor‐
292 mal-*-*-120-*-*-c-*-iso8859-*' -e %s
293
294 or
295
296 mhshow-charset-iso-8859-1: '%s'
297
298 The first example tells mhshow to start xterm and load the appropriate
299 character set for that message content. The second example tells
300 mhshow that your pager (or other program handling that content type)
301 can handle that character set, and that no special processing is needed
302 beforehand.
303
304 Note that many pagers strip off the high-order bit, or have problems
305 displaying text with the high-order bit set. However, the pager less
306 has support for single-octet character sets. For example, messages en‐
307 coded in the ISO-8859-1 character set can be viewed using less, with
308 these environment variable settings:
309
310 LESSCHARSET latin1
311 LESS -f
312
313 The first setting tells less to use the ISO-8859-1 definition to deter‐
314 mine whether a character is “normal”, “control“, or “binary”. The sec‐
315 ond setting tells less not to warn you if it encounters a file that has
316 non-ASCII characters. Then, simply set the moreproc profile entry to
317 less, and it will get called automatically. (To handle other single-
318 octet character sets, look at the less(1) manual entry for information
319 about the LESSCHARDEF environment variable.)
320
321 External Access
322 For contents of type message/external-body, mhshow supports these ac‐
323 cess-types:
324
325 • afs
326
327 • anon-ftp
328
329 • ftp
330
331 • local-file
332
333 • mail-server
334
335 • url
336
337 For the “anon-ftp” and “ftp” access types, mhshow will look for the
338 “nmh-access-ftp” profile entry, e.g.,
339
340 nmh-access-ftp: myftp.sh
341
342 to determine the pathname of a program to perform the FTP retrieval.
343
344 This program is invoked with these arguments:
345
346 domain name of FTP-site
347 username
348 password
349 remote directory
350 remote filename
351 local filename
352 “ascii” or “binary”
353
354 The program should terminate with an exit status of zero if the re‐
355 trieval is successful, and a non-zero exit status otherwise.
356
357 For the “url” access-type, mhshow will look for the “nmh-access-url”
358 profile entry. See mhstore(1) for more details.
359
360 User Environment
361 Because the display environment in which mhshow operates may vary for
362 different machines, mhshow will look for the environment variable
363 MHSHOW. If present, this specifies the name of an additional user pro‐
364 file which should be read. Hence, when a user logs in on a particular
365 display device, this environment variable should be set to refer to a
366 file containing definitions useful for the given display device. Nor‐
367 mally, only entries that deal with the methods to display different
368 content type and subtypes
369
370 mhshow-show-<type>/<subtype>
371 mhshow-show-<type>
372
373 need be present in this additional profile. Finally, mhshow will at‐
374 tempt to consult
375
376 /etc/nmh/mhn.defaults
377
378 which is created automatically during nmh installation.
379
380 See "Profile Lookup" in mh-profile(5) for the profile search order, and
381 for how duplicate entries are treated.
382
383 Content-Type Marker
384 mhshow will display a marker containing information about the part be‐
385 ing displayed next. The default marker can be changed using the -mark‐
386 form switch to specify a file containing mh-format(5) instructions to
387 use when displaying the content marker. A copy of the default markform
388 can be found in /etc/nmh/mhshow.marker, for reference. In addition to
389 the normal set of mh-format(5) instructions, the following component
390 escapes are supported:
391
392 Escape Returns Description
393 part string MIME part number
394 content-type string MIME Content-Type of part
395 description string Content-Description header
396 disposition string Content disposition (attachment or inline)
397 ctype-<PARAM> string Value of <PARAM> from Content-Type header
398 cdispo-<PARAM> string Value of <PARAM> from
399 Content-Disposition header
400 %(size) integer The size of the decoded part, in bytes
401 %(unseen) boolean Returns true for suppressed parts
402 In this context, the %(unseen) function indicates whether mhshow
403 has decided to not display a particular part due to the -textonly
404 or -inlineonly switches.
405 All MIME parameters and the “Content-Description” header will have RFC
406 2231 decoding applied and be converted to the local character set.
407
409 mhshow looks for all format files and mhn.defaults in multiple loca‐
410 tions: absolute pathnames are accessed directly, tilde expansion is
411 done on usernames, and files are searched for in the user's Mail direc‐
412 tory, as specified in their profile. If not found there, the directory
413 “/etc/nmh” is checked.
414
415 $HOME/.mh_profile The user profile
416 $MHSHOW Additional profile entries
417 /etc/nmh/mhn.defaults System default MIME profile entries
418 /etc/nmh/mhl.headers The headers template
419 /etc/nmh/mhshow.marker Example content marker
420 /etc/nmh/mhshow.header Example message separator header
421
423 Path: To determine the user's nmh directory
424 Current-Folder: To find the default current folder
425 Unseen-Sequence: To name sequences denoting unseen messages
426 mhlproc: Default program to display message headers
427 nmh-access-ftp: Program to retrieve contents via FTP
428 nmh-access-url: Program to retrieve contents via HTTP
429 mhshow-charset-<charseTte>mplate for environment to render character sets
430 mhshow-show-<type>* Template for displaying contents
431 moreproc: Default program to display text/plain content
432
434 iconv(3), mhbuild(1), mhl(1), mhlist(1), mhparam(1), mhstore(1), send‐
435 files(1)
436
438 `+folder' defaults to the current folder
439 `msgs' defaults to cur
440 `-concat'
441 `-textonly'
442 `-inlineonly'
443 `-form mhl.headers'
444
446 If a folder is given, it will become the current folder. The last mes‐
447 sage selected will become the current message.
448
449
450
451nmh-1.8 2015-02-08 MHSHOW(1)