27ebd95e6ffeab9e5a7b64ede61858cc606c0c71
[mmh] / man / mhshow.man
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 [ \-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 thru 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 .BR 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 %e      exclusive execution
230 %f      Insert filename containing content
231 %F      %e, %f, and stdin is terminal not content
232 %l      display listing prior to displaying content
233 %p      %l, and ask for confirmation
234 %s      Insert content subtype
235 %d      Insert content description
236 %%      Insert the character %
237 .fi
238 .RE
239 .PP
240 For those display strings containing the e- or F-escape,
241 .B mhshow
242 will
243 execute at most one of these at any given time.  Although the F-escape
244 expands to be the filename containing the content, the e-escape has no
245 expansion as far as the shell is concerned.
246 .PP
247 When the p-escape prompts for confirmation, typing INTR (usually
248 control-C) will tell
249 .B mhshow
250 not to display that content.
251 The p-escape can be disabled by specifying the switch
252 .BR \-nopause .
253 Further, when
254 .B mhshow
255 is display a content, typing QUIT (usually
256 control-\\) will tell
257 .B mhshow
258 to wrap things up immediately.
259 .PP
260 Note that if the content being displayed is multipart, but not one of
261 the subtypes listed above, then the f- and F-escapes expand to multiple
262 filenames, one for each subordinate content.  Further, stdin is not
263 redirected from the terminal to the content.
264 .PP
265 If a display string is not found,
266 .B mhshow
267 has several default values:
268 .PP
269 .RS 5
270 .nf
271 mhshow-show-text/plain: %pmoreproc '%F'
272 mhshow-show-message/rfc822: %pshow -file '%F'
273 .fi
274 .RE
275 .PP
276 If a subtype of type text doesn't have a profile entry, it will be
277 treated as text/plain.
278 .PP
279 .B mhshow
280 has default methods for handling multipart messages of subtype
281 mixed, alternative, parallel, and digest.  Any unknown subtype of type
282 multipart (without a profile entry), will be treated as multipart/mixed.
283 .PP
284 If none of these apply, then
285 .B mhshow
286 will check to see if the message
287 has an application/octet-stream content with parameter \*(lqtype=tar\*(rq.
288 If so,
289 .B mhshow
290 will use an appropriate command.  If not,
291 .B mhshow
292 will complain.
293 .PP
294 Example entries might be:
295 .PP
296 .RS 5
297 .nf
298 mhshow-show-audio/basic: raw2audio 2>/dev/null | play
299 mhshow-show-image: xv '%f'
300 mhshow-show-application/PostScript: lpr -Pps
301 .fi
302 .RE
303 .PP
304 Note that when using the f- or F-escape, it's a good idea to use
305 single-quotes around the escape.  This prevents misinterpretation by
306 the shell of any funny characters that might be present in the filename.
307 .PP
308 Finally,
309 .B mhshow
310 will process each message serially\0--\0it won't start
311 showing the next message until all the commands executed to display the
312 current message have terminated.  In the case of a multipart content
313 (of any subtype listed above), the content contains advice indicating if
314 the parts should be displayed serially or in parallel.  Because this may
315 cause confusion, particularly on uni-window displays, the
316 .B \-serialonly
317 switch can be given to tell
318 .B mhshow
319 to never display parts in parallel.
320 .SS "Showing Alternate Character Sets"
321 Because a content of type text might be in a non-ASCII character
322 set, when
323 .B mhshow
324 encounters a \*(lqcharset\*(rq parameter for
325 this content, it checks if your terminal can display this character
326 set natively.
327 .B mhn
328 checks this by examining the the environment
329 variable
330 .BR $MM_CHARSET .
331 If the value of this environment variable is equal
332 to the value of the charset parameter, then
333 .B mhshow
334 assumes it can
335 display this content without any additional setup.  If this environment
336 variable is not set,
337 .B mhshow
338 will assume a value of \*(lqUS-ASCII\*(rq.
339 If the character set cannot be displayed natively, then
340 .B mhshow
341 will look for an entry of the form:
342 .PP
343 .RS 5
344 mhshow-charset-<charset>
345 .RE
346 .PP
347 which should contain a command creating an environment to render
348 the character set.  This command string should containing a single
349 \*(lq%s\*(rq, which will be filled-in with the command to display the
350 content.
351 .PP
352 Example entries might be:
353 .PP
354 .RS 5
355 mhshow-charset-iso-8859-1: xterm -fn '-*-*-medium-r-normal-*-*-120-*-*-c-*-iso8859-*' -e %s
356 .RE
357 .PP
358 or
359 .PP
360 .RS 5
361 mhshow-charset-iso-8859-1: '%s'
362 .RE
363 .PP
364 The first example tells
365 .B mhshow
366 to start
367 .B xterm
368 and load the
369 appropriate character set for that message content.  The second example
370 tells
371 .B mhshow
372 that your pager (or other program handling that content
373 type) can handle that character set, and that no special processing is
374 needed beforehand.
375 .PP
376 Note that many pagers strip off the high-order bit or have problems
377 displaying text with the high-order bit set.  However, the pager
378 .B less
379 has support for single-octet character sets.  The source
380 to
381 .B less
382 is available on many ftp sites carrying free software.
383 In order to view messages sent in the ISO-8859-1 character set using
384 .BR less ,
385 .PP
386 put these lines in your
387 .I \&.login
388 file:
389 .PP
390 .RS 5
391 .nf
392 setenv LESSCHARSET latin1
393 setenv LESS "-f"
394 .fi
395 .RE
396 .PP
397 The first line tells
398 .B less
399 to use the ISO-8859-1 definition for
400 determining whether a character is \*(lqnormal\*(rq, \*(lqcontrol\*(lq,
401 or \*(lqbinary\*(rq.  The second line tells
402 .B less
403 not to warn you
404 if it encounters a file that has non-ASCII characters.  Then, simply
405 set the
406 .I moreproc
407 profile entry to
408 .BR less ,
409 and it will get
410 called automatically.  (To handle other single-octet character sets,
411 look at the
412 .BR less (1)
413 manual entry for information about the
414 .B $LESSCHARDEF
415 environment variable.)
416 .SS "Messages of Type message/partial"
417 .B mhshow
418 cannot directly display messages of type partial.
419 You must reassemble them first into a normal message using
420 .BR mhstore .
421 Check the man page for
422 .BR mhstore (1)
423 for details.
424 .SS "External Access"
425 For contents of type message/external-body,
426 .B mhshow
427 supports these access-types:
428 .PP
429 .IP \(bu 4
430 afs
431 .IP \(bu 4
432 anon-ftp
433 .IP \(bu 4
434 ftp
435 .IP \(bu 4
436 local-file
437 .IP \(bu 4
438 mail-server
439 .PP
440 For the \*(lqanon-ftp\*(rq and \*(lqftp\*(rq access types,
441 .B mhshow
442 will look for the \*(lqnmh-access-ftp\*(rq
443 profile entry, e.g.,
444 .PP
445 .RS 5
446 nmh-access-ftp: myftp.sh
447 .RE
448 .PP
449 to determine the pathname of a program to perform the FTP retrieval.
450 .PP
451 This program is invoked with these arguments:
452 .PP
453 .RS 5
454 .nf
455 domain name of FTP-site
456 username
457 password
458 remote directory
459 remote filename
460 local filename
461 \*(lqascii\*(rq or \*(lqbinary\*(rq
462 .fi
463 .RE
464 .PP
465 The program should terminate with an exit status of zero if the
466 retrieval is successful, and a non-zero exit status otherwise.
467 .PP
468 If this entry is not provided, then
469 .B mhshow
470 will use a simple
471 built-in FTP client to perform the retrieval.
472 .SS "The Content Cache"
473 When
474 .B mhshow
475 encounters an external content containing a
476 \*(lqContent-ID:\*(rq field, and if the content allows caching, then
477 depending on the caching behavior of
478 .BR mhshow ,
479 the content might be read from or written to a cache.
480 .PP
481 The caching behavior of
482 .B mhshow
483 is controlled with the
484 .B \-rcache
485 and
486 .B \-wcache
487 switches, which define the policy for reading from,
488 and writing to, the cache, respectively.  One of four policies may be
489 specified: \*(lqpublic\*(rq, indicating that
490 .B mhshow
491 should make use
492 of a publically-accessible content cache; \*(lqprivate\*(rq, indicating
493 that
494 .B mhshow
495 should make use of the user's private content cache;
496 \*(lqnever\*(rq, indicating that
497 .B mhshow
498 should never make use of
499 caching; and, \*(lqask\*(rq, indicating that
500 .B mhshow
501 should ask the user.
502 .PP
503 There are two directories where contents may be cached: the profile entry
504 \*(lqnmh-cache\*(rq names a directory containing world-readable contents, and,
505 the profile entry \*(lqnmh-private-cache\*(rq names a directory containing
506 private contents.  The former should be an absolute (rooted) directory
507 name.
508 .PP
509 For example,
510 .PP
511 .RS 5
512 nmh-cache: /tmp
513 .RE
514 .PP
515 might be used if you didn't care that the cache got wiped after each
516 reboot of the system.  The latter is interpreted relative to the user's
517 nmh directory, if not rooted, e.g.,
518 .PP
519 .RS 5
520 nmh-private-cache: .cache
521 .RE
522 .PP
523 (which is the default value).
524 .SS "User Environment"
525 Because the display environment in which
526 .B mhshow
527 operates may vary for
528 different machines,
529 .B mhshow
530 will look for the environment variable
531 .BR $MHSHOW .
532 If present, this specifies the name of an additional
533 user profile which should be read.  Hence, when a user logs in on a
534 particular display device, this environment variable should be set to
535 refer to a file containing definitions useful for the given display device.
536 Normally, only entries that deal with the methods to display different
537 content type and subtypes
538 .PP
539 .RS 5
540 .nf
541 mhshow-show-<type>/<subtype>
542 mhshow-show-<type>
543 .fi
544 .RE
545 .PP
546 need be present in this additional profile. Finally,
547 .B mhshow
548 will attempt to consult one other additional user profile,
549 e.g.,
550 .PP
551 .RS 5
552 %etcdir%/mhn.defaults
553 .RE
554 .PP
555 which is created automatically during
556 .B nmh
557 installation.
558
559 .SH FILES
560 .fc ^ ~
561 .nf
562 .ta \w'%etcdir%/ExtraBigFileName  'u
563 ^$HOME/\&.mh\(ruprofile~^The user profile
564 ^$MHSHOW~^Additional profile entries
565 ^%etcdir%/mhn.defaults~^System default MIME profile entries
566 ^%etcdir%/mhl.headers~^The headers template
567 .fi
568
569 .SH "PROFILE COMPONENTS"
570 .fc ^ ~
571 .nf
572 .ta 2.4i
573 .ta \w'ExtraBigProfileName  'u
574 ^Path:~^To determine the user's nmh directory
575 ^Current\-Folder:~^To find the default current folder
576 ^Unseen\-Sequence:~^To name sequences denoting unseen messages
577 ^mhlproc:~^Default program to display message headers
578 ^nmh-access-ftp:~^Program to retrieve contents via FTP
579 ^nmh-cache~^Public directory to store cached external contents
580 ^nmh-private-cache~^Personal directory to store cached external contents
581 ^mhshow-charset-<charset>~^Template for environment to render character sets
582 ^mhshow-show-<type>*~^Template for displaying contents
583 ^moreproc:~^Default program to display text/plain content
584 .fi
585
586 .SH "SEE ALSO"
587 mhbuild(1), mhl(1), mhlist(1), mhstore(1), sendfiles(1)
588
589 .SH DEFAULTS
590 .nf
591 .RB ` +folder "' defaults to the current folder"
592 .RB ` msgs "' defaults to cur"
593 .RB ` \-nocheck '
594 .RB ` \-form mhl.headers '
595 .RB ` \-pause '
596 .RB ` \-rcache ask '
597 .RB ` \-realsize '
598 .RB ` \-noserialonly '
599 .RB ` \-noverbose '
600 .RB ` \-wcache ask '
601 .fi
602
603 .SH CONTEXT
604 If a folder is given, it will become the current folder.  The last
605 message selected will become the current message.