From murray@builder.freebsdmall.com  Wed May 21 00:40:32 2003
Return-Path: <murray@builder.freebsdmall.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 222A837B401
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 21 May 2003 00:40:32 -0700 (PDT)
Received: from builder.freebsdmall.com (builder.freebsdmall.com [65.86.180.18])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 86AED43FF5
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 21 May 2003 00:40:31 -0700 (PDT)
	(envelope-from murray@builder.freebsdmall.com)
Received: (from root@localhost)
	by builder.freebsdmall.com (8.12.9/8.11.6) id h4L7eVgH064332;
	Wed, 21 May 2003 00:40:31 -0700 (PDT)
	(envelope-from murray)
Message-Id: <200305210740.h4L7eVgH064332@builder.freebsdmall.com>
Date: Wed, 21 May 2003 00:40:31 -0700 (PDT)
From: murray@freebsd.org
Reply-To: murray@freebsd.org
To: FreeBSD-gnats-submit@freebsd.org
Cc: Keith Sklower <sklower@vangogh.CS.Berkeley.EDU>
Subject: New functionality for /usr/bin/Mail
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         52517
>Category:       bin
>Synopsis:       [request] [patch] New functionality for mail(1)
>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:  Fri Aug 06 17:00:58 UTC 2010
>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:
Responsible-Changed-From-To: freebsd-bugs->murray 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Sat Dec 27 09:33:44 PST 2003 
Responsible-Changed-Why:  
Assign to murray, who this is really a reminder for. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=52517 
Responsible-Changed-From-To: murray->freebsd-ports-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Aug 4 02:33:42 UTC 2010 
Responsible-Changed-Why:  
Murray has returned his src bit for safekeeping. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=52517 
Responsible-Changed-From-To: freebsd-ports-bugs->freebsd-bugs 
Responsible-Changed-By: rene 
Responsible-Changed-When: Fri Aug 6 16:57:23 UTC 2010 
Responsible-Changed-Why:  
bin pr, mail is part of the base system 

http://www.freebsd.org/cgi/query-pr.cgi?pr=52517 
>Unformatted:
