From: David Levine Date: Sun, 9 Feb 2014 03:38:18 +0000 (-0600) Subject: Changed "codeset" to "charset" for (and in) mhfixmsg. Also X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/e996186ed31572ee94c32abf6083f57d69777888?ds=inline Changed "codeset" to "charset" for (and in) mhfixmsg. Also cleaned up some comments in mhshowsbr.c. --- diff --git a/man/mhfixmsg.man b/man/mhfixmsg.man index f45447b4..ea342330 100644 --- a/man/mhfixmsg.man +++ b/man/mhfixmsg.man @@ -1,4 +1,4 @@ -.TH MHFIXMSG %manext1% "October 27, 2013" "%nmhversion%" +.TH MHFIXMSG %manext1% "February 8, 2014" "%nmhversion%" .\" .\" %nmhwarning% .\" @@ -16,9 +16,9 @@ mhfixmsg \- rewrite MIME messages with various transformations .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 ] @@ -69,11 +69,11 @@ linefeed character is removed from text parts encoded in ASCII, 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). @@ -214,7 +214,7 @@ content type and/or encoding as follows: .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 @@ -321,6 +321,7 @@ is checked. .fi .SH "SEE ALSO" .IR inc (1), +.IR iconv (3), .IR mh-profile (5), .IR mhbuild (1), .IR mhlist (1), @@ -335,7 +336,7 @@ is checked. .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 ' diff --git a/test/mhfixmsg/test-mhfixmsg b/test/mhfixmsg/test-mhfixmsg index aa8c9514..5b039ea1 100755 --- a/test/mhfixmsg/test-mhfixmsg +++ b/test/mhfixmsg/test-mhfixmsg @@ -47,7 +47,7 @@ Usage: mhfixmsg [+folder] [msgs] [switches] switches are: -decodetext 8bit|7bit -nodecodetext - -[no]textcodeset + -[no]textcharset -[no]reformat -[no]replacetextplain -[no]fixboundary @@ -674,13 +674,13 @@ else fi -# check -textcodeset +# check -textcharset # Also checks preservation of attributes after one (charset) that is # modified. cat >"$expected" <`mhpath new` <"$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" diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index 4c0a3ef5..df475646 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -16,8 +16,8 @@ #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) \ @@ -78,7 +78,7 @@ typedef struct fix_transformations { int reformat; int replacetextplain; int decodetext; - char *textcodeset; + char *textcharset; } fix_transformations; int mhfixmsgsbr (CT *, const fix_transformations *, char *); @@ -102,7 +102,7 @@ static int set_ct_type (CT, int type, int subtype, int encoding); 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 *, ...); @@ -125,7 +125,7 @@ main (int argc, char **argv) { 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; } @@ -169,13 +169,13 @@ main (int argc, char **argv) { 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; @@ -408,8 +408,8 @@ mhfixmsgsbr (CT *ctp, const fix_transformations *fx, char *outfile) { 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) { @@ -1151,11 +1151,11 @@ reformat_part (CT ct, char *file, char *type, char *subtype, int c_type) { 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; } @@ -1572,18 +1572,18 @@ content_encoding (CT ct) { 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; @@ -1645,7 +1645,7 @@ strip_crs (CT ct, int *message_mods) { 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", @@ -1707,22 +1707,22 @@ strip_crs (CT ct, int *message_mods) { } } - 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; @@ -1735,7 +1735,7 @@ convert_codesets (CT ct, char *dest_codeset, int *message_mods) { 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; } @@ -1746,7 +1746,7 @@ convert_codesets (CT ct, char *dest_codeset, int *message_mods) { 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; diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 6f7f1ee6..8c595d76 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -19,7 +19,7 @@ #include #ifdef HAVE_ICONV # include -#endif +#endif /* ! HAVE_ICONV */ extern int debugsw; @@ -267,13 +267,13 @@ show_content (CT ct, int serial, int alternate) 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); @@ -313,7 +313,7 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked) return NOTOK; if (ct->c_showproc && !strcmp (ct->c_showproc, "true")) return (alternate ? DONE : OK); - + xlist = 0; xpause = 0; xstdin = 0; @@ -492,7 +492,7 @@ show_content_aux2 (CT ct, int serial, int alternate, char *cracked, char *buffer pid_t child_id; int i; char *vec[4], exec[BUFSIZ + sizeof "exec "]; - + if (debugsw || cracked) { fflush (stdout); @@ -598,13 +598,13 @@ show_text (CT ct, int serial, int alternate) 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); @@ -634,13 +634,13 @@ show_multi (CT ct, int serial, int alternate) 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); @@ -701,7 +701,7 @@ show_multi_internal (CT ct, int serial, int alternate) /* * 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; @@ -884,7 +884,7 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp) /* insert filename(s) containing content */ { char *s = ""; - + for (part = m->mp_parts; part; part = part->mp_next) { p = part->mp_part; @@ -1003,13 +1003,13 @@ show_message_rfc822 (CT ct, int serial, int alternate) 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);