]> diplodocus.org Git - nmh/blob - man/mhshow.man
166f26b08be0a52d0b761172e9a6cdc2b3571a85
[nmh] / man / mhshow.man
1 .TH MHSHOW %manext1% 2015-02-08 "%nmhversion%"
2 .
3 .\" %nmhwarning%
4 .
5 .SH NAME
6 mhshow \- display nmh MIME messages
7 .SH SYNOPSIS
8 .HP 5
9 .na
10 .B mhshow
11 .RB [ \-help ]
12 .RB [ \-version ]
13 .RI [ +folder ]
14 .RI [ msgs ]
15 .RB [ \-file
16 .IR file ]
17 .RB [ \-part
18 .IR number ]
19 \&...
20 .RB [ \-type
21 .IR content ]
22 \&...
23 .RB [ \-prefer
24 .IR content ]
25 \&...
26 .RB [ \-noprefer ]
27 .RB [ \-concat " | " \-noconcat ]
28 .RB [ \-textonly " | " \-notextonly ]
29 .RB [ \-inlineonly " | " \-noinlineonly ]
30 .RB [ \-header " | " \-noheader ]
31 .RB [ \-form
32 .IR formfile ]
33 .RB [ \-markform
34 .IR formfile ]
35 .ad
36 .SH DESCRIPTION
37 The
38 .B mhshow
39 command displays contents of a MIME (multi-media) message, or collection
40 of messages.
41 .PP
42 .B mhshow
43 manipulates multi-media messages as specified in RFC 2045 to RFC 2049.
44 Currently
45 .B mhshow
46 only supports encodings in message bodies, and does not support the
47 encoding of message headers as specified in RFC 2047.
48 .PP
49 By default,
50 .B mhshow
51 will display only the text parts of a message that are not marked as
52 attachments. This behavior can be changed by the
53 .B \-notextonly
54 and
55 .B \-noinlineonly
56 switches.
57 In addition, by using the
58 .BR \-part ,
59 .BR \-type ,
60 and
61 .B \-prefer
62 switches, you may limit and reorder the set of parts to be displayed,
63 based on part number and/or content type.
64 The inclusion of any
65 .B \-part
66 or
67 .B \-type
68 switches will override the default settings of
69 .B \-textonly
70 and
71 .BR \-inlineonly .
72 .PP
73 The
74 .B \-header
75 switch controls whether
76 .B mhshow
77 will print a message separator header before each message that it
78 displays. The header format can be controlled using
79 .BR \-headerform ,
80 to specify a file containing
81 .IR mh\-format (5)
82 instructions. A copy of the built-in default headerform can be found
83 in %nmhetcdir%/mhshow.header, for reference.
84 In addition to the normal set of
85 .IR mh\-format (5)
86 instructions, a "%{folder}" escape provides a string representing
87 the current folder.
88 .PP
89 By default,
90 .B mhshow
91 will concatenate all content under one pager. If you want each part to
92 be displayed separately, you can override the default behavior with
93 .B \-noconcat.
94 .PP
95 The
96 .B \-file
97 .I file
98 switch directs
99 .B mhshow
100 to use the specified file as the source message, rather than a message
101 from a folder. If you specify this file as \*(lq-\*(rq, then
102 .B mhshow
103 will accept the source message on the standard input. Note that the
104 file, or input from standard input, should be a validly formatted message,
105 just like any other
106 .B nmh
107 message. It should
108 .I not
109 be in mail drop format (to convert a file in
110 mail drop format to a folder of
111 .B nmh
112 messages, see
113 .IR inc (1)).
114 .PP
115 The
116 .B \-part
117 switch can be given (one or more times) to restrict the set of
118 subparts that will be displayed. (Obviously with no
119 .B \-part
120 switches, all parts will be considered.) If a
121 .B \-part
122 switch specifies a specific subpart (i.e., a "leaf" in the tree of
123 MIME parts), then that part will always be displayed. If a
124 .B \-part
125 switch references a multipart/alternative part, then (in
126 the absence of a
127 .B \-type
128 switch) only the default subpart of that multipart will be displayed.
129 .PP
130 A part specification consists of a series of numbers separated by dots.
131 For example, in a multipart content containing three parts, these
132 would be named as 1, 2, and 3, respectively. If part 2 was also a
133 multipart content containing two parts, these would be named as 2.1 and
134 2.2, respectively. Note that the
135 .B \-part
136 switch is effective only for messages containing a multipart content.
137 If a message has some other kind of content, or if the part is itself
138 another multipart content, the
139 .B \-part
140 switch will not prevent the content from being acted upon.
141 .PP
142 The
143 .B \-type
144 switch can also be used to restrict (or, when used in conjunction with
145 .BR \-part ,
146 to further restrict) the display of parts according to content type.
147 One or more
148 .B \-type
149 switches part will only select the first match from a multipart/alternative,
150 even if there is more than one subpart that matches (one of) the given
151 content type(s).
152 .PP
153 Using either
154 .B \-part
155 or
156 .B -type
157 switches alone will cause either switch to select the part(s) they match.
158 Using them together will select only the part(s) matched by both (sets of)
159 switches. In other words, the result is the intersection, and not the union,
160 of their separate match results.
161 .PP
162 A content specification consists of a content type and a subtype.
163 The initial list of \*(lqstandard\*(rq content types and subtypes can
164 be found in RFC 2046.
165 .PP
166 A list of commonly used contents is briefly reproduced here:
167 .PP
168 .RS 5
169 .nf
170 .ta \w'application 'u
171 Type Subtypes
172 ---- --------
173 text plain, enriched
174 multipart mixed, alternative, digest, parallel
175 message rfc822, partial, external-body
176 application octet-stream, postscript
177 image jpeg, gif, png
178 audio basic
179 video mpeg
180 .fi
181 .RE
182 .PP
183 A legal MIME message must contain a subtype specification.
184 .PP
185 To specify a content, regardless of its subtype, just use the
186 name of the content, e.g., \*(lqaudio\*(rq. To specify a specific
187 subtype, separate the two with a slash, e.g., \*(lqaudio/basic\*(rq.
188 Note that regardless of the values given to the
189 .B \-type
190 switch, a multipart content (of any subtype listed above) is always
191 acted upon. Further note that if the
192 .B \-type
193 switch is used, and it is desirable to act on a message/external-body
194 content, then the
195 .B \-type
196 switch must be used twice: once for message/external-body and once
197 for the content externally referenced.
198 .PP
199 In the absence of
200 .BR \-prefer ,
201 .B mhshow
202 will select the "best" displayable subpart from multipart/alternative
203 content. The
204 .B \-prefer
205 switch can be used (one or more times, in order of ascending
206 preference) to let MH know which content types from a
207 multipart/alternative MIME part are preferred by the user, in order to
208 override the default selection for display. For example, mail is
209 often sent containing both plaintext and HTML-formatted versions of
210 the same content, and the HTML version is usually indicated to be the
211 "best" format for viewing. Using \*(lq-prefer text/plain\*(rq will
212 cause the plaintext version to be displayed if possible, but still
213 allow display of the HTML part if there is no plaintext subpart
214 available. Using \*(lq-prefer text/plain -prefer image/png\*(rq
215 would add a preference for PNG images, which might or might not
216 ever appear in the same multipart/alternative section with text/plain.
217 Implementation note: RFC 2046 requires that the subparts
218 of a multipart/alternative be ordered according to "faithfulness to
219 the original content", and MH by default selects the subpart ranked
220 most "faithful" by that ordering. The
221 .B \-prefer
222 switch reorders the alternative parts (only internally, never changing
223 the message file) to move the user's preferred part(s) to the "most
224 faithful" position. Thus, when viewed by
225 .BR mhlist ,
226 the ordering of multipart/alternative parts will appear to change when
227 invoked with or without various
228 .B \-prefer
229 switches. Since the last of multiple
230 .B \-prefer
231 options "wins", a
232 .B \-prefer
233 on the command line will override any in a profile entry.
234 .PP
235 The
236 .B \-noprefer
237 switch will cancel any previous
238 .B \-prefer
239 switches.
240 .SS "Unseen Sequence"
241 If the profile entry \*(lqUnseen\-Sequence\*(rq is present and
242 non-empty, then
243 .B mhshow
244 will remove each of the messages shown from each sequence named by
245 the profile entry.
246 .SS "Showing the Contents"
247 The headers of each message are displayed with the
248 .I mhlproc
249 (usually
250 .BR mhl ),
251 using the standard format file,
252 .IR mhl.headers .
253 You may specify an alternative format file with the
254 .B \-form
255 .I formfile
256 switch. If the format file
257 .I mhl.null
258 is specified, then the display of the message headers is suppressed.
259 .PP
260 Next, the contents are extracted from the message and are stored in
261 a temporary file. Usually, the name of the temporary file is the
262 word \*(lqmhshow\*(rq followed by a string of characters. Occasionally,
263 the method used to display a content (described next), requires that
264 the file end in a specific suffix. For example, the
265 .B soffice
266 command (part of the StarOffice package) can be used to display
267 Microsoft Word content, but it uses the suffix to determine how to display
268 the file. If no suffix is present, the file is not correctly loaded.
269 Similarly, older versions of the
270 .B gs
271 command append a \*(lq.ps\*(rq suffix to the filename if one was missing.
272 As a result, these cannot be used to read the default temporary file.
273 .PP
274 To get around this, your profile can contain lines of the form:
275 .PP
276 .RS 5
277 mhshow-suffix-<type>/<subtype>: <suffix>
278 .RE
279 .PP
280 or
281 .PP
282 .RS 5
283 mhshow-suffix-<type>: <suffix>
284 .RE
285 .PP
286 to specify a suffix which can be automatically added to the temporary
287 file created for a specific content type. For example, the following
288 lines might appear in your profile:
289 .PP
290 .RS 5
291 .nf
292 mhshow-suffix-text: .txt
293 mhshow-suffix-application/msword: .doc
294 mhshow-suffix-application/PostScript: .ps
295 .fi
296 .RE
297 .PP
298 to automatically append a suffix to the temporary files.
299 .PP
300 The matching with the content type identifier is case-insensitive, both in
301 mhshow-suffix-<type> and mhshow-show-<type> (below) profile entries.
302 .PP
303 The method used to display the different contents in the messages bodies
304 will be determined by a \*(lqdisplay string\*(rq. To find the display
305 string,
306 .B mhshow
307 will first search your profile for an entry of the form:
308 .PP
309 .RS 5
310 mhshow-show-<type>/<subtype>
311 .RE
312 .PP
313 If this isn't found,
314 .B mhshow
315 will search for an entry of the form:
316 .PP
317 .RS 5
318 mhshow-show-<type>
319 .RE
320 .PP
321 to determine the display string.
322 .PP
323 If a display string is found, any escapes (given below) will be expanded.
324 The result will be executed under \*(lq/bin/sh\*(rq, with the standard input
325 set to the content.
326 .PP
327 The display string may contain the following escapes:
328 .PP
329 .RS 5
330 .nf
331 .ta \w'%F 'u
332 %a Insert parameters from Content-Type field
333 %{parameter} Insert the parameter value from the Content-Type field
334 %f Insert filename containing content
335 %F %f, and stdin is terminal not content
336 %l display listing prior to displaying content
337 %s Insert content subtype
338 %d Insert content description
339 %% Insert the character %
340 .fi
341 .RE
342 .PP
343 .B mhshow
344 will execute at most one display string at any given time, and wait
345 for the current display string to finish execution before executing
346 the next display string.
347 .PP
348 The {parameter} escape is typically used in a command line argument
349 that should only be present if it has a non-null value. It is highly
350 recommended that the entire escape be wrapped in double quotes.
351 Shell parameter expansion can construct the argument only when it is
352 non-null, e.g.,
353 .PP
354 .RS 5
355 .nf
356 mhshow-show-text/html: charset="%{charset}";
357 w3m ${charset:+-I $charset} -T text/html %F
358 .fi
359 .RE
360 .PP
361 That example also shows the use of indentation to signify continuation:
362 the two text lines combine to form a single entry. Note that when
363 dealing with text that has been converted internally by
364 .IR iconv (3),
365 the \*(lqcharset\*(rq parameter will reflect the target character set
366 of the text, rather than the original character set in the message.
367 .PP
368 Note that if the content being displayed is multipart, but not one of
369 the subtypes listed above, then the f- and F-escapes expand to multiple
370 filenames, one for each subordinate content. Furthermore, stdin is not
371 redirected from the terminal to the content.
372 .PP
373 If a display string is not found,
374 .B mhshow
375 behaves as if these profile entries were supplied and supported:
376 .PP
377 .RS 5
378 .nf
379 mhshow-show-text/plain: %lmoreproc %F
380 mhshow-show-message/rfc822: %lshow -file %F
381 .fi
382 .RE
383 .PP
384 Note that \*(lqmoreproc\*(rq is not supported in user profile display
385 strings.
386 .PP
387 If a subtype of type text doesn't have a profile entry, it will be
388 treated as text/plain.
389 .PP
390 .B mhshow
391 has default methods for handling multipart messages of subtype
392 mixed, alternative, parallel, and digest. Any unknown subtype of type
393 multipart (without a profile entry), will be treated as multipart/mixed.
394 .PP
395 If none of these apply, then
396 .B mhshow
397 will check to see if the message has an application/octet-stream content
398 with parameter \*(lqtype=tar\*(rq.
399 If so,
400 .B mhshow
401 will use an appropriate command. If not,
402 .B mhshow
403 will complain.
404 .PP
405 Example entries might be:
406 .PP
407 .RS 5
408 .nf
409 mhshow-show-audio/basic: raw2audio 2>/dev/null | play
410 mhshow-show-image: xv %f
411 mhshow-show-application/PostScript: lpr -Pps
412 .fi
413 .RE
414 .PP
415 If an f- or F-escape is not quoted with single quotes, its expansion
416 will be wrapped with single quotes.
417 .PP
418 Finally,
419 .B mhshow
420 will process each message serially\0--\0it won't start showing the next
421 message until all the commands executed to display the current message
422 have terminated.
423 .SS "Showing Alternate Character Sets"
424 If
425 .B mhshow
426 was built with
427 .IR iconv (3),
428 then all text/plain parts of the message(s) will be displayed using
429 the character set of the current locale. See
430 .IR mhparam (1)
431 for how to determine whether your
432 .B nmh
433 installation includes
434 .IR iconv (3)
435 support. To convert text parts other than text/plain, or if
436 .B mhshow
437 was not built with
438 .IR iconv ,
439 an external program can be used, as described next.
440 .PP
441 Because a content of type text might be in a non-ASCII character
442 set, when
443 .B mhshow
444 encounters a \*(lqcharset\*(rq parameter for this content, it checks
445 if your terminal can display this character set natively.
446 .B mhshow
447 checks this by examining the current character set defined by the
448 .IR locale (1)
449 environment variables. If the value of the locale character set is equal
450 to the value of the charset parameter, then
451 .B mhshow
452 assumes it can
453 display this content without any additional setup. If the locale is not
454 set properly,
455 .B mhshow
456 will assume a value of \*(lqUS-ASCII\*(rq.
457 If the character set cannot be displayed natively, then
458 .B mhshow
459 will look for an entry of the form:
460 .PP
461 .RS 5
462 mhshow-charset-<charset>
463 .RE
464 .PP
465 which should contain a command creating an environment to render
466 the character set. This command string should containing a single
467 \*(lq%s\*(rq, which will be filled-in with the command to display the
468 content.
469 .PP
470 Example entries might be:
471 .PP
472 .RS 5
473 mhshow-charset-iso-8859-1: xterm -fn '-*-*-medium-r-normal-*-*-120-*-*-c-*-iso8859-*' -e %s
474 .RE
475 .PP
476 or
477 .PP
478 .RS 5
479 mhshow-charset-iso-8859-1: '%s'
480 .RE
481 .PP
482 The first example tells
483 .B mhshow
484 to start
485 .B xterm
486 and load the appropriate character set for that message content.
487 The second example
488 tells
489 .B mhshow
490 that your pager (or other program handling that content type) can
491 handle that character set, and that no special processing is
492 needed beforehand.
493 .PP
494 Note that many pagers strip off the high-order bit, or have problems
495 displaying text with the high-order bit set. However, the pager
496 .B less
497 has support for single-octet character sets. For example, messages
498 encoded in the ISO-8859-1 character set can be viewed using
499 .BR less ,
500 with these environment variable settings:
501 .PP
502 .RS 5
503 .nf
504 .ta \w'%F 'u
505 LESSCHARSET latin1
506 LESS -f
507 .fi
508 .RE
509 .PP
510 The first setting tells
511 .B less
512 to use the ISO-8859-1 definition to determine whether a character is
513 \*(lqnormal\*(rq, \*(lqcontrol\*(lq, or \*(lqbinary\*(rq.
514 The second setting tells
515 .B less
516 not to warn you if it encounters a file that has non-ASCII characters.
517 Then, simply set the
518 .I moreproc
519 profile entry to
520 .BR less ,
521 and it will get called automatically. (To handle other single-octet
522 character sets, look at the
523 .IR less (1)
524 manual entry for information about the LESSCHARDEF environment variable.)
525 .SS "Messages of Type message/partial"
526 .B mhshow
527 cannot directly display messages of type partial.
528 You must first reassemble them into a normal message using
529 .BR mhstore .
530 Check
531 .IR mhstore (1)
532 for details.
533 .SS "External Access"
534 For contents of type message/external-body,
535 .B mhshow
536 supports these access-types:
537 .IP \(bu 4
538 afs
539 .IP \(bu 4
540 anon-ftp
541 .IP \(bu 4
542 ftp
543 .IP \(bu 4
544 local-file
545 .IP \(bu 4
546 mail-server
547 .IP \(bu 4
548 url
549 .PP
550 For the \*(lqanon-ftp\*(rq and \*(lqftp\*(rq access types,
551 .B mhshow
552 will look for the \*(lqnmh-access-ftp\*(rq profile entry, e.g.,
553 .PP
554 .RS 5
555 nmh-access-ftp: myftp.sh
556 .RE
557 .PP
558 to determine the pathname of a program to perform the FTP retrieval.
559 .PP
560 This program is invoked with these arguments:
561 .PP
562 .RS 5
563 .nf
564 domain name of FTP-site
565 username
566 password
567 remote directory
568 remote filename
569 local filename
570 \*(lqascii\*(rq or \*(lqbinary\*(rq
571 .fi
572 .RE
573 .PP
574 The program should terminate with an exit status of zero if the
575 retrieval is successful, and a non-zero exit status otherwise.
576 .PP
577 For the \*(lqurl\*(rq access-type,
578 .B mhshow
579 will look for the \*(lqnmh-access-url\*(rq profile entry. See
580 .IR mhstore (1)
581 for more details.
582 .SS "User Environment"
583 Because the display environment in which
584 .B mhshow
585 operates may vary for different machines,
586 .B mhshow
587 will look for the environment variable MHSHOW. If present, this specifies
588 the name of an additional user profile which should be read.
589 Hence, when a user logs in on a particular display device, this environment
590 variable should be set to refer to a file containing definitions useful
591 for the given display device.
592 Normally, only entries that deal with the methods to display different
593 content type and subtypes
594 .PP
595 .RS 5
596 .nf
597 mhshow-show-<type>/<subtype>
598 mhshow-show-<type>
599 .fi
600 .RE
601 .PP
602 need be present in this additional profile. Finally,
603 .B mhshow
604 will attempt to consult
605 .PP
606 .RS 5
607 %nmhetcdir%/mhn.defaults
608 .RE
609 .PP
610 which is created automatically during
611 .B nmh
612 installation.
613 .PP
614 See "Profile Lookup" in
615 .IR mh-profile (5)
616 for the profile search order, and for how duplicate entries are treated.
617 .SS Content-Type Marker
618 .B mhshow
619 will display a marker containing information about the part being displayed
620 next. The default marker can be changed using the
621 .B \-markform
622 switch to specify a file containing
623 .IR mh\-format (5)
624 instructions to use when displaying the content marker. A copy of the
625 default markform can be found in %nmhetcdir%/mhshow.marker, for
626 reference. In addition to the normal set of
627 .IR mh\-format (5)
628 instructions, the following
629 .I component
630 escapes are supported:
631 .PP
632 .RS 5
633 .nf
634 .ta \w'cdispo-<PARAM> 'u +\w'Returns 'u
635 .I "Escape Returns Description"
636 part string MIME part number
637 content\-type string MIME Content\-Type of part
638 description string Content\-Description header
639 disposition string Content disposition (attachment or inline)
640 ctype-<PARAM> string Value of <PARAM> from Content\-Type header
641 cdispo-<PARAM> string Value of <PARAM> from
642 Content\-Disposition header
643 %(size) integer The size of the decoded part, in bytes
644 %(unseen) boolean Returns true for suppressed parts
645 .fi
646 In this context, the %(unseen) function indicates whether
647 .B mhshow
648 has decided to not display a particular part due to the
649 .B \-textonly
650 or
651 .B \-inlineonly
652 switches.
653 .RE
654 All MIME parameters and the \*(lqContent-Description\*(rq header will have
655 RFC 2231 decoding applied and be converted to the local character set.
656 .SH FILES
657 .B mhshow
658 looks for all format files and mhn.defaults in multiple locations:
659 absolute pathnames are accessed directly, tilde expansion is done on
660 usernames, and files are searched for in the user's
661 .I Mail
662 directory, as specified in their profile. If not found there, the directory
663 .RI \*(lq %nmhetcdir% \*(rq
664 is checked.
665 .PP
666 .fc ^ ~
667 .nf
668 .ta \w'%nmhetcdir%/ExtraBigFileName 'u
669 ^$HOME/.mh_profile~^The user profile
670 ^$MHSHOW~^Additional profile entries
671 ^%nmhetcdir%/mhn.defaults~^System default MIME profile entries
672 ^%nmhetcdir%/mhl.headers~^The headers template
673 ^%nmhetcdir%/mhshow.marker~^Example content marker
674 ^%nmhetcdir%/mhshow.header~^Example message separator header
675 .fi
676 .SH "PROFILE COMPONENTS"
677 .fc ^ ~
678 .nf
679 .ta 2.4i
680 .ta \w'ExtraBigProfileName 'u
681 ^Path:~^To determine the user's nmh directory
682 ^Current\-Folder:~^To find the default current folder
683 ^Unseen\-Sequence:~^To name sequences denoting unseen messages
684 ^mhlproc:~^Default program to display message headers
685 ^nmh-access-ftp:~^Program to retrieve contents via FTP
686 ^nmh-access-url:~^Program to retrieve contents via HTTP
687 ^mhshow-charset-<charset>~^Template for environment to render character sets
688 ^mhshow-show-<type>*~^Template for displaying contents
689 ^moreproc:~^Default program to display text/plain content
690 .fi
691 .SH "SEE ALSO"
692 .IR iconv (3),
693 .IR mhbuild (1),
694 .IR mhl (1),
695 .IR mhlist (1),
696 .IR mhparam (1),
697 .IR mhstore (1),
698 .IR sendfiles (1)
699 .SH DEFAULTS
700 .nf
701 .RB ` +folder "' defaults to the current folder"
702 .RB ` msgs "' defaults to cur"
703 .RB ` \-nocheck '
704 .RB ` \-concat '
705 .RB ` \-textonly '
706 .RB ` \-inlineonly '
707 .RB ` \-form\ mhl.headers '
708 .fi
709 .SH CONTEXT
710 If a folder is given, it will become the current folder. The last
711 message selected will become the current message.