Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 2003 00:40:31 -0700 (PDT)
From:      murray@FreeBSD.org
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        Keith Sklower <sklower@vangogh.CS.Berkeley.EDU>
Subject:   bin/52517: New functionality for /usr/bin/Mail
Message-ID:  <200305210740.h4L7eVgH064332@builder.freebsdmall.com>
Resent-Message-ID: <200305210750.h4L7oGBM075552@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         52517
>Category:       bin
>Synopsis:       New functionality for /usr/bin/Mail
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 21 00:50:16 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     murray@FreeBSD.org
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
>Environment:
System: FreeBSD builder.freebsdmall.com 4.8-STABLE FreeBSD 4.8-STABLE #29: Sat May 10 17:35:34 PDT 2003 murray@builder.freebsdmall.com:/usr/obj/usr/src/sys/BUILDER i386


>Description:

Keith Sklower <sklower@vangogh.CS.Berkeley.EDU> sent me this months
ago and I just found it in my inbox.  I plan to commit it after the
code freeze ends but I want it in the PR database so I don't forget
again.  Sorry for dropping the ball on this Keith, please make further
submissions through send-pr(1) if possible.

---


From: Keith Sklower <sklower@vangogh.CS.Berkeley.EDU>
To: murray@FreeBSD.org
Date: Sat, 4 Jan 2003 14:50:10 -0800 (PST)

Hi,

I use /usr/bin/Mail daily and love it.  I sort my mail once a month
by which time I have 3,000 -5,000 messages.

Because my name is plastered over many websites for RFC's and past contributions
to BSD, I get many copies of the klez virus.

I've been having to go through by hand and look for any messages over 1500
lines, and finally got sick of it, having goofed and lost and hour of
tedious work.

Here are some changes to /usr/src/usr.bin/mail/list.c which let me say

% Mail
f >1000

   or

s <5000b probably_good



(once could argue whether or not there should be a "searchsizes" variable
like there is a "searchheaders" variable since this is a change from
past behaviours ...)


Please forward this to whoever is appropriate to judge such contributions!

THanks!

Respectfully
Keith Sklower

%diff -u list.c.org list.c
--- list.c.org  Fri Mar 15 11:46:32 2002
+++ list.c      Sat Jan  4 14:02:44 2003
@@ -277,8 +277,12 @@
                                                mc++;
                                                break;
                                        }
-                               }
-                               else {
+                               } else if (**np == '>' || **np == '<') {
+                                       if (matchsize(*np, i)) {
+                                               mc++;
+                                               break;
+                                       }
+                               } else {
                                        if (matchsender(*np, i)) {
                                                mc++;
                                                break;
@@ -684,6 +688,34 @@
                }
        }
        return (*cp == '\0');
+}
+/*
+ * See if the message is of the desired size.  Return true if so.
+ */
+int
+matchsize(str, mesg)
+       char *str;
+       int mesg;
+{
+       char *cp, *cp2, *backup, *end;
+       long size, *msg_size;
+       struct message *mp = &message[mesg - 1];
+
+       if (*str == '\0')/* null string matches nothing instead of everything */
+               return (0);
+
+       size = strtol(str+1, &end, 10);
+       if (end == (str+1))
+               return (matchsender(str, mesg));
+       switch (*end) {
+       case 'b': case 'B': case 'c': case 'C':
+               msg_size = &(mp->m_size);
+               break;
+
+       default:
+               msg_size = &(mp->m_lines);
+       }
+       return ((*str == '<') ? (*msg_size < size) : (*msg_size > size));
 }
 
 /*



>How-To-Repeat:
	
>Fix:

	


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305210740.h4L7eVgH064332>