Date:        Wed, 16 Oct 2002 15:55:45 +0700
    From:        Robert Elz <[EMAIL PROTECTED]>
    Message-ID:  <[EMAIL PROTECTED]>

  | If you, or anyone else, cares, I have a patch to pick that gets
  | rid of the ugly
  | 
  |     pick -list -seq x
  | means
  |     pick -nolist -seq x
  | 
  | behaviour.

Just in case anyone wants to do anything with this, the patch is appended
(and it now has a patch for the man page too, which turned out to be easier
than I anticipated).

Note that the two /* HACK */ lines added should be regarded as a bug fix,
and done anyway, regardless of whether you want the rest of the patch.

I doubt many people do pick -list -version >/tmp/foo (or similar), but you
never know...   (it turns out this is more important with my patch than
without it, as then just pick -version >/tmp/foo would also not behave
quite as it should, though this could also be fixed inside done() by testing
listsw > 0 instead of listsw != 0).

There is another bug fix that "just happens" with this patch as well,
though most likely an irrelevant one (could even be considered by some
as disabling a feature).

That is, as currently implemented

        pick -nolist

is equivalent to

        pick -list

because there's no sequence listed.   While having pick do lots of work
and then saving the output nowhere probably isn't useful, there's nothing
to suggest this shouldn't work, the man page says (used to say) that
giving -seq implies -nolist, and it said (still says) that the default is
-list when there are no sequences given, and -nolist otherwise, but it
doesn't say that you aren't allowed to give -nolist when there are no
sequences.

These patches are against 1.0.4 (the latest release version, which is
what I use).  Do with them what ever you (collectively) like.

If someone would like to make an enhancement, a -noseq option would be
useful (would just do "seqp = 0;") - that's for people like me who have
        pick: -seq sel
in their .mh_profile, but sometimes want to disable that.  Currently the
only ways are either editing .mh_profile temporarily, or having a pick
binary under another name, so it (would) use a different .mh_profile entry
(which naturally, doesn't exist).

kre

--- uip/pick.c.WAS      Sat Feb  5 03:28:24 2000
+++ uip/pick.c  Sun Oct 20 19:03:14 2002
@@ -68,7 +68,7 @@
     { NULL, 0 }
 };
 
-static int listsw = 0;
+static int listsw = -1;
 
 
 int
@@ -111,6 +111,7 @@
            switch (smatch (cp, switches)) {
            case AMBIGSW: 
                ambigsw (cp, switches);
+               listsw = 0;     /* HACK */
                done (1);
            case UNKWNSW: 
                adios (NULL, "-%s unknown", cp);
@@ -123,6 +124,7 @@
                done (1);
            case VERSIONSW:
                print_version(invo_name);
+               listsw = 0;     /* HACK */
                done (1);
 
            case CCSW: 
@@ -159,7 +161,6 @@
                if (seqp >= NUMATTRS)
                    adios (NULL, "too many sequences (more than %d) specified", 
NUMATTRS);
                seqs[seqp++] = cp;
-               listsw = 0;
                continue;
            case PUBLSW: 
                publicsw = 1;
@@ -175,7 +176,7 @@
                continue;
 
            case LISTSW: 
-               listsw++;
+               listsw = 1;
                continue;
            case NLISTSW: 
                listsw = 0;
@@ -236,10 +237,10 @@
 
     /*
      * If we aren't saving the results to a sequence,
-     * we need to list the results.
+     * we default to list the results.
      */
-    if (seqp == 0)
-       listsw++;
+    if (listsw == -1)
+       listsw = !seqp;
 
     if (publicsw == 1 && is_readonly(mp))
        adios (NULL, "folder %s is read-only, so -public not allowed", folder);
--- man/pick.1.WAS      Tue Oct 15 15:09:11 2002
+++ man/pick.1  Sun Oct 20 19:10:27 2002
@@ -173,9 +173,6 @@
 defines a new message sequence for the current folder called
 \*(lqfred\*(rq which contains exactly those messages that were selected.
 
-Note that whenever \fIpick\fR processes a `\-sequence\ name' switch, it
-sets `\-nolist'.
-
 By default, \fIpick\fR will zero the sequence before adding it.  This
 action can be disabled with the `\-nozero' switch, which means that the
 messages selected by \fIpick\fR will be added to the sequence, if it




Reply via email to