with a new -disposition switch.
* CE_QUOTED.
* maxunencoded - The maximum line length before the default encoding for
* text parts is quoted-printable.
+ * verbose - If 1, output verbose information during message composition
*
* Returns a CT structure describing the resulting MIME message. If the
* -auto flag is set and a MIME-Version header is encountered, the return
* value is NULL.
*/
CT build_mime (char *infile, int autobuild, int dist, int directives,
- int encoding, size_t maxunencoded);
+ int encoding, size_t maxunencoded, int verbose);
int add_header (CT, char *, char *);
int get_ctinfo (char *, CT, int);
const char *ce_str (int);
const struct str2init *get_ce_method (const char *);
+/*
+ * Given a list of messages, display information about them on standard
+ * output.
+ *
+ * Argumens are:
+ *
+ * cts - An array of CT elements of messages that need to be
+ * displayed. Array is terminated by a NULL.
+ * headsw - If 1, display a column header.
+ * sizesw - If 1, display the size of the part.
+ * verbosw - If 1, display verbose information
+ * debugsw - If 1, turn on debugging for the output.
+ * disposw - If 1, display MIME part disposition information.
+ *
+ */
+void list_all_messages(CT *cts, int headsw, int sizesw, int verbosw,
+ int debugsw, int disposw);
+
+/*
+ * List the content information of a single MIME part on stdout.
+ *
+ * Arguments are:
+ *
+ * ct - MIME Content structure to display.
+ * toplevel - If set, we're at the top level of a message
+ * realsize - If set, determine the real size of the content
+ * verbose - If set, output verbose information
+ * debug - If set, turn on debugging for the output
+ * dispo - If set, display MIME part disposition information.
+ *
+ * Returns OK on success, NOTOK otherwise.
+ */
+int list_content(CT ct, int toplevel, int realsize, int verbose, int debug,
+ int dispo);
+
+/*
+ * Display content-appropriate information on MIME parts, decending recursively
+ * into multipart content if appropriate. Uses list_content() for displaying
+ * generic information.
+ *
+ * Arguments and return value are the same as list_content().
+ */
+int list_switch(CT ct, int toplevel, int realsize, int verbose, int debug,
+ int dispo);
+
/*
* Given a linked list of parameters, build an output string for them. This
* string is designed to be concatenated on an already-built header.
.RB [ \-rfc934mode " | " \-norfc934mode ]
.RB [ \-contentid " | " \-nocontentid ]
.RB [ \-verbose " | " \-noverbose ]
+.RB [ \-disposition " | " \-nodisposition ]
.RB [ \-check " | " \-nocheck ]
.RB [ \-headerencoding
.IR encoding\-algorithm
is present, then the listing will show any \*(lqextra\*(rq information
that is present in the message, such as comments in the
\*(lqContent-Type\*(rq header.
+.PP
+If the
+.B \-disposition
+switch is present, then the listing will show any relevant information from
+the \*(lqContent-Disposition\*(rq header.
.SS "Simplified Attachment Interface"
For users who wish to simply attach files to text content,
.B mhbuild
.RB ` \-contentid '
.RB ` \-nocheck '
.RB ` \-noverbose '
+.RB ` \-nodisposition '
.RB ` \-autoheaderencoding '
.RB ` "\-maxunencoded\ 78"'
.fi
.RB [ \-check " | " \-nocheck ]
.RB [ \-changecur " | " \-nochangecur ]
.RB [ \-verbose " | " \-noverbose ]
+.RB [ \-disposition " | " \-nodisposition ]
.RB [ \-version ]
.RB [ \-help ]
.ad
any \*(lqextra\*(rq information that is present in the message,
such as comments in the \*(lqContent-Type\*(rq header.
.PP
+If the
+.B \-disposition
+switch is present, then the listing will show any relevant information from
+the \*(lqContent-Disposition\*(rq header.
+.PP
The option
.B \-file
.I file
.RB ` \-wcache\ ask '
.RB ` \-changecur '
.RB ` \-noverbose '
+.RB ` \-nodisposition '
.fi
.SH CONTEXT
If a folder is given, it will become the current folder. The last
X("norfc934mode", 0, NRFC934SW) \
X("verbose", 0, VERBSW) \
X("noverbose", 0, NVERBSW) \
+ X("disposition", 0, DISPOSW) \
+ X("nodisposition", 0, NDISPOSW) \
X("rcache policy", 0, RCACHESW) \
X("wcache policy", 0, WCACHESW) \
X("contentid", 0, CONTENTIDSW) \
extern char *cache_private;
int debugsw = 0;
-int verbosw = 0;
int listsw = 0;
int rfc934sw = 0;
int output_message (CT, char *);
int output_message_fp (CT, FILE *, char*);
-/* mhlistsbr.c */
-int list_all_messages (CT *, int, int, int, int);
-
int
main (int argc, char **argv)
{
int sizesw = 1, headsw = 1, directives = 1, autobuild = 0, dist = 0;
+ int verbosw = 0, dispo = 0;
size_t maxunencoded = MAXTEXTPERLN;
int *icachesw;
char *cp, buf[BUFSIZ];
case NVERBSW:
verbosw = 0;
continue;
+ case DISPOSW:
+ dispo = 1;
+ continue;
+ case NDISPOSW:
+ dispo = 0;
+ continue;
case DEBUGSW:
debugsw = 1;
continue;
/* build the content structures for MIME message */
ct = build_mime (infile, autobuild, dist, directives, header_encoding,
- maxunencoded);
+ maxunencoded, verbosw);
/*
* If ct == NULL, that means that -auto was set and a MIME version
/* build the content structures for MIME message */
ct = build_mime (compfile, autobuild, dist, directives, header_encoding,
- maxunencoded);
+ maxunencoded, verbosw);
/*
* If ct == NULL, that means -auto was set and we found a MIME version
* List the message info
*/
if (listsw)
- list_all_messages (cts, headsw, sizesw, verbosw, debugsw);
+ list_all_messages (cts, headsw, sizesw, verbosw, debugsw, dispo);
/* Rename composition draft */
snprintf (buffer, sizeof(buffer), "%s.orig", m_backup (compfile));
extern int debugsw;
-extern int verbosw;
extern int listsw;
extern int rfc934sw;
static char *fgetstr (char *, int, FILE *);
static int user_content (FILE *, char *, CT *);
static void set_id (CT, int);
-static int compose_content (CT);
+static int compose_content (CT, int);
static int scan_content (CT, size_t);
static int build_headers (CT, int);
static char *calculate_digest (CT, int);
CT
build_mime (char *infile, int autobuild, int dist, int directives,
- int header_encoding, size_t maxunencoded)
+ int header_encoding, size_t maxunencoded, int verbose)
{
int compnum, state;
char buf[BUFSIZ], name[NAMESZ];
* Fill out, or expand directives. Parse and execute
* commands specified by profile composition strings.
*/
- compose_content (ct);
+ compose_content (ct, verbose);
if ((cp = strchr(prefix, 'a')) == NULL)
adios (NULL, "internal error(4)");
*/
static int
-compose_content (CT ct)
+compose_content (CT ct, int verbose)
{
CE ce = &ct->c_cefile;
sprintf (pp, "%d", partnum);
p->c_partno = add (partnam, NULL);
- if (compose_content (p) == NOTOK)
+ if (compose_content (p, verbose) == NOTOK)
return NOTOK;
}
}
}
- if (verbosw)
+ if (verbose)
printf ("composing content %s/%s from command\n\t%s\n",
ci->ci_type, ci->ci_subtype, buffer);
X("norealsize", 0, NSIZESW) \
X("verbose", 0, VERBSW) \
X("noverbose", 0, NVERBSW) \
+ X("disposition", 0, DISPOSW) \
+ X("nodisposition", 0, NDISPOSW) \
X("file file", 0, FILESW) \
X("part number", 0, PARTSW) \
X("type content", 0, TYPESW) \
pid_t xpid = 0;
int debugsw = 0;
-int verbosw = 0;
#define quitser pipeser
int type_ok (CT, int);
void flush_errors (void);
-/* mhlistsbr.c */
-void list_all_messages (CT *, int, int, int, int);
-
/* mhfree.c */
extern CT *cts;
void freects_done (int) NORETURN;
int
main (int argc, char **argv)
{
- int sizesw = 1, headsw = 1, chgflag = 1;
+ int sizesw = 1, headsw = 1, chgflag = 1, verbosw = 0, dispo = 0;
int msgnum, *icachesw;
char *cp, *file = NULL, *folder = NULL;
char *maildir, buf[100], **argp;
case NVERBSW:
verbosw = 0;
continue;
+ case DISPOSW:
+ dispo = 1;
+ continue;
+ case NDISPOSW:
+ dispo = 0;
+ continue;
case DEBUGSW:
debugsw = 1;
continue;
/*
* List the message content
*/
- list_all_messages (cts, headsw, sizesw, verbosw, debugsw);
+ list_all_messages (cts, headsw, sizesw, verbosw, debugsw, dispo);
/* Now free all the structures for the content */
for (ctp = cts; *ctp; ctp++)
int type_ok (CT, int);
void flush_errors (void);
-/*
- * prototypes
- */
-void list_all_messages (CT *, int, int, int, int);
-int list_switch (CT, int, int, int, int);
-int list_content (CT, int, int, int, int);
-
/*
* static prototypes
*/
-static void list_single_message (CT, int, int, int);
+static void list_single_message (CT, int, int, int, int);
static int list_debug (CT);
-static int list_multi (CT, int, int, int, int);
-static int list_partial (CT, int, int, int, int);
-static int list_external (CT, int, int, int, int);
-static int list_application (CT, int, int, int, int);
+static int list_multi (CT, int, int, int, int, int);
+static int list_partial (CT, int, int, int, int, int);
+static int list_external (CT, int, int, int, int, int);
+static int list_application (CT, int, int, int, int, int);
static int list_encoding (CT);
*/
void
-list_all_messages (CT *cts, int headers, int realsize, int verbose, int debug)
+list_all_messages (CT *cts, int headers, int realsize, int verbose, int debug,
+ int dispo)
{
CT ct, *ctp;
for (ctp = cts; *ctp; ctp++) {
ct = *ctp;
- list_single_message (ct, realsize, verbose, debug);
+ list_single_message (ct, realsize, verbose, debug, dispo);
}
flush_errors ();
*/
static void
-list_single_message (CT ct, int realsize, int verbose, int debug)
+list_single_message (CT ct, int realsize, int verbose, int debug, int dispo)
{
if (type_ok (ct, 1)) {
umask (ct->c_umask);
- list_switch (ct, 1, realsize, verbose, debug);
+ list_switch (ct, 1, realsize, verbose, debug, dispo);
if (ct->c_fp) {
fclose (ct->c_fp);
ct->c_fp = NULL;
*/
int
-list_switch (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_switch (CT ct, int toplevel, int realsize, int verbose, int debug,
+ int dispo)
{
switch (ct->c_type) {
case CT_MULTIPART:
- return list_multi (ct, toplevel, realsize, verbose, debug);
+ return list_multi (ct, toplevel, realsize, verbose, debug, dispo);
case CT_MESSAGE:
switch (ct->c_subtype) {
case MESSAGE_PARTIAL:
- return list_partial (ct, toplevel, realsize, verbose, debug);
+ return list_partial (ct, toplevel, realsize, verbose,
+ debug, dispo);
case MESSAGE_EXTERNAL:
- return list_external (ct, toplevel, realsize, verbose, debug);
+ return list_external (ct, toplevel, realsize, verbose,
+ debug, dispo);
case MESSAGE_RFC822:
default:
- return list_content (ct, toplevel, realsize, verbose, debug);
+ return list_content (ct, toplevel, realsize, verbose,
+ debug, dispo);
}
case CT_TEXT:
case CT_AUDIO:
case CT_IMAGE:
case CT_VIDEO:
- return list_content (ct, toplevel, realsize, verbose, debug);
+ return list_content (ct, toplevel, realsize, verbose, debug, dispo);
case CT_APPLICATION:
- return list_application (ct, toplevel, realsize, verbose, debug);
+ return list_application (ct, toplevel, realsize, verbose, debug,
+ dispo);
default:
/* list_debug (ct); */
*/
int
-list_content (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_content (CT ct, int toplevel, int realsize, int verbose, int debug,
+ int dispo)
{
unsigned long size;
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
+ PM pm;
if (toplevel > 0)
printf (LSTFMT2a, atoi (r1bindex (empty (ct->c_file), '/')));
if (verbose) {
CI ci = &ct->c_ctinfo;
- PM pm;
for (pm = ci->ci_first_pm; pm; pm = pm->pm_next) {
printf ("\t %s=\"%s\"\n", pm->pm_name,
}
}
+ if (dispo && ct->c_dispo_type) {
+ printf (LSTFMT2d2, ct->c_dispo_type);
+ printf ("\n");
+
+ if (verbose) {
+ for (pm = ct->c_dispo_first; pm; pm = pm->pm_next) {
+ printf ("\t %s=\"%s\"\n", pm->pm_name,
+ get_param_value(pm, '?'));
+ }
+ }
+ }
+
if (debug)
list_debug (ct);
if (ct->c_descr)
fprintf (stderr, " %s:%s", DESCR_FIELD, ct->c_descr);
+ /* print Content-Disposition */
+ if (ct->c_dispo)
+ fprintf (stderr, " %s:%s", DISPO_FIELD, ct->c_dispo);
+
+ fprintf(stderr, " disposition \"%s\"\n", empty (ct->c_dispo_type));
+ fprintf(stderr, " disposition parameters\n");
+ for (pm = ct->c_dispo_first; pm; pm = pm->pm_next)
+ fprintf (stderr, " %s=\"%s\"\n", pm->pm_name,
+ get_param_value(pm, '?'));
+
fprintf (stderr, " read fp 0x%x file \"%s\" begin %ld end %ld\n",
(unsigned int)(unsigned long) ct->c_fp, empty (ct->c_file),
ct->c_begin, ct->c_end);
*/
static int
-list_multi (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_multi (CT ct, int toplevel, int realsize, int verbose, int debug,
+ int dispo)
{
struct multipart *m = (struct multipart *) ct->c_ctparams;
struct part *part;
/* list the content for toplevel of this multipart */
- list_content (ct, toplevel, realsize, verbose, debug);
+ list_content (ct, toplevel, realsize, verbose, debug, dispo);
/* now list for all the subparts */
for (part = m->mp_parts; part; part = part->mp_next) {
CT p = part->mp_part;
if (part_ok (p, 1) && type_ok (p, 1))
- list_switch (p, 0, realsize, verbose, debug);
+ list_switch (p, 0, realsize, verbose, debug, dispo);
}
return OK;
*/
static int
-list_partial (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_partial (CT ct, int toplevel, int realsize, int verbose, int debug,
+ int dispo)
{
struct partial *p = (struct partial *) ct->c_ctparams;
- list_content (ct, toplevel, realsize, verbose, debug);
+ list_content (ct, toplevel, realsize, verbose, debug, dispo);
if (verbose) {
printf ("\t [message %s, part %d", p->pm_partid, p->pm_partno);
if (p->pm_maxno)
*/
static int
-list_external (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_external (CT ct, int toplevel, int realsize, int verbose, int debug,
+ int dispo)
{
struct exbody *e = (struct exbody *) ct->c_ctparams;
* First list the information for the
* message/external content itself.
*/
- list_content (ct, toplevel, realsize, verbose, debug);
+ list_content (ct, toplevel, realsize, verbose, debug, dispo);
if (verbose) {
if (e->eb_name)
printf ("\t server=\"%s\"\n", e->eb_server);
if (e->eb_subject)
printf ("\t subject=\"%s\"\n", e->eb_subject);
+ if (e->eb_url)
+ printf ("\t url=\"%s\"\n", e->eb_url);
/* This must be defined */
printf ("\t access-type=\"%s\"\n", e->eb_access);
if (e->eb_flags == NOTOK)
printf ("\t [service unavailable]\n");
+
}
/*
* Now list the information for the external content
* to which this content points.
*/
- list_content (e->eb_content, 0, realsize, verbose, debug);
+ list_content (e->eb_content, 0, realsize, verbose, debug, dispo);
return OK;
}
*/
static int
-list_application (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_application (CT ct, int toplevel, int realsize, int verbose, int debug,
+ int dispo)
{
- list_content (ct, toplevel, realsize, verbose, debug);
+ list_content (ct, toplevel, realsize, verbose, debug, dispo);
return OK;
}
/* mhshowsbr.c */
void show_all_messages (CT *);
-/* mhlistsbr.c */
-void list_all_messages (CT *, int, int, int, int);
-
/* mhstoresbr.c */
void store_all_messages (CT *);
* List the message content
*/
if (listsw)
- list_all_messages (cts, headsw, sizesw, verbosw, debugsw);
+ list_all_messages (cts, headsw, sizesw, verbosw, debugsw, 0);
/*
* Store the message content
void content_error (char *, CT, char *, ...);
void flush_errors (void);
-/* mhlistsbr.c */
-int list_switch (CT, int, int, int, int);
-int list_content (CT, int, int, int, int);
-
/*
* prototypes
*/
char prompt[BUFSIZ];
if (ct->c_type == CT_MULTIPART)
- list_content (ct, -1, 1, 0, 0);
+ list_content (ct, -1, 1, 0, 0, 0);
else
- list_switch (ct, -1, 1, 0, 0);
+ list_switch (ct, -1, 1, 0, 0, 0);
if (xpause && isatty (fileno (stdout))) {
int intr;