]>
diplodocus.org Git - nmh/blob - uip/mhshowsbr.c
545f78c964d4a0a9ed70f4fa852b2b78feb449f3
3 * mhshowsbr.c -- routines to display the contents of MIME messages
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
12 #include <h/signals.h>
18 #include <h/mhparse.h>
22 #endif /* ! HAVE_ICONV */
31 /* flags for moreproc/header display */
35 static sigjmp_buf intrenv
;
39 int part_ok (CT
, int);
40 int type_ok (CT
, int);
41 void content_error (char *, CT
, char *, ...);
42 void flush_errors (void);
47 void show_all_messages (CT
*);
48 int show_content_aux (CT
, int, char *, char *);
53 static void show_single_message (CT
, char *);
54 static void DisplayMsgHeader (CT
, char *);
55 static int show_switch (CT
, int);
56 static int show_content (CT
, int);
57 static int show_content_aux2 (CT
, int, char *, char *, int, int, int, int);
58 static int show_text (CT
, int);
59 static int show_multi (CT
, int);
60 static int show_multi_internal (CT
, int);
61 static int show_multi_aux (CT
, int, char *);
62 static int show_message_rfc822 (CT
, int);
63 static int show_partial (CT
, int);
64 static int show_external (CT
, int);
65 static int parse_display_string (CT
, char *, int *, int *, int *, char *,
66 char *, size_t, int multipart
);
67 static int convert_content_charset (CT
, char **);
68 static void intrser (int);
72 * Top level entry point to show/display a group of messages
76 show_all_messages (CT
*cts
)
81 * If form is not specified, then get default form
82 * for showing headers of MIME messages.
85 formsw
= getcpy (etcpath ("mhl.headers"));
88 * If form is "mhl.null", suppress display of header.
90 if (!strcmp (formsw
, "mhl.null"))
93 for (ctp
= cts
; *ctp
; ctp
++) {
96 /* if top-level type is ok, then display message */
98 show_single_message (ct
, formsw
);
104 * Entry point to show/display a single message
108 show_single_message (CT ct
, char *form
)
114 /* Allow user executable bit so that temporary directories created by
115 * the viewer (e.g., lynx) are going to be accessible */
116 umask (ct
->c_umask
& ~(0100));
119 * If you have a format file, then display
120 * the message headers.
123 DisplayMsgHeader(ct
, form
);
125 /* Show the body of the message */
132 if (ct
->c_ceclosefnx
)
133 (*ct
->c_ceclosefnx
) (ct
);
135 /* block a few signals */
137 sigaddset (&set
, SIGHUP
);
138 sigaddset (&set
, SIGINT
);
139 sigaddset (&set
, SIGQUIT
);
140 sigaddset (&set
, SIGTERM
);
141 sigprocmask (SIG_BLOCK
, &set
, &oset
);
143 while (wait (&status
) != NOTOK
) {
148 /* reset the signal mask */
149 sigprocmask (SIG_SETMASK
, &oset
, &set
);
156 * Use the mhlproc to show the header fields
160 DisplayMsgHeader (CT ct
, char *form
)
167 vec
= argsplit(mhlproc
, &file
, &vecp
);
168 vec
[vecp
++] = getcpy("-form");
169 vec
[vecp
++] = getcpy(form
);
170 vec
[vecp
++] = getcpy("-nobody");
171 vec
[vecp
++] = getcpy(ct
->c_file
);
174 * If we've specified -(no)moreproc,
175 * then just pass that along.
178 vec
[vecp
++] = getcpy("-nomoreproc");
180 vec
[vecp
++] = getcpy("-moreproc");
181 vec
[vecp
++] = getcpy(progsw
);
187 for (i
= 0; (child_id
= fork()) == NOTOK
&& i
< 5; i
++)
192 adios ("fork", "unable to");
197 fprintf (stderr
, "unable to exec ");
203 pidcheck(pidwait(child_id
, NOTOK
));
207 arglist_free(file
, vec
);
212 * Switching routine. Call the correct routine
213 * based on content type.
217 show_switch (CT ct
, int alternate
)
219 switch (ct
->c_type
) {
221 return show_multi (ct
, alternate
);
224 switch (ct
->c_subtype
) {
225 case MESSAGE_PARTIAL
:
226 return show_partial (ct
, alternate
);
228 case MESSAGE_EXTERNAL
:
229 return show_external (ct
, alternate
);
233 return show_message_rfc822 (ct
, alternate
);
237 return show_text (ct
, alternate
);
243 return show_content (ct
, alternate
);
246 adios (NULL
, "unknown content type %d", ct
->c_type
);
249 return 0; /* NOT REACHED */
254 * Generic method for displaying content
258 show_content (CT ct
, int alternate
)
260 char *cp
, buffer
[BUFSIZ
];
261 CI ci
= &ct
->c_ctinfo
;
263 /* Check for invo_name-show-type/subtype */
264 snprintf (buffer
, sizeof(buffer
), "%s-show-%s/%s",
265 invo_name
, ci
->ci_type
, ci
->ci_subtype
);
266 if ((cp
= context_find (buffer
)) && *cp
!= '\0')
267 return show_content_aux (ct
, alternate
, cp
, NULL
);
269 /* Check for invo_name-show-type */
270 snprintf (buffer
, sizeof(buffer
), "%s-show-%s", invo_name
, ci
->ci_type
);
271 if ((cp
= context_find (buffer
)) && *cp
!= '\0')
272 return show_content_aux (ct
, alternate
, cp
, NULL
);
274 if ((cp
= ct
->c_showproc
))
275 return show_content_aux (ct
, alternate
, cp
, NULL
);
277 /* complain if we are not a part of a multipart/alternative */
279 content_error (NULL
, ct
, "don't know how to display content");
286 * Parse the display string for displaying generic content
290 show_content_aux (CT ct
, int alternate
, char *cp
, char *cracked
)
293 int xstdin
= 0, xlist
= 0, xpause
= 0;
294 char *file
, buffer
[BUFSIZ
];
296 if (!ct
->c_ceopenfnx
) {
298 content_error (NULL
, ct
, "don't know how to decode content");
304 if ((fd
= (*ct
->c_ceopenfnx
) (ct
, &file
)) == NOTOK
)
306 if (ct
->c_showproc
&& !strcmp (ct
->c_showproc
, "true"))
307 return (alternate
? DONE
: OK
);
309 if (! strcmp(invo_name
, "mhshow") &&
310 ct
->c_type
== CT_TEXT
&& ct
->c_subtype
== TEXT_PLAIN
) {
311 /* This has to be done after calling c_ceopenfnx, so
312 unfortunately the type checks are necessary without
313 some code rearrangement. And to make this really ugly,
314 only do it in mhshow, not mhfixmsg, mhn, or mhstore. */
315 if (convert_content_charset (ct
, &file
) != OK
) {
316 admonish (NULL
, "unable to convert character set%s to %s",
317 ct
->c_partno
? "of part " : "",
318 ct
->c_partno
? ct
->c_partno
: "",
319 content_charset (ct
));
324 strncpy (buffer
, cp
, sizeof(buffer
));
328 if (parse_display_string (ct
, cp
, &xstdin
, &xlist
, &xpause
, file
,
329 buffer
, sizeof(buffer
) - 1, 0)) {
330 admonish (NULL
, "Buffer overflow constructing show command!\n");
335 return show_content_aux2 (ct
, alternate
, cracked
, buffer
,
336 fd
, xlist
, xpause
, xstdin
);
341 * Routine to actually display the content
345 show_content_aux2 (CT ct
, int alternate
, char *cracked
, char *buffer
,
346 int fd
, int xlist
, int xpause
, int xstdin
)
352 if (debugsw
|| cracked
) {
355 fprintf (stderr
, "%s msg %s", cracked
? "storing" : "show",
358 fprintf (stderr
, " part %s", ct
->c_partno
);
360 fprintf (stderr
, " using command (cd %s; %s)\n", cracked
, buffer
);
362 fprintf (stderr
, " using command %s\n", buffer
);
368 if (ct
->c_type
== CT_MULTIPART
)
369 list_content (ct
, -1, 1, 0, 0, 0);
371 list_switch (ct
, -1, 1, 0, 0, 0);
373 if (xpause
&& isatty (fileno (stdout
))) {
375 SIGNAL_HANDLER istat
;
377 if (SOprintf ("Press <return> to show content..."))
378 printf ("Press <return> to show content...");
380 istat
= SIGNAL (SIGINT
, intrser
);
381 if ((intr
= sigsetjmp (intrenv
, 1)) == OK
) {
384 read (fileno (stdout
), prompt
, sizeof(prompt
));
386 SIGNAL (SIGINT
, istat
);
387 if (intr
!= OK
|| prompt
[0] == 'n') {
388 (*ct
->c_ceclosefnx
) (ct
);
389 return (alternate
? DONE
: NOTOK
);
391 if (prompt
[0] == 'q') done(OK
);
395 vec
= argsplit(buffer
, &file
, &vecp
);
400 for (i
= 0; (child_id
= fork()) == NOTOK
&& i
< 5; i
++)
404 advise ("fork", "unable to");
405 (*ct
->c_ceclosefnx
) (ct
);
415 fprintf (stderr
, "unable to exec ");
421 arglist_free(file
, vec
);
423 pidcheck (pidXwait (child_id
, NULL
));
426 (*ct
->c_ceclosefnx
) (ct
);
427 return (alternate
? DONE
: OK
);
433 * show content of type "text"
437 show_text (CT ct
, int alternate
)
439 char *cp
, buffer
[BUFSIZ
];
440 CI ci
= &ct
->c_ctinfo
;
442 /* Check for invo_name-show-type/subtype */
443 snprintf (buffer
, sizeof(buffer
), "%s-show-%s/%s",
444 invo_name
, ci
->ci_type
, ci
->ci_subtype
);
445 if ((cp
= context_find (buffer
)) && *cp
!= '\0')
446 return show_content_aux (ct
, alternate
, cp
, NULL
);
448 /* Check for invo_name-show-type */
449 snprintf (buffer
, sizeof(buffer
), "%s-show-%s", invo_name
, ci
->ci_type
);
450 if ((cp
= context_find (buffer
)) && *cp
!= '\0')
451 return show_content_aux (ct
, alternate
, cp
, NULL
);
454 * Use default method if content is text/plain, or if
455 * if it is not a text part of a multipart/alternative
457 if (!alternate
|| ct
->c_subtype
== TEXT_PLAIN
) {
458 snprintf (buffer
, sizeof(buffer
), "%%p%s %%F", progsw
? progsw
:
459 moreproc
&& *moreproc
? moreproc
: DEFAULT_PAGER
);
460 cp
= (ct
->c_showproc
= add (buffer
, NULL
));
461 return show_content_aux (ct
, alternate
, cp
, NULL
);
469 * show message body of type "multipart"
473 show_multi (CT ct
, int alternate
)
475 char *cp
, buffer
[BUFSIZ
];
476 CI ci
= &ct
->c_ctinfo
;
478 /* Check for invo_name-show-type/subtype */
479 snprintf (buffer
, sizeof(buffer
), "%s-show-%s/%s",
480 invo_name
, ci
->ci_type
, ci
->ci_subtype
);
481 if ((cp
= context_find (buffer
)) && *cp
!= '\0')
482 return show_multi_aux (ct
, alternate
, cp
);
484 /* Check for invo_name-show-type */
485 snprintf (buffer
, sizeof(buffer
), "%s-show-%s", invo_name
, ci
->ci_type
);
486 if ((cp
= context_find (buffer
)) && *cp
!= '\0')
487 return show_multi_aux (ct
, alternate
, cp
);
489 if ((cp
= ct
->c_showproc
))
490 return show_multi_aux (ct
, alternate
, cp
);
493 * Use default method to display this multipart content. Even
494 * unknown types are displayable, since they're treated as mixed
497 return show_multi_internal (ct
, alternate
);
502 * show message body of subtypes of multipart that
503 * we understand directly (mixed, alternate, etc...)
507 show_multi_internal (CT ct
, int alternate
)
509 int alternating
, nowalternate
, result
;
510 struct multipart
*m
= (struct multipart
*) ct
->c_ctparams
;
515 nowalternate
= alternate
;
517 if (ct
->c_subtype
== MULTI_ALTERNATE
) {
523 * alternate -> we are a part inside an multipart/alternative
524 * alternating -> we are a multipart/alternative
527 result
= alternate
? NOTOK
: OK
;
529 for (part
= m
->mp_parts
; part
; part
= part
->mp_next
) {
532 if (part_ok (p
, 1) && type_ok (p
, 1)) {
535 inneresult
= show_switch (p
, nowalternate
);
536 switch (inneresult
) {
538 if (alternate
&& !alternating
) {
551 alternate
= nowalternate
= 0;
561 if (alternating
&& !part
) {
563 content_error (NULL
, ct
, "don't know how to display any of the contents");
574 * Parse display string for multipart content
575 * and use external program to display it.
579 show_multi_aux (CT ct
, int alternate
, char *cp
)
581 /* xstdin is only used in the call to parse_display_string():
582 its value is ignored in the function. */
583 int xstdin
= 0, xlist
= 0, xpause
= 0;
584 char *file
, buffer
[BUFSIZ
];
585 struct multipart
*m
= (struct multipart
*) ct
->c_ctparams
;
589 for (part
= m
->mp_parts
; part
; part
= part
->mp_next
) {
592 if (!p
->c_ceopenfnx
) {
594 content_error (NULL
, p
, "don't know how to decode content");
598 if (p
->c_storage
== NULL
) {
600 if ((*p
->c_ceopenfnx
) (p
, &file
) == NOTOK
)
603 p
->c_storage
= add (file
, NULL
);
605 if (p
->c_showproc
&& !strcmp (p
->c_showproc
, "true"))
606 return (alternate
? DONE
: OK
);
607 (*p
->c_ceclosefnx
) (p
);
611 if (parse_display_string (ct
, cp
, &xstdin
, &xlist
, &xpause
, file
,
612 buffer
, sizeof(buffer
) - 1, 1)) {
613 admonish (NULL
, "Buffer overflow constructing show command!\n");
617 return show_content_aux2 (ct
, alternate
, NULL
, buffer
,
618 NOTOK
, xlist
, xpause
, 0);
623 * show content of type "message/rfc822"
627 show_message_rfc822 (CT ct
, int alternate
)
629 char *cp
, buffer
[BUFSIZ
];
630 CI ci
= &ct
->c_ctinfo
;
632 /* Check for invo_name-show-type/subtype */
633 snprintf (buffer
, sizeof(buffer
), "%s-show-%s/%s",
634 invo_name
, ci
->ci_type
, ci
->ci_subtype
);
635 if ((cp
= context_find (buffer
)) && *cp
!= '\0')
636 return show_content_aux (ct
, alternate
, cp
, NULL
);
638 /* Check for invo_name-show-type */
639 snprintf (buffer
, sizeof(buffer
), "%s-show-%s", invo_name
, ci
->ci_type
);
640 if ((cp
= context_find (buffer
)) && *cp
!= '\0')
641 return show_content_aux (ct
, alternate
, cp
, NULL
);
643 if ((cp
= ct
->c_showproc
))
644 return show_content_aux (ct
, alternate
, cp
, NULL
);
646 /* default method for message/rfc822 */
647 if (ct
->c_subtype
== MESSAGE_RFC822
) {
648 cp
= (ct
->c_showproc
= add ("%pecho -file %F", NULL
));
649 return show_content_aux (ct
, alternate
, cp
, NULL
);
652 /* complain if we are not a part of a multipart/alternative */
654 content_error (NULL
, ct
, "don't know how to display content");
661 * Show content of type "message/partial".
665 show_partial (CT ct
, int alternate
)
667 NMH_UNUSED (alternate
);
669 content_error (NULL
, ct
,
670 "in order to display this message, you must reassemble it");
676 * Show content of type "message/external".
678 * THE ERROR CHECKING IN THIS ONE IS NOT DONE YET.
682 show_external (CT ct
, int alternate
)
684 struct exbody
*e
= (struct exbody
*) ct
->c_ctparams
;
685 CT p
= e
->eb_content
;
690 return show_switch (p
, alternate
);
695 parse_display_string (CT ct
, char *cp
, int *xstdin
, int *xlist
, int *xpause
,
696 char *file
, char *buffer
, size_t buflen
,
699 char *bp
= buffer
, *pp
;
700 CI ci
= &ct
->c_ctinfo
;
702 bp
[0] = bp
[buflen
] = '\0';
704 for ( ; *cp
&& buflen
> 0; cp
++) {
710 /* insert parameters from Content-Type field */
715 for (pm
= ci
->ci_first_pm
; pm
; pm
= pm
->pm_next
) {
716 snprintf (bp
, buflen
, "%s%s=\"%s\"", s
, pm
->pm_name
,
717 get_param_value(pm
, '?'));
727 /* insert content description */
731 s
= trimcpy (ct
->c_descr
);
732 strncpy (bp
, s
, buflen
);
738 /* no longer implemented */
742 /* %e, %f, and stdin is terminal not content */
748 /* insert filename(s) containing content */
749 struct multipart
*m
= (struct multipart
*) ct
->c_ctparams
;
754 for (part
= m
->mp_parts
; part
; part
= part
->mp_next
) {
757 snprintf (bp
, buflen
, "%s%s", s
, p
->c_storage
);
764 /* insert filename containing content */
765 snprintf (bp
, buflen
, "%s", file
);
768 * Old comments below are left here for posterity.
769 * This was/is tricky.
771 /* since we've quoted the file argument, set things up
772 * to look past it, to avoid problems with the quoting
773 * logic below. (I know, I should figure out what's
774 * broken with the quoting logic, but..)
777 * Here's the email that submitted the patch with
779 * https://www.mail-archive.com/nmh-workers@mhost.com/
781 * I can't tell from that exactly what was broken,
782 * beyond misquoting of the filename. The profile
783 * had appearances of %F both with and without quotes.
784 * The unquoted ones should have been quoted by the
786 * The fix was to always quote the filename. But
787 * that broke '%F' because it expanded to ''filename''.
790 * Old comments above are left here for posterity.
791 * The quoting below should work properly now.
797 /* %l, and pause prior to displaying content */
802 /* display listing prior to displaying content */
807 /* insert subtype of content */
808 strncpy (bp
, ci
->ci_subtype
, buflen
);
812 /* insert character % */
816 const char *closing_brace
= strchr(cp
, '}');
819 const size_t param_len
= closing_brace
- cp
- 1;
820 char *param
= mh_xmalloc(param_len
+ 1);
823 (void) strncpy(param
, cp
+ 1, param_len
);
824 param
[param_len
] = '\0';
825 value
= get_param(ci
->ci_first_pm
, param
, '?', 0);
828 cp
+= param_len
+ 1; /* Skip both braces, too. */
831 /* %{param} is set in the Content-Type header.
832 After the break below, quote it if necessary. */
833 (void) strncpy(bp
, value
, buflen
);
836 /* %{param} not found, so skip it completely. cp
837 was advanced above. */
841 /* This will get confused if there are multiple %{}'s,
842 but its real purpose is to avoid doing bad things
843 above if a closing brace wasn't found. */
845 "no closing brace for display string escape %s",
862 /* Did we actually insert something? */
864 /* Insert single quote if not inside quotes already */
865 if (!quoted
&& buflen
) {
867 memmove (pp
+ 1, pp
, len
+1);
873 /* Escape existing quotes */
874 while ((pp
= strchr (pp
, '\'')) && buflen
> 3) {
877 /* Quoted. Let this quote close that quoting.
878 Insert an escaped quote to replace it and
879 another quote to reopen quoting, which will be
881 memmove (pp
+ 2, pp
, len
);
888 /* Not quoted. This should not be reached with
889 the current code, but handle the condition
890 in case the code changes. Just escape the
892 memmove (pp
, pp
-1, len
+1);
898 /* If pp is still set, that means we ran out of space. */
902 if (quoted
&& buflen
) {
903 /* See if we need to close the quote by looking
904 for an odd number of unescaped close quotes in
905 the remainder of the display string. */
906 int found_quote
= 0, escaped
= 0;
909 for (c
= cp
+1; *c
; ++c
) {
917 found_quote
= ! found_quote
;
942 (ct
->c_termproc
&& buflen
<= strlen(ct
->c_termproc
))) {
943 /* content_error would provide a more useful error message
944 * here, except that if we got overrun, it probably would
950 /* use charset string to modify display method */
951 if (ct
->c_termproc
) {
954 strncpy (term
, buffer
, sizeof(term
));
955 snprintf (buffer
, buflen
, ct
->c_termproc
, term
);
963 convert_charset (CT ct
, char *dest_charset
, int *message_mods
) {
964 char *src_charset
= content_charset (ct
);
967 /* norm_charmap() is case sensitive. */
968 char *src_charset_u
= upcase (src_charset
);
969 char *dest_charset_u
= upcase (dest_charset
);
970 int different_charsets
=
971 strcmp (norm_charmap (src_charset
), norm_charmap (dest_charset
));
973 free (dest_charset_u
);
974 free (src_charset_u
);
976 if (different_charsets
) {
978 iconv_t conv_desc
= NULL
;
985 int opened_input_file
= 0;
986 char src_buffer
[BUFSIZ
];
990 if ((conv_desc
= iconv_open (dest_charset
, src_charset
)) ==
992 advise (NULL
, "Can't convert %s to %s", src_charset
, dest_charset
);
996 if ((tempfile
= m_mktemp2 (NULL
, invo_name
, &fd
, NULL
)) == NULL
) {
997 adios (NULL
, "unable to create temporary file in %s",
1000 dest
= add (tempfile
, NULL
);
1002 if (ct
->c_cefile
.ce_file
) {
1003 file
= &ct
->c_cefile
.ce_file
;
1004 fp
= &ct
->c_cefile
.ce_fp
;
1006 } else if (ct
->c_file
) {
1009 begin
= (size_t) ct
->c_begin
;
1010 end
= (size_t) ct
->c_end
;
1011 } /* else no input file: shouldn't happen */
1013 if (file
&& *file
&& fp
) {
1015 if ((*fp
= fopen (*file
, "r")) == NULL
) {
1016 advise (*file
, "unable to open for reading");
1019 opened_input_file
= 1;
1026 size_t bytes_to_read
=
1027 end
> 0 && end
> begin
? end
- begin
: sizeof src_buffer
;
1029 fseeko (*fp
, begin
, SEEK_SET
);
1030 while ((inbytes
= fread (src_buffer
, 1,
1031 min (bytes_to_read
, sizeof src_buffer
),
1033 char dest_buffer
[BUFSIZ
];
1034 ICONV_CONST
char *ib
= src_buffer
;
1035 char *ob
= dest_buffer
;
1036 size_t outbytes
= sizeof dest_buffer
;
1037 size_t outbytes_before
= outbytes
;
1039 if (end
> 0) bytes_to_read
-= inbytes
;
1041 if (iconv (conv_desc
, &ib
, &inbytes
, &ob
, &outbytes
) ==
1046 write (fd
, dest_buffer
, outbytes_before
- outbytes
);
1050 if (opened_input_file
) {
1056 iconv_close (conv_desc
);
1060 /* Replace the decoded file with the converted one. */
1061 if (ct
->c_cefile
.ce_file
) {
1062 if (ct
->c_cefile
.ce_unlink
) {
1063 (void) m_unlink (ct
->c_cefile
.ce_file
);
1065 free (ct
->c_cefile
.ce_file
);
1067 ct
->c_cefile
.ce_file
= dest
;
1068 ct
->c_cefile
.ce_unlink
= 1;
1072 /* Update ct->c_ctline. */
1074 char *ctline
= concat(" ", ct
->c_ctinfo
.ci_type
, "/",
1075 ct
->c_ctinfo
.ci_subtype
, NULL
);
1078 replace_param(&ct
->c_ctinfo
.ci_first_pm
,
1079 &ct
->c_ctinfo
.ci_last_pm
, "charset",
1081 outline
= output_params(strlen(TYPE_FIELD
) + 1 + strlen(ctline
),
1082 ct
->c_ctinfo
.ci_first_pm
, NULL
, 0);
1084 ctline
= add(outline
, ctline
);
1088 free (ct
->c_ctline
);
1089 ct
->c_ctline
= ctline
;
1090 } /* else no CT line, which is odd */
1092 /* Update Content-Type header field. */
1093 for (hf
= ct
->c_first_hf
; hf
; hf
= hf
->next
) {
1094 if (! strcasecmp (TYPE_FIELD
, hf
->name
)) {
1095 char *ctline
= concat (ct
->c_ctline
, "\n", NULL
);
1103 (void) m_unlink (dest
);
1105 #else /* ! HAVE_ICONV */
1106 NMH_UNUSED (message_mods
);
1108 advise (NULL
, "Can't convert %s to %s without iconv", src_charset
,
1111 #endif /* ! HAVE_ICONV */
1119 convert_content_charset (CT ct
, char **file
) {
1121 /* Using current locale, see if the content needs to be converted. */
1123 /* content_charset() cannot return NULL. */
1124 char *charset
= content_charset (ct
);
1126 if (! check_charset (charset
, strlen (charset
))) {
1129 if (convert_charset (ct
, get_charset (), &unused
) == 0) {
1130 *file
= ct
->c_cefile
.ce_file
;
1135 #else /* ! HAVE_ICONV */
1138 #endif /* ! HAVE_ICONV */
1150 siglongjmp (intrenv
, DONE
);