4 * Copyright (C) 2009-2018 Ali Gholami Rudi <ali at rudi dot ir>
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28 static int has_mail(char *path
)
31 if (stat(path
, &st
) == -1)
33 return st
.st_mtime
> st
.st_atime
;
36 static int ns(char *argv
[])
39 for (i
= 0; argv
[i
]; i
++)
40 if (has_mail(argv
[i
]))
41 printf("%s\n", argv
[i
]);
46 "usage: neatmail command [options]\n\n"
48 " ex \texecute commands on an mbox\n"
49 " mk \tlist the messages in an mbox\n"
50 " pg \tpage a message of an mbox\n"
51 " ns \tcheck mboxes for new mails\n";
53 int main(int argc
, char *argv
[])
55 signal(SIGPIPE
, SIG_IGN
);
58 if (argv
[1] && !strcmp("mk", argv
[1]))
60 if (argv
[1] && !strcmp("ex", argv
[1]))
62 if (argv
[1] && !strcmp("pg", argv
[1]))
64 if (argv
[1] && !strcmp("ns", argv
[1]))