On Fri, Aug 18, 2000 at 11:22:01AM +0000, Andrew Richards wrote:
> I assume that within a (C) program you could do the same with
> open-for-append followed by close.

No, you use utime().

> To perform tricks with this for qmail-pop3d, you can write a small shim to
> go between checkpassword and qmail-pop3d which 'touches' [in
> your case] all small files in Maildir/new, Maildir/cur before exec-ing
> qmail-pop3d as normal.

If you touch all the small files, then the big files will come earlier
in the list! If you want to get all the small files first, you can do
something like this:

#!/usr/bin/perl -w
if (opendir(CUR, ".")) {
        map {
                my @sb;
                utime($sb[8], $sb[7], $_) if (@sb = stat($_));
        } readdir(CUR);
        closedir(CUR);
}

This sets the timestamp of all the files in the current directory to
their sizes. This is clearly a hack, but would probably work.

>                        This even works if your varying size files
> are distributed across new and cur! I haven't looked at the qmail-pop3d
> code, but I assume this is down to 'Cool DJB code' rather than a quirk
> of the system I tried it on (Linux).

Your message prompted me to have a look at the code. Indeed it's roughly
sorted by the mtime of the messages. I say roughly because I did a pen-
and-paper test of the prioq functions and saw that it's not always fully
sorted.

        ---Chris K.
-- 
 Chris, the Young One |_ heartbleed (OpenBSD/i386) has now been up for 
  Auckland, New Zealand |_ all of 14 days, 06:54:32 
http://cloud9.hedgee.com/ |_ 

Reply via email to