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