cleaned up some comments in mhshowsbr.c.
-.TH MHFIXMSG %manext1% "October 27, 2013" "%nmhversion%"
+.TH MHFIXMSG %manext1% "February 8, 2014" "%nmhversion%"
.\"
.\" %nmhwarning%
.\"
.RB [ \-decodetext
8bit/7bit |
.BR \-nodecodetext ]
-.RB [ \-textcodeset
-.I codeset
-.RB "| " \-notextcodeset ]
+.RB [ \-textcharset
+.I charset
+.RB "| " \-notextcharset ]
.RB [ \-reformat " | " \-noreformat ]
.RB [ \-replacetextplain " | " \-noreplacetextplain ]
.RB [ \-fixboundary " | " \-nofixboundary ]
ISO-8859-x, UTF-8, or Windows-12xx.
.PP
The
-.B \-textcodeset
+.B \-textcharset
switch specifies that all text/plain parts of the message(s)
should be converted to
-.IR codeset .
-Codeset conversions require that
+.IR charset .
+Charset conversions require that
.B nmh
be built with
.IR iconv (3).
.nf
.ta \w'\-fixboundary 'u
\-decodetext base64 and quoted-printable encoded text parts
-\-textcodeset text/plain parts
+\-textcharset text/plain parts
\-reformat text parts that are not text/plain
\-fixboundary outermost multipart part
\-fixcte multipart part
.fi
.SH "SEE ALSO"
.IR inc (1),
+.IR iconv (3),
.IR mh-profile (5),
.IR mhbuild (1),
.IR mhlist (1),
.RB ` +folder "' defaults to the current folder"
.RB ` msgs "' defaults to cur"
.RB ` "\-decodetext 8bit"'
-.RB ` \-notextcodeset '
+.RB ` \-notextcharset '
.RB ` \-reformat '
.RB ` \-noreplacetextplain '
.RB ` \-fixboundary '
switches are:
-decodetext 8bit|7bit
-nodecodetext
- -[no]textcodeset
+ -[no]textcharset
-[no]reformat
-[no]replacetextplain
-[no]fixboundary
fi
-# check -textcodeset
+# check -textcharset
# Also checks preservation of attributes after one (charset) that is
# modified.
cat >"$expected" <<EOF
To: recipient@example.com
From: sender@example.com
-Subject: mhfixmsg textcodeset test
+Subject: mhfixmsg textcharset test
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
cat >`mhpath new` <<EOF
To: recipient@example.com
From: sender@example.com
-Subject: mhfixmsg textcodeset test
+Subject: mhfixmsg textcharset test
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
EOF
set +e
-run_prog mhfixmsg last -textcodeset utf-8 -outfile "$actual" 2>"$actual.err"
+run_prog mhfixmsg last -textcharset utf-8 -outfile "$actual" 2>"$actual.err"
if grep "mhfixmsg: Can't convert .* to .* without iconv" "$actual.err" \
>/dev/null; then
- echo "$0: skipping -textcodeset check because nmh was built without iconv"
+ echo "$0: skipping -textcharset check because nmh was built without iconv"
rm -f "$expected" "$actual" "$actual.err"
else
check "$expected" "$actual"
#define MHFIXMSG_SWITCHES \
X("decodetext 8bit|7bit", 0, DECODETEXTSW) \
X("nodecodetext", 0, NDECODETEXTSW) \
- X("textcodeset", 0, TEXTCODESETSW) \
- X("notextcodeset", 0, NTEXTCODESETSW) \
+ X("textcharset", 0, TEXTCHARSETSW) \
+ X("notextcharset", 0, NTEXTCHARSETSW) \
X("reformat", 0, REFORMATSW) \
X("noreformat", 0, NREFORMATSW) \
X("replacetextplain", 0, REPLACETEXTPLAINSW) \
int reformat;
int replacetextplain;
int decodetext;
- char *textcodeset;
+ char *textcharset;
} fix_transformations;
int mhfixmsgsbr (CT *, const fix_transformations *, char *);
static int decode_text_parts (CT, int, int *);
static int content_encoding (CT);
static int strip_crs (CT, int *);
-static int convert_codesets (CT, char *, int *);
+static int convert_charsets (CT, char *, int *);
static int write_content (CT, char *, char *, int, int);
static int remove_file (char *);
static void report (char *, char *, char *, ...);
fx.reformat = fx.fixcte = fx.fixboundary = 1;
fx.replacetextplain = 0;
fx.decodetext = CE_8BIT;
- fx.textcodeset = NULL;
+ fx.textcharset = NULL;
if (nmh_init(argv[0], 1)) { return 1; }
case NDECODETEXTSW:
fx.decodetext = 0;
continue;
- case TEXTCODESETSW:
+ case TEXTCHARSETSW:
if (! (cp = *argp++) || (*cp == '-' && cp[1]))
adios (NULL, "missing argument to %s", argp[-2]);
- fx.textcodeset = cp;
+ fx.textcharset = cp;
continue;
- case NTEXTCODESETSW:
- fx.textcodeset = 0;
+ case NTEXTCHARSETSW:
+ fx.textcharset = 0;
continue;
case FIXBOUNDARYSW:
fx.fixboundary = 1;
if (status == OK && fx->decodetext) {
status = decode_text_parts (*ctp, fx->decodetext, &message_mods);
}
- if (status == OK && fx->textcodeset != NULL) {
- status = convert_codesets (*ctp, fx->textcodeset, &message_mods);
+ if (status == OK && fx->textcharset != NULL) {
+ status = convert_charsets (*ctp, fx->textcharset, &message_mods);
}
if (! (*ctp)->c_umask) {
static int
charset_encoding (CT ct) {
/* norm_charmap() is case sensitive. */
- char *codeset = upcase (content_charset (ct));
+ char *charset = upcase (content_charset (ct));
int encoding =
- strcmp (norm_charmap (codeset), "US-ASCII") ? CE_8BIT : CE_7BIT;
+ strcmp (norm_charmap (charset), "US-ASCII") ? CE_8BIT : CE_7BIT;
- free (codeset);
+ free (charset);
return encoding;
}
static int
strip_crs (CT ct, int *message_mods) {
/* norm_charmap() is case sensitive. */
- char *codeset = upcase (content_charset (ct));
+ char *charset = upcase (content_charset (ct));
int status = OK;
/* Only strip carriage returns if content is ASCII or another
- codeset that has the same readily recognizable CR followed by a
+ charset that has the same readily recognizable CR followed by a
LF. We can include UTF-8 here because if the high-order bit of
a UTF-8 byte is 0, then it must be a single-byte ASCII
character. */
- if (! strcmp (norm_charmap (codeset), "US-ASCII") ||
- ! strncmp (norm_charmap (codeset), "ISO-8859-", 9) ||
- ! strncmp (norm_charmap (codeset), "UTF-8", 5) ||
- ! strncmp (norm_charmap (codeset), "WINDOWS-12", 10)) {
+ if (! strcmp (norm_charmap (charset), "US-ASCII") ||
+ ! strncmp (norm_charmap (charset), "ISO-8859-", 9) ||
+ ! strncmp (norm_charmap (charset), "UTF-8", 5) ||
+ ! strncmp (norm_charmap (charset), "WINDOWS-12", 10)) {
char **file = NULL;
FILE **fp = NULL;
size_t begin;
if (has_crs) {
int fd;
char *stripped_content_file;
- char *tempfile = m_mktemp2 (NULL, invo_name, &fd, NULL);
+ char *tempfile = m_mktemp2 (NULL, invo_name, &fd, NULL);
if (tempfile == NULL) {
adios (NULL, "unable to create temporary file in %s",
}
}
- free (codeset);
+ free (charset);
return status;
}
static int
-convert_codesets (CT ct, char *dest_codeset, int *message_mods) {
+convert_charsets (CT ct, char *dest_charset, int *message_mods) {
int status = OK;
switch (ct->c_type) {
case CT_TEXT:
if (ct->c_subtype == TEXT_PLAIN) {
- status = convert_charset (ct, dest_codeset, message_mods);
+ status = convert_charset (ct, dest_charset, message_mods);
if (verbosw && status == OK) {
report (ct->c_partno, ct->c_file, "convert %s to %s",
- content_charset(ct), dest_codeset);
+ content_charset(ct), dest_charset);
}
}
break;
For now, it gets passed along as-is by InitMultiPart(). */
for (part = m->mp_parts; status == OK && part; part = part->mp_next) {
status =
- convert_codesets (part->mp_part, dest_codeset, message_mods);
+ convert_charsets (part->mp_part, dest_charset, message_mods);
}
break;
}
e = (struct exbody *) ct->c_ctparams;
status =
- convert_codesets (e->eb_content, dest_codeset, message_mods);
+ convert_charsets (e->eb_content, dest_charset, message_mods);
}
break;
#include <h/utils.h>
#ifdef HAVE_ICONV
# include <iconv.h>
-#endif
+#endif /* ! HAVE_ICONV */
extern int debugsw;
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
- /* Check for mhn-show-type/subtype */
+ /* Check for invo_name-show-type/subtype */
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, serial, alternate, cp, NULL);
- /* Check for mhn-show-type */
+ /* 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, serial, alternate, cp, NULL);
return NOTOK;
if (ct->c_showproc && !strcmp (ct->c_showproc, "true"))
return (alternate ? DONE : OK);
-
+
xlist = 0;
xpause = 0;
xstdin = 0;
pid_t child_id;
int i;
char *vec[4], exec[BUFSIZ + sizeof "exec "];
-
+
if (debugsw || cracked) {
fflush (stdout);
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
- /* Check for mhn-show-type/subtype */
+ /* Check for invo_name-show-type/subtype */
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, serial, alternate, cp, NULL);
- /* Check for mhn-show-type */
+ /* 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, serial, alternate, cp, NULL);
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
- /* Check for mhn-show-type/subtype */
+ /* Check for invo_name-show-type/subtype */
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, serial, alternate, cp);
- /* Check for mhn-show-type */
+ /* 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, serial, alternate, cp);
/*
* alternate -> we are a part inside an multipart/alternative
- * alternating -> we are a multipart/alternative
+ * alternating -> we are a multipart/alternative
*/
result = alternate ? NOTOK : OK;
/* insert filename(s) containing content */
{
char *s = "";
-
+
for (part = m->mp_parts; part; part = part->mp_next) {
p = part->mp_part;
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
- /* Check for mhn-show-type/subtype */
+ /* Check for invo_name-show-type/subtype */
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, serial, alternate, cp, NULL);
- /* Check for mhn-show-type */
+ /* 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, serial, alternate, cp, NULL);