-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 *);
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);
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
-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)
got_command:
return show_content_aux2 (ct, alternate, cracked, buffer,
got_command:
return show_content_aux2 (ct, alternate, cracked, buffer,
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,
- 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)
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
* if it is not a text part of a multipart/alternative
*/
if (!alternate || ct->c_subtype == TEXT_PLAIN) {
/*
* Use default method if content is text/plain, or if
* if it is not a text part of a multipart/alternative
*/
if (!alternate || ct->c_subtype == TEXT_PLAIN) {
- if (concatsw)
- snprintf(buffer, sizeof(buffer), "%%l");
- else
+ if (concatsw) {
+ if (ct->c_termproc)
+ snprintf(buffer, sizeof(buffer), "%%lcat");
+ else
+ snprintf(buffer, sizeof(buffer), "%%l");
+ } else
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')
/* 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')
int alternating, nowalternate, result;
struct multipart *m = (struct multipart *) ct->c_ctparams;
struct part *part;
int alternating, nowalternate, result;
struct multipart *m = (struct multipart *) ct->c_ctparams;
struct part *part;
inneresult = show_switch (p, nowalternate, concatsw, textonly,
inlineonly, fmt);
switch (inneresult) {
inneresult = show_switch (p, nowalternate, concatsw, textonly,
inlineonly, fmt);
switch (inneresult) {
-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);
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);
- return show_content_aux (ct, alternate, cp, NULL);
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
- cp = (ct->c_showproc = add ("%pecho -file %F", NULL));
- return show_content_aux (ct, alternate, cp, NULL);
+ cp = (ct->c_showproc = add ("%pshow -file %F", NULL));
+ return show_content_aux (ct, alternate, cp, NULL, fmt);
- /* norm_charmap() is case sensitive. */
- char *src_charset_u = upcase (src_charset);
- char *dest_charset_u = upcase (dest_charset);
- int different_charsets =
- strcmp (norm_charmap (src_charset), norm_charmap (dest_charset));
-
- free (dest_charset_u);
- free (src_charset_u);
-
- if (different_charsets) {
+ if (strcasecmp (src_charset, dest_charset)) {
advise (NULL, "Can't convert %s to %s without iconv", src_charset,
dest_charset);
advise (NULL, "Can't convert %s to %s without iconv", src_charset,
dest_charset);
- if (convert_charset (ct, get_charset (), &unused) == 0) {
+ char *charset = getcpy (get_charset ());
+
+ if (convert_charset (ct, charset, &unused) == 0) {
-#define DEFAULT_MARKER "[ part %{part} - %{content-type} - %<{description}" \
- "%{description}%?{cdispo-filename}%{cdispo-filename}" \
- "%|%{ctype-name}%> ]"
+#define DEFAULT_MARKER "[ part %{part} - %{content-type} - " \
+ "%<{description}%{description}" \
+ "%?{cdispo-filename}%{cdispo-filename}" \
+ "%|%{ctype-name}%> " \
+ "%(units(size))B %<(unseen)\\(suppressed\\)%> ]"
+ if (ct->c_cesizefnx)
+ partsize = (*ct->c_cesizefnx) (ct);
+ else
+ partsize = ct->c_end - ct->c_begin;
+
+ /* make the part's hidden aspect available by overloading the
+ * %(unseen) function. make the part's size available via %(size).
+ * see comments in h/fmt_scan.h.
+ */
+ dat[2] = partsize;
+ dat[4] = hidden;
+ dat[0] = dat[1] = dat[3] = 0;
+
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);