Howdy. Here's another copy of that patch to fix the mhshow piped to program
hang, but it additionally includes a modification I last sent to the list as
a patch to 0.22.
I get a lot of bogus multipart/alternative messages that have HTML and plain
text parts, but with no extra formatting in the HTML part. I prefer to just
view the text/plain part in these cases, but unfortunately nmh defaults to
the text/html part, so this patch makes nmh ignore alternative text parts
that aren't text/plain.
This is a just a kludge, of course. Once we get the new nmh development
procedures set up, we should come up with a clean way for the user to tell
nmh what his preference order is for the different text/* types. If there
was something like that, I'd probably tell nmh my order of preference is
(text/plain, text/html, text/richtext text/*). Hopefully, there'd be a way
of overriding this setting for the times I really do want to throw the
text/html alternate part over to Netscape.
Another item I think I mentioned before w.r.t. mhn, and which still applies
to mhshow, is that the man page is misleading when it says:
If a display string is not found, mhshow has several default
values:
mhshow-show-text/plain: %pmoreproc '%F'
This implies that you can use the word "moreproc" in your mhn.defaults and
have it evaluate to your chosen moreproc. You can't, of course -- it'll try
to run a program literally called "moreproc". There should be another
%<letter> variable (%M?) that evaluates to your current moreproc, so
that you don't have to hardcode a particular moreproc just because you want
to put in a %l entry for "text" to selectively turn off the pause for that
content type.
Anyhow, here's that patch I promised:
*** uip/mhshowsbr.c.orig Wed Sep 9 13:59:17 1998
--- uip/mhshowsbr.c Fri Apr 9 19:00:50 1999
***************
*** 488,512 ****
}
if (xlist) {
! char prompt[BUFSIZ];
if (ct->c_type == CT_MULTIPART)
list_content (ct, -1, 1, 0, 0);
else
list_switch (ct, -1, 1, 0, 0);
- if (xpause && SOprintf ("Press <return> to show content..."))
- printf ("Press <return> to show content...");
-
if (xpause) {
int intr;
SIGNAL_HANDLER istat;
istat = SIGNAL (SIGINT, intrser);
if ((intr = sigsetjmp (intrenv, 1)) == OK) {
! fflush (stdout);
prompt[0] = 0;
! read (fileno (stdout), prompt, sizeof(prompt));
}
SIGNAL (SIGINT, istat);
if (intr != OK) {
--- 488,543 ----
}
if (xlist) {
! char prompt[BUFSIZ];
! static FILE* tty_FILE = NULL;
! static int tty_fd;
!
! /* Patch: This routine used to get the terminal file descriptor with
! 'fileno (stdout)', but this is wrong when our output is being piped
! to a program, as in 'show -form mhl.body | pgpv', causing mhshow to
! hang at the prompt below. If stdout isn't a terminal, get the
! terminal file descriptor using the special "/dev/tty" pseudonym.
! -- Dan Harkless <[EMAIL PROTECTED]>, 1999-04-09 */
! if (tty_FILE == NULL) {
! if (isatty(STDOUT_FILENO))
! tty_FILE = stdout;
! else
! tty_FILE = fopen("/dev/tty", "r+");
! tty_fd = fileno(tty_FILE);
! }
if (ct->c_type == CT_MULTIPART)
list_content (ct, -1, 1, 0, 0);
else
list_switch (ct, -1, 1, 0, 0);
if (xpause) {
int intr;
SIGNAL_HANDLER istat;
+ /* Patch: Don't call SOprintf() to print the prompt if stdout isn't
+ a terminal -- who knows what the program on the other end is
+ doing with the output (if it's pgpv 5.0i, for instance, the user
+ will never see the prompt). In this situation, use the fallback
+ routine, which was a printf(), and I've changed to being an
+ fprintf(tty_FILE), so that the user will be sure to see the
+ prompt. Because we aren't using SOprintf(), the user won't get
+ the prompt in standout mode when our output is going to a
+ program. Ideally, there should be an SOfprintf(), or else
+ SOprintf() and related routines should be modified to always use
+ the terminal rather than stdout. I started going down this path,
+ but it was taking too long to get working completely, so I'm
+ settling for the standout-lossage behavior for now.
+ -- Dan Harkless <[EMAIL PROTECTED]>, 1999-04-09 */
+ if (tty_FILE != stdout ||
+ SOprintf("Press <return> to show content...") != OK)
+ fprintf(tty_FILE, "Press <return> to show content...");
+
istat = SIGNAL (SIGINT, intrser);
if ((intr = sigsetjmp (intrenv, 1)) == OK) {
! fflush(tty_FILE);
prompt[0] = 0;
! read(tty_fd, prompt, sizeof(prompt));
}
SIGNAL (SIGINT, istat);
if (intr != OK) {
***************
*** 570,575 ****
--- 601,611 ----
{
char *cp, buffer[BUFSIZ];
CI ci = &ct->c_ctinfo;
+
+ /* Patch: Kludge to prefer text/plain over text/html.
+ -- Dan Harkless <[EMAIL PROTECTED]>, 1999-04-09 */
+ if (alternate && ct->c_subtype != TEXT_PLAIN)
+ return NOTOK;
/* Check for mhn-show-type/subtype */
snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
-----------------------------------------------------------------------
Dan Harkless | To prevent SPAM contamination, please do not post this
[EMAIL PROTECTED] | private email address to the USENET or WWW. Thank you.