Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #7096

Re: filters

From lee <lee@yun.yagibdah.de>
Newsgroups comp.lang.c
Subject Re: filters
Date 2011-06-27 22:20 +0200
Organization albasani.net
Message-ID <87ei2fkow2.fsf@yun.yagibdah.de> (permalink)
References (3 earlier) <0.dffdcd7defee49bd5572.20110618231353BST.8739j67ppa.fsf@bsb.me.uk> <4dfe4436.110931874@text.giganews.com> <0.982004441886d4cbdcb8.20110619211646BST.87liwx60gh.fsf@bsb.me.uk> <87tybk1tsy.fsf@yun.yagibdah.de> <0.e9d15bc0ac910c0833fd.20110620155358BST.87fwn45zax.fsf@bsb.me.uk>

Show all headers | View raw


Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> lee <lee@yun.yagibdah.de> writes:
>
>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>
>>> Why would I not take the fact that the question was posted here as
>>> meaning that C advice was being asked for?  The main reason is that it
>>> makes no sense for someone to be asking so general a question about
>>> writing a filter whist at the same time that person has already decided
>>> what language they'll be using.  I accept that there are reasons that
>>> this happens (the person knows only C or they are taking a C course and
>>> the language is therefore pre-decided) but in the absence of a hint
>>> about that it seemed impolite to assume that the OP wanted only C
>>> advice.
>>
>> Well, no, I´m asking for C advice because I´m thinking of writing a
>> filter in C. That´s why I posted the question in this group, impolitely
>> assuming that people here would assume it´s a question about writing a
>> filter in C :)
>
> Good to hear back from you.  You have no idea how many people just "post
> and go".

Yeah, I don't like it when people do that.

> And I was not suggesting your were being impolite -- I was
> suggesting it would be impolite for me to assume you'd decided the
> language but nothing else.

I know, hence the smiley.

>> Though I´m aware that there are languages better suited for the purpose,
>> C is still the only one I know well enough to use for this, hence the
>> pre-decision.
>
> I urge you to reconsider!  Not because I know that language X (X != C)
> is the better choice (how can I?) but because deciding to stick with
> what I know has almost always been a bad choice for me.  Learning new
> things is stimulating and it's rare to regret learning to use
> appropriate tools.

You're right about that. There's so much to learn that it's really
overwhelming. I'm trying to learn elisp ATM, besides a lot of other
things.

> You can't get specific advice without a specific problem.  I have
> several mail filters that I use every day and none use C.  Only one has
> any need for more than a tiny amount of storage.  How do you even know
> that storage will be a problem?

It turned out that storage can be a problem when I was thinking of
writing a filter for something. IIRC, the filter was supposed to work on
strings, and I soon found out that when allocating a buffer to work on,
a part of what the program needed to look at would inevitably be outside
of the buffer. I ended up finding a different solution and kept
wondering how the problem is solved.

> The need for growing storage will come from what the filter does, not
> from the fact the input is not limited in size.  In short, there is no
> inevitable problem caused by unlimited input.

That's true.

>> * It depends on what the filter does how large a portion of the data
>>   read from stdin needs to be.
>
> Whilst that's obviously true, it seems to be missing the point.  It is
> much more important to understand how much data (and exactly what data)
> needs to be stored.  How much needs to be read is often a detail.

Seeing it that way makes it obvious that asking a question like I did
doesn't make much sense. The question *is* too general, and you're
right, it's missing the point.

>> Now a more specific question: Is there a nice C library useful for
>> writing a filter for filtering email?
>
> Yes, though I can't say how nice any of them are because I've not used
> any from C.  If I was forced to use C, I'd probably start by looking at
> the GNU mailutils library.  From choice I'd use Perl's MailTools
> package.

Well, I always wanted to learn perl and never got to it. I think I've
been reading about the MailTools package, and it seemed to be very
powerful.

> Is it possible that you are looking for a project to extend your C
> skills?

Nah, it's only like I said, C is an obvious choice for me because it's
what I know best. I could write a filter without having to learn another
programming language first, which is something that can take a lot of
time.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

filters lee <lee@yun.yagibdah.de> - 2011-06-18 12:15 +0200
  Re: filters Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-06-18 11:37 +0100
    Re: filters cri@tiac.net (Richard Harter) - 2011-06-18 18:42 +0000
      Re: filters Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-06-18 23:13 +0100
        Re: filters cri@tiac.net (Richard Harter) - 2011-06-19 19:02 +0000
          Re: filters Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-06-19 21:16 +0100
            Re: filters lee <lee@yun.yagibdah.de> - 2011-06-20 16:06 +0200
              Re: filters Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-06-20 15:53 +0100
                Re: filters lee <lee@yun.yagibdah.de> - 2011-06-27 22:20 +0200
  Re: filters Francois Grieu <fgrieu@gmail.com> - 2011-06-18 13:56 +0200
    Re: filters "Bill Cunningham" <nospam@nspam.invalid> - 2011-06-18 14:24 -0400
      Re: filters Angel <angel+news@spamcop.net> - 2011-06-18 18:51 +0000
        Re: filters Keith Thompson <kst-u@mib.org> - 2011-06-18 11:55 -0700
          Re: filters Angel <angel+news@spamcop.net> - 2011-06-18 19:46 +0000
            Re: filters Keith Thompson <kst-u@mib.org> - 2011-06-18 13:18 -0700
      Re: filters Lew Pitcher <lpitcher@teksavvy.com> - 2011-06-18 14:55 -0400
  Re: filters James Kuyper <jameskuyper@verizon.net> - 2011-06-18 10:14 -0400
    Re: filters cri@tiac.net (Richard Harter) - 2011-06-18 19:58 +0000
    Re: filters Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-19 16:09 -0700
      Re: filters Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-20 07:51 +0000
        Re: filters Tim Rentsch <txr@alumni.caltech.edu> - 2011-06-20 12:33 -0700
  Re: filters Nobody <nobody@nowhere.com> - 2011-06-18 15:25 +0100
  Re: filters gordonb.f4hvo@burditt.org (Gordon Burditt) - 2011-06-18 15:17 -0500

csiph-web