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