Bug 52517 - [request] [patch] New functionality for mail(1)
Summary: [request] [patch] New functionality for mail(1)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 4.8-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2003-05-21 08:50 UTC by Murray Stokely
Modified: 2022-10-17 12:39 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Murray Stokely freebsd_committer freebsd_triage 2003-05-21 08:50:16 UTC
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));
 }
 
 /*
Comment 1 Ceri Davies freebsd_committer freebsd_triage 2003-12-27 17:33:44 UTC
Responsible Changed
From-To: freebsd-bugs->murray

Assign to murray, who this is really a reminder for.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2010-08-04 03:33:42 UTC
Responsible Changed
From-To: murray->freebsd-ports-bugs

Murray has returned his src bit for safekeeping.
Comment 3 Rene Ladan freebsd_committer freebsd_triage 2010-08-06 17:57:23 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-bugs

bin pr, mail is part of the base system
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:57 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 5 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:39:24 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>