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