Fix out-of-bounds error when incorporating email from stdin
[mmh] / man / show.man1
1 .\"
2 .\" %nmhwarning%
3 .\"
4 .TH SHOW %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
5 .SH NAME
6 show \- display (MIME) messages
7 .PP
8 next \- show the next message
9 .PP
10 prev \- show the previous message
11 .SH SYNOPSIS
12 .HP 5
13 .na
14 .B show
15 .RI [ +folder ]
16 .RI [ msgs ]
17 .RB [ \-file
18 .IR file ]
19 .RB [ \-part
20 .IR number ]
21 \&...
22 .RB [ \-type
23 .IR content ]
24 \&...
25 .RB [ \-form
26 .IR formfile ]
27 .RB [ \-Version ]
28 .RB [ \-help ]
29 .PP
30 .HP 5
31 .B next
32 is equivalent to
33 .B show n
34 .PP
35 .HP 5
36 .B prev
37 is equivalent to
38 .B show p
39 .ad
40
41 .SH NOTE
42 This (i.e. mmh's) version of
43 .B show
44 is a modified version of nmh's
45 .B mhshow
46 program.
47 The old (non-MIME)
48 .B show
49 program was removed from mmh.
50
51 .SH DESCRIPTION
52 The
53 .B show
54 command display contents of a MIME (multi-media)
55 message or collection of messages.
56 .B Next
57 and
58 .B prev
59 perform a
60 .B show
61 on the next or previous message in the specified
62 (or current) folder, respectively.
63 .PP
64 .B show
65 manipulates multi-media messages as specified in
66 RFC\-2045 thru RFC\-2049.  Currently
67 .B show
68 only supports
69 encodings in message bodies, and does not support the encoding of
70 message headers as specified in RFC\-2047.
71 .PP
72 By default
73 .B show
74 will display all parts of a multipart
75 message.  By using the
76 .B \-part
77 and
78 .B \-type
79 switches, you may
80 limit the scope of
81 .B show
82 to particular subparts (of a
83 multipart content) and/or particular content types.
84 .PP
85 The option
86 .B \-file
87 .I file
88 directs
89 .B show
90 to use the specified file as
91 the source message, rather than a message from a folder.  If you specify
92 this file as `-', then
93 .B show
94 will accept the source message
95 on the standard input.  Note that the file, or input from standard input
96 should be a validly formatted message, just like any other
97 .B mh
98 message.  It should
99 .B NOT
100 be in mail drop format (to convert a file in
101 mail drop format to a folder of
102 .B mh
103 messages, see
104 .BR inc (1)).
105 .PP
106 When displaying multiple messages,
107 .B show
108 prepends each of them with a `>>> Message nnn' header,
109 and separates the messages with two lines of space.
110 This is similar to the way
111 .B mhl
112 acts on multiple files.
113 .PP
114 A part specification consists of a series of numbers separated by dots.
115 For example, in a multipart content containing three parts, these
116 would be named as 1, 2, and 3, respectively.  If part 2 was also a
117 multipart content containing two parts, these would be named as 2.1 and
118 2.2, respectively.  Note that the
119 .B \-part
120 switch is effective for only
121 messages containing a multipart content.  If a message has some other
122 kind of content, or if the part is itself another multipart content, the
123 .B \-part
124 switch will not prevent the content from being acted upon.
125 .PP
126 A content specification consists of a content type and a subtype.
127 The initial list of `standard' content types and subtypes can
128 be found in RFC\-2046.
129 .PP
130 A list of commonly used contents is briefly reproduced here:
131 .PP
132 .RS 5
133 .nf
134 .ta \w'application  'u
135 Type    Subtypes
136 ----    --------
137 text    plain, enriched
138 multipart       mixed, alternative, digest, parallel
139 message rfc822, partial, external-body
140 application     octet-stream, postscript
141 image   jpeg, gif, png
142 audio   basic
143 video   mpeg
144 .fi
145 .RE
146 .PP
147 A legal MIME message must contain a subtype specification.
148 .PP
149 To specify a content, regardless of its subtype, just use the
150 name of the content, e.g., `audio'.  To specify a specific
151 subtype, separate the two with a slash, e.g., `audio/basic'.
152 Note that regardless of the values given to the `\-type' switch, a
153 multipart content (of any subtype listed above) is always acted upon.
154 .SS "Unseen Sequence"
155 If the profile entry `Unseen\-Sequence' is present and
156 non\-empty, then
157 .B show
158 will remove each of the messages shown
159 from each sequence named by the profile entry.
160 .SS "Showing the Contents"
161 .B Mhshow
162 prints messages in a convenient representation.
163 If
164 .B show
165 is outputting to a terminal, then
166 a pager will be placed between the terminal and
167 .BR show .
168 .PP
169 The headers of each message are displayed with
170 .B mhl
171 using the standard format file
172 .IR mhl.headers .
173 You may specify an alternate format file with the
174 .B \-form
175 .I formfile
176 switch.  If the format file
177 .I mhl.null
178 is specified, then the display
179 of the message headers is suppressed.
180 .PP
181 Next, the contents are extracted from the message and are stored in
182 a temporary file.  Usually, the name of the temporary file is the
183 word `show' followed by a string of characters.  Occasionally,
184 the method used to display a content (described next), requires that
185 the file end in a specific suffix.  For example, the
186 .B soffice
187 command (part of the StarOffice package) can be used to display
188 Microsoft Word content, but it uses the suffix to determine how to display
189 the file.  If no suffix is present, the file is not correctly loaded.
190 Similarly, older versions of the
191 .B gs
192 command append a `.ps' suffix to
193 the filename if one was missing.  As a result, these cannot be used to read
194 the default temporary file.
195 .PP
196 To get around this, your profile can contain lines of the forms:
197 .PP
198 .RS 5
199 .nf
200 mhshow-suffix-<type>/<subtype>: <suffix>
201 mhshow-suffix-<type>: <suffix>
202 .fi
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 `display string'.  To find the display
221 string,
222 .B show
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 show
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 `/bin/sh', 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 %l      Display listing prior to displaying content
250 %f      Insert filename containing content
251 %F      %f, but stdin is terminal not content
252 %a      Insert parameters from Content-Type field
253 %s      Insert content subtype
254 %c      Insert foreign charset
255 %d      Insert content description
256 %%      The character %
257 .fi
258 .RE
259 .PP
260 .B Mhshow
261 processes the MIME parts serially, i.e. the next display process
262 is executed after the previous one has terminated.
263 .PP
264 Further, when
265 .B show
266 is display a content, typing QUIT (usually
267 control-\\) will tell
268 .B show
269 to wrap things up immediately.
270 .PP
271 Note that if the content being displayed is multipart, but not one of
272 the subtypes listed above, then the f- and F-escapes expand to multiple
273 filenames, one for each subordinate content.  Further, stdin is not
274 redirected from the terminal to the content.
275 .PP
276 If a display string is not found,
277 .B show
278 has the following default values:
279 .PP
280 .RS 5
281 .nf
282 mhshow-show-text/plain: %liconv \-f <source-charset>
283 mhshow-show-message/rfc822: %lshow \-file %F
284 .fi
285 .RE
286 .PP
287 If a subtype of type text doesn't have a profile entry, it will be
288 treated as text/plain.
289 .PP
290 .B show
291 has default methods for handling multipart messages of subtype
292 mixed, alternative, parallel, and digest.  Any unknown subtype of type
293 multipart (without a profile entry), will be treated as multipart/mixed.
294 .PP
295 If none of these apply, then
296 .B show
297 will complain.
298 .PP
299 Example entries might be:
300 .PP
301 .RS 5
302 .nf
303 mhshow-show-audio/basic: raw2audio 2>/dev/null | play
304 mhshow-show-image: xv %f
305 mhshow-show-application/PostScript: lpr \-Pps
306 .fi
307 .RE
308 .PP
309 When expanding %f and %F escapes, the file names get wrapped in
310 single-quotes automatically.
311 .PP
312 Finally,
313 .B show
314 will process each message serially \- it won't start
315 showing the next message until all the commands executed to display the
316 current message have terminated.  Although a multipart content may
317 contain advice to display the parts in parallel,
318 .B show
319 will never do so.
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 show
324 encounters a `charset' parameter for
325 this content, it checks if your terminal can display this character
326 set natively.
327 .B show
328 checks this by first examining the the environment
329 variable
330 .B $MM_CHARSET
331 and if not set, taking the character encoding of the current locale.
332 .PP
333 If the character set of text/plain cannot be displayed natively, then
334 the default display method converts the content automatically by
335 piping it through:
336 .PP
337 .RS 5
338 iconv \-f '<source-charset>'
339 .RE
340 .PP
341 Note that if you have a custom `mhshow-show-*' display string, you
342 need to care yourself for converting the encodings.
343 (The foreign charset is available through the %c escape.)
344 .PP
345 The tool
346 .B iconv
347 needs to be available.
348 .PP
349 `mhshow-charset-*' profile entries are not supported anymore.
350 .SS "Messages of Type message/partial"
351 .B show
352 cannot directly display messages of type partial.
353 You must reassemble them first into a normal message using
354 .BR mhstore .
355 Check the man page for
356 .BR mhstore (1)
357 for details.
358 .SS "External Access"
359 .B Mhshow
360 does not automatically retrieve message/external-body parts (anymore),
361 but prints the relevant information to enable the user to retrieve
362 the files manually.
363 .SS "User Environment"
364 Because the display environment in which
365 .B show
366 operates may vary for
367 different machines,
368 .B show
369 will look for the environment variable
370 .BR $MHSHOW .
371 If present, this specifies the name of an additional
372 user profile which should be read.  Hence, when a user logs in on a
373 particular display device, this environment variable should be set to
374 refer to a file containing definitions useful for the given display device.
375 Normally, only entries that deal with the methods to display different
376 content type and subtypes
377 .PP
378 .RS 5
379 .nf
380 mhshow-show-<type>/<subtype>
381 mhshow-show-<type>
382 .fi
383 .RE
384 .PP
385 need be present in this additional profile. Finally,
386 .B show
387 will attempt to consult one other additional user profile,
388 e.g.,
389 .PP
390 .RS 5
391 %etcdir%/mhn.defaults
392 .RE
393 .PP
394 which is created automatically during
395 .B mmh
396 installation.
397
398 .SH FILES
399 .fc ^ ~
400 .nf
401 .ta \w'%etcdir%/ExtraBigFileName  'u
402 ^$HOME/.mmh/profile~^The user profile
403 ^$MHSHOW~^Additional profile entries
404 ^%etcdir%/mhn.defaults~^System default MIME profile entries
405 ^%etcdir%/mhl.headers~^The headers template
406 .fi
407
408 .SH "PROFILE COMPONENTS"
409 .fc ^ ~
410 .nf
411 .ta 2.4i
412 .ta \w'ExtraBigProfileName  'u
413 ^Path:~^To determine the user's mail storage
414 ^Current\-Folder:~^To find the default current folder
415 ^Unseen\-Sequence:~^To name sequences denoting unseen messages
416 ^mhshow-show-<type>*~^Template for displaying contents
417 ^Pager:~^Program to use as interactive front\-end
418 .fi
419
420 .SH "SEE ALSO"
421 mhbuild(1), mhl(1), mhlist(1), mhstore(1), sendfiles(1)
422
423 .SH DEFAULTS
424 .nf
425 .RB ` +folder "' defaults to the current folder"
426 .RB ` msgs "' defaults to the current message"
427 .RB ` \-form \ mhl.headers'
428 .RB ` \-noverbose '
429 .fi
430
431 .SH CONTEXT
432 If a folder is given, it will become the current folder.  The last
433 message selected will become the current message.
434
435 .SH BUGS
436 .B Next
437 and
438 .B prev
439 are really links to the
440 .B show
441 program.  As a result, if
442 you make a link to
443 .B next
444 or
445 .B prev
446 and that link is not called
447 .B next
448 or
449 .BR prev ,
450 your link will act like
451 .B show
452 instead.  To circumvent this, add a
453 profile\-entry for the link to your
454 .B mmh
455 profile and add the argument
456 .I n
457 or
458 .I p
459 to the entry.