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