X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhshowsbr.c;h=adb0da7bbf1d1444e0ff347023c6b2e4b7990d19;hp=2b69c19728917416d818e5e94824885b5d6c74c7;hb=55e1d8c654ee0f7c45b9361ce34617983b454c32;hpb=c164fa6824a65205d96c9d1450dc656bec66553a diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 2b69c19..adb0da7 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -963,24 +963,34 @@ show_partial(CT ct, int alternate) /* -** Show content of type "message/external". -** -** THE ERROR CHECKING IN THIS ONE IS NOT DONE YET. +** Show how to retrieve content of type "message/external". */ - static int show_external(CT ct, int alternate) { - struct exbody *e = (struct exbody *) ct->c_ctparams; - CT p = e->eb_content; - - if (!type_ok(p, 0)) - return OK; - - return show_switch(p, alternate); - -#if 0 - content_error(NULL, p, "don't know how to display content"); - return NOTOK; -#endif + char **ap, **ep; + char *msg; + FILE *fp; + char buf[BUFSIZ]; + + msg = add("You need to fetch the contents yourself:", NULL); + ap = ct->c_ctinfo.ci_attrs; + ep = ct->c_ctinfo.ci_values; + for (; *ap; ap++, ep++) { + msg = add(concat("\n\t", *ap, ": ", *ep, NULL), msg); + } + if (!(fp = fopen(ct->c_file, "r"))) { + adios(ct->c_file, "unable to open"); + } + fseek(fp, ct->c_begin, SEEK_SET); + while (!feof(fp) && ftell(fp) < ct->c_end) { + if (!fgets(buf, sizeof buf, fp)) { + adios(ct->c_file, "unable to read"); + } + *strchr(buf, '\n') = '\0'; + msg = add(concat("\n\t", buf, NULL), msg); + } + fclose(fp); + content_error(NULL, ct, msg); + return OK; }