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