diff --git a/src/main.c b/src/main.c index 3e7a04e..6e2163e 100644 --- a/src/main.c +++ b/src/main.c @@ -133,7 +133,7 @@ main (int argc, char **argv) { if (config.action == DELETE) { tmpmbox_create (argv[optind]); - runtime.tmp_mbox = mbox_open (config.tmpfilename, "w"); + runtime.tmp_mbox = (mbox_t *) mbox_open (config.tmpfilename, "w"); } config.boxname = xstrdup (argv[optind]); diff --git a/src/mbox.h b/src/mbox.h index 26fb30b..e31b8b3 100644 --- a/src/mbox.h +++ b/src/mbox.h @@ -23,7 +23,7 @@ #include -#include "mboxgrep.h" /* for message_t structure */ +#include "message.h" typedef struct { @@ -39,9 +39,7 @@ void tmpfile_name (const char *path); void tmpfile_mod_own (const int fd, const char *path); int tmpfile_create (void); void mbox_close (mbox_t * mbp); -/* FIXME -- it doesn't compile with this portion uncommented message_t *mbox_read_message (mbox_t * mp); void mbox_write_message (message_t *m, mbox_t *mbox); -*/ #endif /* MBOX_H */ diff --git a/src/mboxgrep.h b/src/mboxgrep.h index 07518cd..b38ccea 100644 --- a/src/mboxgrep.h +++ b/src/mboxgrep.h @@ -45,8 +45,6 @@ # endif /* HAVE_NDIR_H */ #endif /* HAVE_DIRENT_H */ -#include "mbox.h" - typedef enum { MBOX, @@ -77,19 +75,6 @@ typedef enum } action_t; -typedef struct -{ - char *filename; /* used with directory formats, such as maildir or MH */ - char *msgid; - char *from; - char *headers; - int hbytes; - char *body; - int bbytes; - time_t date; -} -message_t; - typedef struct { FILE *fp; @@ -140,7 +125,8 @@ typedef struct int count; int maildir_count; checksum_t *cs; - mbox_t *tmp_mbox; + /* mbox_t *tmp_mbox; */ + void *tmp_mbox; } runtime_t; diff --git a/src/message.h b/src/message.h new file mode 100644 index 0000000..c39b189 --- /dev/null +++ b/src/message.h @@ -0,0 +1,39 @@ +/* -*- C -*- + mboxgrep - scan mailbox for messages matching a regular expression + Copyright (C) 2020 Daniel Spiljar + + Mboxgrep is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Mboxgrep is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with mboxgrep; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + $Id$ */ + +#ifndef MESSAGE_H +#define MESSAGE_H 1 + +#include + +typedef struct +{ + char *filename; /* used with directory formats, such as maildir or MH */ + char *msgid; + char *from; + char *headers; + int hbytes; + char *body; + int bbytes; + time_t date; +} +message_t; + +#endif /* MESSAGE_H */ diff --git a/src/misc.c b/src/misc.c index 2c5c596..f1e5c05 100644 --- a/src/misc.c +++ b/src/misc.c @@ -33,6 +33,8 @@ #include "mboxgrep.h" #include "wrap.h" #include "getopt.h" +#include "info.h" +#include "message.h" format_t folder_format (const char *name) diff --git a/src/misc.h b/src/misc.h index 2a397a8..ffae529 100644 --- a/src/misc.h +++ b/src/misc.h @@ -23,6 +23,7 @@ #include "mboxgrep.h" #include "getopt.h" +#include "message.h" /* #include */ format_t folder_format (const char *name); diff --git a/src/re.c b/src/re.c index a82fc1c..1e38110 100644 --- a/src/re.c +++ b/src/re.c @@ -26,6 +26,7 @@ #include #endif /* HAVE_LIBPCRE */ #include "mboxgrep.h" +#include "message.h" #ifdef HAVE_LIBPCRE void