nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-workers] [Patch] show's handling of showproc/showmimeproc switches


From: Richard M Kreuter
Subject: [Nmh-workers] [Patch] show's handling of showproc/showmimeproc switches
Date: Mon, 18 Jan 2016 12:20:26 -0500

Hello,

Is it supposed to be possible to pass arbitrary switches through show to
a showproc/showmimeproc? (By "arbitrary", I mean ones that aren't baked
in at the top of uip/show.c.)

If this is intended, then show's handling of its argv don't appear to be
able to do it: show reorders its argv and tries to resolve some of the
elements as message lists on the way to calling showproc or
showmimeproc. This has some undesired consequences (examples below):

(1) arguments to unknown switches that aren't message lists cause show
to bail out before invoking showproc/showmimeproc; and

(2) in case all the arguments to the unknown switches happen to be
message lists, then showproc/showmimeproc will get its argv in the wrong
order for its argv parsing.

Anyway, the attached patch adds all of mhshow's documented switches to
show's handling, on the notion that nmh's pieces should know about each
other. It's just cargo-culted from what's already there, but appears to
suffice under ad-hoc testing.

Of course this won't solve the problem for arbitrary
showproc/showmimeproc programs. Would a more ambitious solution be
worthwhile? (For example: I think show could do a first pass over its
argv to pick out the showproc and showmimeproc, then run each of these
with -help to discover their repective switches, and then do a second
pass over argv to parse the switches according to the discovered
switches.)

Thank you,
Richard

Examples of the problems described above, and a non-problem.

# Wrap mhshow to see how it's getting invoked.
$ cat mymhshow
set -x
/usr/local/nmh/bin/mhshow $*

# This happens to work by accident when there's a msg 2
$ show last -showmimeproc `pwd`/mymhshow -part 2 >/dev/null
+ /usr/local/nmh/bin/mhshow -part 2 4610

# show tries to resolve an unknown switch's argument as a message
# list, but loses.
$ show last -showmimeproc `pwd`/mymhshow -prefer text/plain >/dev/null
show: bad message list text/plain

# If there are multiple unrecognized switches and their arguments happen
# to look like message lists or sequences, then show passes an argv to
# showmimeproc that doesn't work.
$ show -showmimeproc `pwd`/mymhshow -part 2 -form unseen last > /dev/null
+ /usr/local/nmh/bin/mhshow -part -form unseen 2 4610
mhshow: missing argument to -part

Attachment: show-mhshow.patch
Description: Recognize all of mhshow's documented switches in show.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]