the mhshow "-markform" format is now used for all part separators, not
just those being left out. the format now overloads the %(unseen)
function to indicate that the content of the part being marked has
been suppressed. the built-in default and example formats both make
use of this function.
%; used by mhshow when it decides to not display content.
%;
[ part %{part} - %{content-type} - %<{description}\
%; used by mhshow when it decides to not display content.
%;
[ part %{part} - %{content-type} - %<{description}\
-%{description}%?{cdispo-filename}%{cdispo-filename}%|%{ctype-name}%> ]
+%{description}%?{cdispo-filename}%{cdispo-filename}%|%{ctype-name}%> \
+%<(unseen)\(suppressed\)%> ]
.IR mh-profile (5)
for the profile search order, and for how duplicate entries are treated.
.SS Content\-Type Marker
.IR mh-profile (5)
for the profile search order, and for how duplicate entries are treated.
.SS Content\-Type Marker
-decides to not display a particular part due to the switches of
-.B \-textonly
-or
-.B \-inlineonly
-it will display a marker containing information about the part. This
-marker is processed via
-.IR mh\-format (5)
-and can be changed by the use of the
+will display a marker containing information about the part being displayed
+next. The default marker can be changed using the
-switch to specify a file containing the
+switch to specify a file containing
.IR mh\-format (5)
instructions to use when displaying the content marker. In addition to
the normal set of
.IR mh\-format (5)
instructions to use when displaying the content marker. In addition to
the normal set of
ctype-<PARAM> string Value of <PARAM> from Content\-Type header
cdispo-<PARAM> string Value of <PARAM> from
Content\-Disposition header
ctype-<PARAM> string Value of <PARAM> from Content\-Type header
cdispo-<PARAM> string Value of <PARAM> from
Content\-Disposition header
+%(unseen) boolean Returns true for suppressed parts.
+In this context, the %(unseen) function indicates whether
+.B mhshow
+has decided to not display a particular part due to the
+.B \-textonly
+or
+.B \-inlineonly
+switches.
.RE
All MIME parameters and the \*(lqContent-Description\*(rq header will have
RFC 2231 decoding applied and be converted
.RE
All MIME parameters and the \*(lqContent-Description\*(rq header will have
RFC 2231 decoding applied and be converted
-int show_content_aux (CT, int, char *, char *);
+int show_content_aux (CT, int, char *, char *, struct format *fmt);
static void show_single_message (CT, char *, int, int, int, struct format *);
static void DisplayMsgHeader (CT, char *, int);
static int show_switch (CT, int, int, int, int, struct format *);
static void show_single_message (CT, char *, int, int, int, struct format *);
static void DisplayMsgHeader (CT, char *, int);
static int show_switch (CT, int, int, int, int, struct format *);
-static int show_content (CT, int, int, int, struct format *fmt);
-static int show_content_aux2 (CT, int, char *, char *, int, int, int);
-static int show_text (CT, int, int);
+static int show_content (CT, int, int, int, struct format *);
+static int show_content_aux2 (CT, int, char *, char *, int, int, int, struct format *);
+static int show_text (CT, int, int, struct format *);
static int show_multi (CT, int, int, int, int, struct format *);
static int show_multi (CT, int, int, int, int, struct format *);
-static int show_multi_internal (CT, int, int, int, int, struct format *fmt);
-static int show_multi_aux (CT, int, char *);
-static int show_message_rfc822 (CT, int);
+static int show_multi_internal (CT, int, int, int, int, struct format *);
+static int show_multi_aux (CT, int, char *, struct format *);
+static int show_message_rfc822 (CT, int, struct format *);
static int show_partial (CT, int);
static int show_external (CT, int, int, int, int, struct format *);
static int parse_display_string (CT, char *, int *, int *, char *, char *,
size_t, int multipart);
static int convert_content_charset (CT, char **);
static struct format *compile_marker(char *);
static int show_partial (CT, int);
static int show_external (CT, int, int, int, int, struct format *);
static int parse_display_string (CT, char *, int *, int *, char *, char *,
size_t, int multipart);
static int convert_content_charset (CT, char **);
static struct format *compile_marker(char *);
-static void output_marker (CT, struct format *);
+static void output_marker (CT, struct format *, int);
static void free_markercomps (void);
static int pidcheck(int);
static void free_markercomps (void);
static int pidcheck(int);
case MESSAGE_RFC822:
default:
case MESSAGE_RFC822:
default:
- return show_message_rfc822 (ct, alternate);
+ return show_message_rfc822 (ct, alternate, fmt);
- return show_text (ct, alternate, concatsw);
+ return show_text (ct, alternate, concatsw, fmt);
case CT_AUDIO:
case CT_IMAGE:
case CT_AUDIO:
case CT_IMAGE:
*/
if (textonly || (inlineonly && !is_inline(ct))) {
*/
if (textonly || (inlineonly && !is_inline(ct))) {
- output_marker(ct, fmt);
+ output_marker(ct, fmt, 1);
snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
invo_name, ci->ci_type, ci->ci_subtype);
if ((cp = context_find (buffer)) && *cp != '\0')
snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
invo_name, ci->ci_type, ci->ci_subtype);
if ((cp = context_find (buffer)) && *cp != '\0')
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
/* Check for invo_name-show-type */
snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
if ((cp = context_find (buffer)) && *cp != '\0')
/* Check for invo_name-show-type */
snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
if ((cp = context_find (buffer)) && *cp != '\0')
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
if ((cp = ct->c_showproc))
if ((cp = ct->c_showproc))
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
/* complain if we are not a part of a multipart/alternative */
if (!alternate)
/* complain if we are not a part of a multipart/alternative */
if (!alternate)
-show_content_aux (CT ct, int alternate, char *cp, char *cracked)
+show_content_aux (CT ct, int alternate, char *cp, char *cracked, struct format *fmt)
{
int fd;
int xstdin = 0, xlist = 0;
{
int fd;
int xstdin = 0, xlist = 0;
got_command:
return show_content_aux2 (ct, alternate, cracked, buffer,
got_command:
return show_content_aux2 (ct, alternate, cracked, buffer,
+ fd, xlist, xstdin, fmt);
static int
show_content_aux2 (CT ct, int alternate, char *cracked, char *buffer,
static int
show_content_aux2 (CT ct, int alternate, char *cracked, char *buffer,
- int fd, int xlist, int xstdin)
+ int fd, int xlist, int xstdin, struct format *fmt)
{
pid_t child_id;
int i, vecp;
{
pid_t child_id;
int i, vecp;
- if (ct->c_type == CT_MULTIPART)
- list_content (ct, -1, 1, 0, 0, 0);
- else
- list_switch (ct, -1, 1, 0, 0, 0);
+ output_marker(ct, fmt, 0);
-show_text (CT ct, int alternate, int concatsw)
+show_text (CT ct, int alternate, int concatsw, struct format *fmt)
{
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
{
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
invo_name, ci->ci_type, ci->ci_subtype);
if ((cp = context_find (buffer)) && *cp != '\0')
snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
invo_name, ci->ci_type, ci->ci_subtype);
if ((cp = context_find (buffer)) && *cp != '\0')
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
/* Check for invo_name-show-type */
snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
if ((cp = context_find (buffer)) && *cp != '\0')
/* Check for invo_name-show-type */
snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
if ((cp = context_find (buffer)) && *cp != '\0')
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
/*
* Use default method if content is text/plain, or if
/*
* Use default method if content is text/plain, or if
snprintf (buffer, sizeof(buffer), "%%l%s %%F", progsw ? progsw :
moreproc && *moreproc ? moreproc : DEFAULT_PAGER);
cp = (ct->c_showproc = add (buffer, NULL));
snprintf (buffer, sizeof(buffer), "%%l%s %%F", progsw ? progsw :
moreproc && *moreproc ? moreproc : DEFAULT_PAGER);
cp = (ct->c_showproc = add (buffer, NULL));
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
invo_name, ci->ci_type, ci->ci_subtype);
if ((cp = context_find (buffer)) && *cp != '\0')
snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
invo_name, ci->ci_type, ci->ci_subtype);
if ((cp = context_find (buffer)) && *cp != '\0')
- return show_multi_aux (ct, alternate, cp);
+ return show_multi_aux (ct, alternate, cp, fmt);
/* Check for invo_name-show-type */
snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
if ((cp = context_find (buffer)) && *cp != '\0')
/* Check for invo_name-show-type */
snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
if ((cp = context_find (buffer)) && *cp != '\0')
- return show_multi_aux (ct, alternate, cp);
+ return show_multi_aux (ct, alternate, cp, fmt);
if ((cp = ct->c_showproc))
if ((cp = ct->c_showproc))
- return show_multi_aux (ct, alternate, cp);
+ return show_multi_aux (ct, alternate, cp, fmt);
/*
* Use default method to display this multipart content. Even
/*
* Use default method to display this multipart content. Even
-show_multi_aux (CT ct, int alternate, char *cp)
+show_multi_aux (CT ct, int alternate, char *cp, struct format *fmt)
{
/* xstdin is only used in the call to parse_display_string():
its value is ignored in the function. */
{
/* xstdin is only used in the call to parse_display_string():
its value is ignored in the function. */
- return show_content_aux2 (ct, alternate, NULL, buffer, NOTOK, xlist, 0);
+ return show_content_aux2 (ct, alternate, NULL, buffer, NOTOK, xlist, 0, fmt);
-show_message_rfc822 (CT ct, int alternate)
+show_message_rfc822 (CT ct, int alternate, struct format *fmt)
{
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
{
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
invo_name, ci->ci_type, ci->ci_subtype);
if ((cp = context_find (buffer)) && *cp != '\0')
snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
invo_name, ci->ci_type, ci->ci_subtype);
if ((cp = context_find (buffer)) && *cp != '\0')
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
/* Check for invo_name-show-type */
snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
if ((cp = context_find (buffer)) && *cp != '\0')
/* Check for invo_name-show-type */
snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
if ((cp = context_find (buffer)) && *cp != '\0')
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
if ((cp = ct->c_showproc))
if ((cp = ct->c_showproc))
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
/* default method for message/rfc822 */
if (ct->c_subtype == MESSAGE_RFC822) {
cp = (ct->c_showproc = add ("%pshow -file %F", NULL));
/* default method for message/rfc822 */
if (ct->c_subtype == MESSAGE_RFC822) {
cp = (ct->c_showproc = add ("%pshow -file %F", NULL));
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
}
/* complain if we are not a part of a multipart/alternative */
}
/* complain if we are not a part of a multipart/alternative */
#define DEFAULT_MARKER "[ part %{part} - %{content-type} - %<{description}" \
"%{description}%?{cdispo-filename}%{cdispo-filename}" \
#define DEFAULT_MARKER "[ part %{part} - %{content-type} - %<{description}" \
"%{description}%?{cdispo-filename}%{cdispo-filename}" \
+ "%|%{ctype-name}%> %<(unseen)\\(suppressed\\)%> ]"
static struct format *
compile_marker(char *markerform)
static struct format *
compile_marker(char *markerform)
-output_marker(CT ct, struct format *fmt)
+output_marker(CT ct, struct format *fmt, int hidden)
{
char outbuf[BUFSIZ];
struct param_comp_list *pcentry;
{
char outbuf[BUFSIZ];
struct param_comp_list *pcentry;
pcentry->param, '?', 0);
}
pcentry->param, '?', 0);
}
+ /* make the part's hidden aspect available by overloading the
+ * %(unseen) function. see comments in h/fmt_scan.h.
+ */
+ dat[0] = dat[1] = dat[2] = dat[3] = 0;
+ dat[4] = hidden;
+
fmt_scan(fmt, outbuf, sizeof(outbuf), sizeof(outbuf), dat, NULL);
fputs(outbuf, stdout);
fmt_scan(fmt, outbuf, sizeof(outbuf), sizeof(outbuf), dat, NULL);
fputs(outbuf, stdout);