*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
X("norfc934mode", 0, NRFC934SW) \
X("verbose", 0, VERBSW) \
X("noverbose", 0, NVERBSW) \
X("norfc934mode", 0, NRFC934SW) \
X("verbose", 0, VERBSW) \
X("noverbose", 0, NVERBSW) \
X("rcache policy", 0, RCACHESW) \
X("wcache policy", 0, WCACHESW) \
X("contentid", 0, CONTENTIDSW) \
X("nocontentid", 0, NCONTENTIDSW) \
X("headerencoding encoding-algorithm", 0, HEADERENCSW) \
X("autoheaderencoding", 0, AUTOHEADERENCSW) \
X("rcache policy", 0, RCACHESW) \
X("wcache policy", 0, WCACHESW) \
X("contentid", 0, CONTENTIDSW) \
X("nocontentid", 0, NCONTENTIDSW) \
X("headerencoding encoding-algorithm", 0, HEADERENCSW) \
X("autoheaderencoding", 0, AUTOHEADERENCSW) \
X("version", 0, VERSIONSW) \
X("help", 0, HELPSW) \
X("debug", -5, DEBUGSW) \
X("version", 0, VERSIONSW) \
X("help", 0, HELPSW) \
X("debug", -5, DEBUGSW) \
#define X(sw, minchars, id) id,
DEFINE_SWITCH_ENUM(MHBUILD);
#define X(sw, minchars, id) id,
DEFINE_SWITCH_ENUM(MHBUILD);
#define MIMEENCODING_SWITCHES \
X("base64", 0, BASE64SW) \
X("quoted-printable", 0, QUOTEDPRINTSW) \
#define MIMEENCODING_SWITCHES \
X("base64", 0, BASE64SW) \
X("quoted-printable", 0, QUOTEDPRINTSW) \
#define X(sw, minchars, id) id,
DEFINE_SWITCH_ENUM(MIMEENCODING);
#define X(sw, minchars, id) id,
DEFINE_SWITCH_ENUM(MIMEENCODING);
-/* mhbuildsbr.c */
-int output_message (CT, char *);
-int output_message_fp (CT, FILE *, char*);
-
-/* mhlistsbr.c */
-int list_all_messages (CT *, int, int, int, int);
-
- int sizesw = 1, headsw = 1, directives = 1, autobuild = 0;
+ int sizesw = 1, headsw = 1, directives = 1, autobuild = 0, dist = 0;
+ int verbosw = 0, dispo = 0;
+ size_t maxunencoded = MAXTEXTPERLN;
if (cp[0] == '-' && cp[1] == '\0') {
if (compfile)
adios (NULL, "cannot specify both standard input and a file");
if (cp[0] == '-' && cp[1] == '\0') {
if (compfile)
adios (NULL, "cannot specify both standard input and a file");
listsw = 0; /* turn off -list if using standard in/out */
verbosw = 0; /* turn off -verbose listings */
break;
listsw = 0; /* turn off -list if using standard in/out */
verbosw = 0; /* turn off -verbose listings */
break;
do_cache: ;
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
do_cache: ;
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
+ case MAXUNENCSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ if ((maxunencoded = atoi(cp)) < 1)
+ adios (NULL, "Invalid argument for %s: %s", argp[-2], cp);
+ if (maxunencoded > 998)
+ adios (NULL, "limit of -maxunencoded is 998");
+ continue;
+
*/
if ((cp = getenv ("MHBUILD"))) {
if ((fp = fopen (cp, "r"))) {
*/
if ((cp = getenv ("MHBUILD"))) {
if ((fp = fopen (cp, "r"))) {
- readconfig ((struct node **) 0, fp, cp, 0);
+ readconfig(NULL, fp, cp, 0);
* Read the standard profile setup
*/
if ((fp = fopen (cp = etcpath ("mhn.defaults"), "r"))) {
* Read the standard profile setup
*/
if ((fp = fopen (cp = etcpath ("mhn.defaults"), "r"))) {
- readconfig ((struct node **) 0, fp, cp, 0);
+ readconfig(NULL, fp, cp, 0);
+ /* copy standard input to temporary file */
+ while ((n = fread(buffer, 1, sizeof(buffer), stdin)) > 0) {
+ if (fwrite(buffer, 1, n, fp) != n) {
+ adios (NULL, "error copying to temporary file");
+ }
+ }
+ fclose (fp);
+
- ct = build_mime (infile, autobuild, directives, header_encoding);
+ ct = build_mime (infile, autobuild, dist, directives, header_encoding,
+ maxunencoded, verbosw);
if (! (fp = fopen(infile, "r"))) {
adios(NULL, "Unable to open %s for reading", infile);
}
if (! (fp = fopen(infile, "r"))) {
adios(NULL, "Unable to open %s for reading", infile);
}
- while (fgets(buffer, BUFSIZ, fp))
- fputs(buffer, stdout);
+ while ((n = fread(buffer, 1, sizeof(buffer), fp)) > 0) {
+ if (fwrite(buffer, 1, n, stdout) != n) {
+ adios(NULL, "error copying %s to stdout", infile);
+ }
+ }
- ct = build_mime (compfile, autobuild, directives, header_encoding);
+ ct = build_mime (compfile, autobuild, dist, directives, header_encoding,
+ maxunencoded, verbosw);
- 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));
/* Rename composition draft */
snprintf (buffer, sizeof(buffer), "%s.orig", m_backup (compfile));