mhl − produce formatted listings of mh messages
mhl |
[−form formfile] [−width columns] [files ...] [−Version] [−help] |
Mhl is an mmh command for filtering and/or displaying text messages. It is the default method of displaying text messages for mmh (it is the default showproc).
The −width width switch sets the screen width. This defaults to the value indicated by $TERMCAP, if appropriate, otherwise it defaults to 80.
The default format file used by mhl is called ‘mhl.format’. mhl will first search for this file in the user’s mmh directory, and will then search in the directory /etc/mmh. This default can be changed by using the −form formatfile switch. Note: In contrast to any other mmh tool, the −form switch does only take file names, but no format strings with a prepended equal sign ‘=’.
Mhl operates in two phases: 1) read and parse the format file, and 2) process each message (file). During phase 1, an internal description of the format is produced as a structured list. In phase 2, this list is walked for each message, outputting message information under the format constraints from the format file.
The format file can contain information controlling screen size, wrap−around control, transparent text, component ordering, and component formatting. Also, a list of components to ignore may be specified, and a couple of ‘special’ components are defined to provide added functionality. Message output will be in the order specified by the order in the format file.
Each line of a format file has one of the following forms:
;comment
:cleartext
variable[,variable...]
component:[variable,...]
• |
A line beginning with a ‘;’ is a comment, and is ignored. | ||
• |
A line beginning with a ‘:’ is clear text, and is output exactly as is. | ||
• |
A line containing only a ‘:’ produces a blank line in the output. | ||
• |
A line beginning with ‘component:’ defines the format for the specified component, | ||
• |
Remaining lines define the global environment. |
For example, the line:
width=80,overflowtext="***",overflowoffset=5
defines the screen size to be 80 columns by 40 rows, specifies that the overflow indentation is 5, and that overflow text should be flagged with ‘***’.
Following are all of the current variables and their arguments. If they follow a component, they apply only to that component, otherwise, their affect is global. Since the whole format is parsed before any output processing, the last global switch setting for a variable applies to the whole message if that variable is used in a global context (i.e., width).
variable type semantics
width |
integer | ||
screen width or component width | |||
length |
integer | ||
component length | |||
offset |
integer | ||
positions to indent ‘component: ’ | |||
overflowtext |
string | ||
text to use at the beginning of an | |||
overflow line | |||
overflowoffset |
integer | ||
positions to indent overflow lines | |||
compwidth |
integer | ||
positions to indent component text | |||
after the first line is output | |||
uppercase |
flag | ||
output text of this component in all | |||
upper case | |||
nouppercase |
flag | ||
don’t uppercase | |||
component |
string/L | ||
name to use instead of ‘component’ for | |||
this component | |||
nocomponent |
flag | ||
don’t output ‘component: ’ for this | |||
component | |||
center |
flag | ||
center component on line (works for | |||
one−line components only) | |||
nocenter |
flag | ||
don’t center | |||
leftadjust |
flag | ||
strip off leading whitespace on each | |||
line of text | |||
noleftadjust |
flag | ||
don’t leftadjust | |||
compress |
flag | ||
change newlines in text to spaces | |||
nocompress |
flag | ||
don’t compress | |||
rtrim |
flag | ||
trim whitespace at end of text lines | |||
nortrim |
flag | ||
retain whitespace at end of text lines (default) | |||
split |
flag | ||
don’t combine multiple fields into | |||
a single field | |||
nosplit |
flag | ||
combine multiple fields into | |||
a single field | |||
newline |
flag | ||
print newline at end of components | |||
(this is the default) | |||
nonewline |
flag | ||
don’t print newline at end of components | |||
formatfield |
string | ||
format string for this component | |||
(see below) | |||
decode |
flag | ||
decode text as RFC-2047 encoded | |||
header field | |||
addrfield |
flag | ||
field contains addresses | |||
datefield |
flag | ||
field contains dates |
To specify the value of integer−valued and string−valued variables, follow their name with an equals−sign and the value. Integer−valued variables are given decimal values, while string−valued variables are given arbitrary text bracketed by double−quotes. If a value is suffixed by ‘/G’ or ‘/L’, then its value is useful in a global−only or local−only context (respectively).
A line of the form:
ignores=component,...
specifies a list of components which are never output. This option supports some simple globbing, so a ’*’ at the end of a component will match for all components which start wich the string. When you want to match a component which ends with a ’*’, you can escape the ’*’ with a ’\’.
The component ‘MessageName’ (case−insensitive) will output the message file name as a one-line header, similar to show. E.g. ‘‘(Message 42)’’
The component ‘Extras’ will output all of the components of the message which were not matched by explicit components, or included in the ignore list. If this component is not specified, an ignore list is not needed since all non−specified components will be ignored.
If ‘nocomponent’ is NOT specified, then the component name will be output as it appears in the format file.
The default format file is:
; mhl.format
;
; default message filter for ‘show’
;
:
overflowtext="***",overflowoffset=5
leftadjust,compwidth=9
ignores=msgid,message-id,received,content-type,content-transfer-encoding,content-id
Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>"
From:decode
To:decode
Cc:decode
Subject:decode
:
extras:nocomponent
:
body:nocomponent,overflowtext=,overflowoffset=0,noleftadjust
The variable ‘formatfield’ specifies a format string (see mh−format(5)). The flag variables ‘addrfield’ and ‘datefield’ (which are mutually exclusive), tell mhl to interpret the escapes in the format string as either addresses or dates, respectively.
By default, mhl does not apply any formatting string to fields containing address or dates (see mh−mail(5) for a list of these fields). Note that this results in faster operation since mhl must parse both addresses and dates in order to apply a format string to them. If desired, mhl can be given a default format string for either address or date fields (but not both). To do this, on a global line specify: either the flag addrfield or datefield, along with the appropriate formatfield variable string.
/etc/mmh/mhl.format
The message template
or $HOME/.mmh/mhl.format Rather than the standard template
$HOME/.mmh/profile The user profile
none
show(1), ap(8), dp(8)
‘−width 80’
None
In contrast to any other mmh tool, the −form switch does only take file names, but no format strings with a prepended equal sign ‘=’.
The ‘nonewline’ option interacts badly with ‘compress’ and ‘split’.