Fix compilation warnings and recursive inclusion.

This commit is contained in:
Daniel Spiljar 2020-12-19 21:53:34 +01:00
parent 1bd3f45581
commit bd05f33334
7 changed files with 47 additions and 20 deletions

View File

@ -133,7 +133,7 @@ main (int argc, char **argv)
{ {
if (config.action == DELETE) { if (config.action == DELETE) {
tmpmbox_create (argv[optind]); 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]); config.boxname = xstrdup (argv[optind]);

View File

@ -23,7 +23,7 @@
#include <config.h> #include <config.h>
#include "mboxgrep.h" /* for message_t structure */ #include "message.h"
typedef struct typedef struct
{ {
@ -39,9 +39,7 @@ void tmpfile_name (const char *path);
void tmpfile_mod_own (const int fd, const char *path); void tmpfile_mod_own (const int fd, const char *path);
int tmpfile_create (void); int tmpfile_create (void);
void mbox_close (mbox_t * mbp); void mbox_close (mbox_t * mbp);
/* FIXME -- it doesn't compile with this portion uncommented
message_t *mbox_read_message (mbox_t * mp); message_t *mbox_read_message (mbox_t * mp);
void mbox_write_message (message_t *m, mbox_t *mbox); void mbox_write_message (message_t *m, mbox_t *mbox);
*/
#endif /* MBOX_H */ #endif /* MBOX_H */

View File

@ -45,8 +45,6 @@
# endif /* HAVE_NDIR_H */ # endif /* HAVE_NDIR_H */
#endif /* HAVE_DIRENT_H */ #endif /* HAVE_DIRENT_H */
#include "mbox.h"
typedef enum typedef enum
{ {
MBOX, MBOX,
@ -77,19 +75,6 @@ typedef enum
} }
action_t; 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 typedef struct
{ {
FILE *fp; FILE *fp;
@ -140,7 +125,8 @@ typedef struct
int count; int count;
int maildir_count; int maildir_count;
checksum_t *cs; checksum_t *cs;
mbox_t *tmp_mbox; /* mbox_t *tmp_mbox; */
void *tmp_mbox;
} }
runtime_t; runtime_t;

39
src/message.h Normal file
View File

@ -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 <config.h>
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 */

View File

@ -33,6 +33,8 @@
#include "mboxgrep.h" #include "mboxgrep.h"
#include "wrap.h" #include "wrap.h"
#include "getopt.h" #include "getopt.h"
#include "info.h"
#include "message.h"
format_t format_t
folder_format (const char *name) folder_format (const char *name)

View File

@ -23,6 +23,7 @@
#include "mboxgrep.h" #include "mboxgrep.h"
#include "getopt.h" #include "getopt.h"
#include "message.h"
/* #include <time.h> */ /* #include <time.h> */
format_t folder_format (const char *name); format_t folder_format (const char *name);

View File

@ -26,6 +26,7 @@
#include <pcre.h> #include <pcre.h>
#endif /* HAVE_LIBPCRE */ #endif /* HAVE_LIBPCRE */
#include "mboxgrep.h" #include "mboxgrep.h"
#include "message.h"
#ifdef HAVE_LIBPCRE #ifdef HAVE_LIBPCRE
void void