Commit dcd6e4da dcd6e4da331e2e751fb880f9861d117e6787a8e1 by Alain Magloire

Cleanup, now we can do autogen.sh;configure;make and things will build.

mailutils/from will use the new mailbox API
mailutils/mail will use the new mailbox API
to convert pop3d(still use libmailbox the old API).

mailutils/mail is incomplete and should is equivalent to
LEGACY mail from Unix98.
1 parent 55b26b61
Showing 76 changed files with 2488 additions and 358 deletions
1 AUTOMAKE_OPTIONS = gnu 1.4 1 AUTOMAKE_OPTIONS = gnu 1.4
2 ACLOCAL_AMFLAGS = -I m4 2 ACLOCAL_AMFLAGS = -I m4
3 3
4 SUBDIRS = lib libmailbox mail pop3d doc m4 4 # imap4d
5 5 SUBDIRS = include doc m4 lib mailbox from mail libmailbox pop3d
6 #SUBDIRS = lib mailbox mail doc m4
......
...@@ -17,4 +17,5 @@ ...@@ -17,4 +17,5 @@
17 17
18 /* Define if using libpam */ 18 /* Define if using libpam */
19 #undef USE_LIBPAM 19 #undef USE_LIBPAM
20 #undef HAVE_SNPRINTF
20 21
......
1 #!/bin/sh 1 #!/bin/sh
2 2
3 aclocal -I m4 3 aclocal -I m4
4 libtoolize --copy --automake 4 libtoolize --automake
5 autoheader 5 autoheader
6 automake --add-missing --copy --gnu 6 automake -a
7 autoconf 7 autoconf
......
1 dnl Process this file with autoconf to procude a configure script. -*-m4-*- 1 dnl Process this file with autoconf to procude a configure script. -*-m4-*-
2 AC_INIT(libmailbox/mailbox.c) 2 AC_INIT(mailbox/mailbox.c)
3 AM_INIT_AUTOMAKE(mailutils, 0.9.7.1999.09.12) 3 AM_INIT_AUTOMAKE(mailutils, 0.9.7.1999.09.12)
4 AM_CONFIG_HEADER(config.h) 4 AM_CONFIG_HEADER(config.h)
5 5
...@@ -20,16 +20,27 @@ AC_ARG_ENABLE(pam, ...@@ -20,16 +20,27 @@ AC_ARG_ENABLE(pam,
20 20
21 dnl Check for headers 21 dnl Check for headers
22 AC_HEADER_STDC 22 AC_HEADER_STDC
23 AC_HEADER_DIRENT
23 AM_C_PROTOTYPES 24 AM_C_PROTOTYPES
24 AC_CHECK_HEADERS(malloc.h stdlib.h stdio.h errno.h unistd.h\ 25 AC_CHECK_HEADERS(errno.h fcntl.h inttypes.h limits.h malloc.h paths.h \
25 paths.h sys/file.h syslog.h shadow.h limits.h\ 26 shadow.h stdio.h stdlib.h string.h strings.h sys/file.h syslog.h unistd.h)
26 inttypes.h) 27
27 AC_CHECK_HEADERS(string.h strings.h, break) 28 dnl Checks for typedefs, structures, and compiler characteristics.
29 AC_C_CONST
30 AC_TYPE_UID_T
31 AC_TYPE_MODE_T
32 AC_TYPE_OFF_T
33 AC_TYPE_PID_T
34 AC_TYPE_SIZE_T
28 35
29 dnl Check for working functions 36 dnl Check for working functions
30 37
31 AC_REQUIRE([jm_FUNC_MALLOC]) 38 AC_REQUIRE([jm_FUNC_MALLOC])
32 AC_REQUIRE([jm_FUNC_REALLOC]) 39 AC_REQUIRE([jm_FUNC_REALLOC])
40 AC_FUNC_ALLOCA
41 AC_FUNC_MEMCMP
42 AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF),
43 LIBOBJS="$LIBOBJS snprintf.o")
33 44
34 dnl Check for libraries 45 dnl Check for libraries
35 46
...@@ -60,6 +71,7 @@ AC_CHECK_FUNC(socket, [true], ...@@ -60,6 +71,7 @@ AC_CHECK_FUNC(socket, [true],
60 AC_CHECK_LIB(socket, socket, LIBS="-lsocket $LIBS")) 71 AC_CHECK_LIB(socket, socket, LIBS="-lsocket $LIBS"))
61 72
62 dnl Output Makefiles 73 dnl Output Makefiles
63 AC_OUTPUT(Makefile libmailbox/Makefile mail/Makefile pop3d/Makefile 74 AC_OUTPUT(Makefile include/Makefile include/mailutils/Makefile m4/Makefile doc/Makefile
64 imap4d/Makefile lib/Makefile doc/Makefile m4/Makefile) 75 lib/Makefile mailbox/Makefile mailbox/include/Makefile libmailbox/Makefile
76 from/Makefile mail/Makefile pop3d/Makefile)
65 77
......
1 CFLAGS = -Wall -pedantic -g -DTESTING
2 INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib
3
4 bin_PROGRAMS = from
5
6 from_DEPENDENCIES = ../mailbox/libmailbox.la
7 from_LDADD = ../mailbox/libmailbox.la ../lib/libmailutils.a
...@@ -37,223 +37,55 @@ ...@@ -37,223 +37,55 @@
37 # include <paths.h> 37 # include <paths.h>
38 #endif 38 #endif
39 39
40 #include <mailbox.h> 40 #include <mailutils/mailbox.h>
41 #include <header.h>
42 41
43 /* FIXME: this should be in the mailbox header */
44 #ifndef _PATH_MAILDIR 42 #ifndef _PATH_MAILDIR
45 # define _PATH_MAILDIR "/var/spool/mail" 43 # define _PATH_MAILDIR "/var/spool/mail"
46 #endif 44 #endif
47 45
48 #ifndef VERSION 46 #ifndef VERSION
49 # define VERSION "unknown" 47 # define VERSION "unknow"
50 #endif 48 #endif
51 49
52 #include "getopt.h"
53
54 /* Short options. */
55 static char const short_options[] =
56 "H:s:m:hv";
57
58 static int opt_from;
59 static int opt_to;
60 static int opt_cc;
61 static int opt_date;
62 static int opt_subject;
63 static int opt_status_new;;
64 static int opt_status_read;;
65 static int opt_status_old;;
66 static int opt_size;
67 static int opt_number;
68 static int opt_mailbox;
69
70 /* long options equivalence */
71 static struct option long_options[] =
72 {
73 {"date", no_argument, &opt_date, 1},
74 {"from", no_argument, &opt_from, 1},
75 {"to", no_argument, &opt_to, 1},
76 {"cc", no_argument, &opt_cc, 1},
77 {"subject", no_argument, &opt_subject, 1},
78 {"header", required_argument, NULL, 'H'},
79 {"status", required_argument, NULL, 's'},
80 {"size", no_argument, &opt_size, 1},
81 {"number", no_argument, &opt_number, 1},
82 {"mailbox", required_argument, &opt_mailbox, 'm'},
83 {"help", no_argument, NULL, 'h'},
84 {"version", no_argument, NULL, 'v'},
85 {NULL, 0, NULL, 0}
86 };
87
88 /* program name */
89 static char *program;
90
91 static void
92 usage (int type)
93 {
94 switch (type)
95 {
96 case 1:
97 printf("%s (GNU mailutils), version %s\n", program, VERSION);
98 break;
99 case 2:
100 /* Fall Through */
101 default:
102 printf ("Usage: %s [OPTION] [mailbox]\n", program);
103 printf ("Retrieve information from a mailbox\n\
104 \n\
105 --date equivalent to --header=Date\n\
106 --from equivalent to --header=From\n\
107 --to equivalent to --header=To\n\
108 --cc equivalent to --header=Cc\n\
109 --subject equivalent to --header=Subject\n\
110 --header=HEADER Specify the header to display\n\
111 HEADER is 'Date', 'From', 'To', 'Cc', 'Subject'\n\
112 default is --header=From --header=Subject\n\
113 --status=STATUS Display only message with a given status\n\
114 STATUS is 'new', 'read', 'unread'\n\
115 defaut is --status=new --status=read --status=unread\n\
116 --size Display mailbox size\n\
117 --number Display total of number of messages\n\
118 --mailbox=MAILBOX Specify another mailbox\n\
119 MAILBOX is url(pop://pop.server/user),
120 a file /var/mail/user, or user.
121 -v, --version Print version information and exit\n\
122 -h, --help Show this message\n\
123 \n\
124 Mailbox :
125 $MAIL is check for the default mailbox path, if not set
126 the environ variables $USER or $LOGNAME are use in the default mail spool.\n\
127 \n\
128 Report bugs to <bug-mailutils@gnu.org>.\n");
129 }
130 }
131
132 int 50 int
133 main(int argc, char *argv[]) 51 main(int argc, char **argv)
134 { 52 {
135 mailbox_t mbox; 53 mailbox_t mbox;
136 size_t rvalue, i; 54 size_t i;
137 size_t count = 0, size; 55 size_t count = 0;
138 char *user = NULL;
139 char *mailbox_name = NULL; 56 char *mailbox_name = NULL;
140 int opt;
141 char buffer[BUFSIZ];
142 char from[BUFSIZ]; 57 char from[BUFSIZ];
143 char subject[BUFSIZ]; 58 char subject[BUFSIZ];
144 59 int status;
145 /* set program name */
146 program = argv[0];
147 if (program && strrchr (program, '/'))
148 {
149 program = strrchr (program, '/') + 1;
150 }
151
152 while ((opt = getopt_long (argc, argv, short_options, long_options, NULL))
153 != -1)
154 {
155 switch (opt)
156 {
157 case 'H':
158 if (strcasecmp (optarg, "From") == 0)
159 opt_from = 1;
160 else if (strcasecmp (optarg, "To") == 0)
161 opt_to = 1;
162 else if (strcasecmp (optarg, "Cc") == 0)
163 opt_cc = 1;
164 else if (strcasecmp (optarg, "Date") == 0)
165 opt_date = 1;
166 else if (strcasecmp (optarg, "Subject") == 0)
167 opt_subject = 1;
168 else
169 {
170 fprintf (stderr, "Unknown header\n");
171 }
172 break;
173 case 's':
174 if (strcasecmp (optarg, "new") == 0)
175 opt_status_new = 1;
176 else if (strcasecmp (optarg, "read") == 0)
177 opt_status_read = 1;
178 else if (strcasecmp (optarg, "old") == 0)
179 opt_status_old = 1;
180 else
181 {
182 fprintf (stderr, "Unknown status\n");
183 }
184 break;
185 case 'm':
186 mailbox_name = optarg;
187 break;
188 case 'v':
189 usage (1);
190 exit (0);
191 break;
192 case 'h':
193 usage (2);
194 exit (0);
195 break;
196 default:
197 //usage (2);
198 //exit (1);
199 break;
200 }
201 }
202 60
203 /* have an argument */ 61 /* have an argument */
204 if (optind > argc) 62 if (argc > 1)
205 { 63 mailbox_name = argv[1];
206 mailbox_name = argv[optind]; 64
207 /* is it a URL */ 65 if ((status = mailbox_create_default (&mbox, mailbox_name)) != 0
208 if (strchr (mailbox_name, ':') == NULL) 66 || (status = mailbox_open (mbox, MU_MAILBOX_RDONLY)) != 0)
209 {
210 /* is it a filename */
211 if (mailbox_name[0] != '/')
212 {
213 user = mailbox_name; /* a user name */
214 mailbox_name = NULL;
215 }
216 }
217 }
218 else if (getenv ("MAIL"))
219 {
220 mailbox_name = getenv ("MAIL");
221 }
222 else
223 {
224 user = (getenv ("LOGNAME")) ? getenv ("LOGNAME") : getenv ("USER");
225 if (user == NULL)
226 { 67 {
227 fprintf (stderr, "who am I?\n"); 68 fprintf (stderr, "could not create/open: %s\n", strerror (status));
228 exit (1); 69 exit (1);
229 } 70 }
230 } 71
231 if (user) 72 mailbox_messages_count (mbox, &count);
232 { 73 for(i = 1; i <= count; ++i)
233 snprintf (buffer, sizeof(buffer), "%s/%s", _PATH_MAILDIR, user);
234 mailbox_name = buffer;
235 }
236 if (mailbox_init (&mbox, mailbox_name, 0) != 0
237 || mailbox_open (mbox, MU_MB_RDONLY) != 0)
238 { 74 {
239 fprintf (stderr, "could not open\n"); 75 message_t msg;
240 exit (2); 76 header_t hdr;
241 } 77 if ((status = mailbox_get_message (mbox, i, &msg)) != 0
242 mailbox_scan (mbox, &count); 78 || (status = message_get_header (msg, &hdr)) != 0)
243 for(i = 0; i < count; ++i) {
244 rvalue = mailbox_get_header (mbox, i, 0, buffer, sizeof (buffer), &size);
245 if (rvalue != 0)
246 { 79 {
247 fprintf (stderr, "header %s\n", strerror (rvalue)); 80 fprintf (stderr, "msg %d : %s\n", i, strerror(status));
248 exit(2); 81 exit(2);
249 } 82 }
250 header_gvalue (buffer, size, MU_HDR_FROM, from, sizeof (from), NULL); 83 header_get_value (hdr, MU_HEADER_FROM, from, 30, NULL);
251 header_gvalue (buffer, size, MU_HDR_SUBJECT, subject, 84 header_get_value (hdr, MU_HEADER_SUBJECT, subject, 40, NULL);
252 sizeof (subject), NULL); 85
86 fprintf(stdout, "%s\t%s\n", from, subject);
253 87
254 printf("%s %s\n", from, subject);
255 } 88 }
256 mailbox_close(mbox); 89 mailbox_close(mbox);
257 mailbox_destroy(&mbox); 90 return 0;
258 exit(0);
259 } 91 }
......
1 SUBDIR = mailutils
2 pkginclude_HEADERS = \
3 attribute.h \
4 auth.h \
5 body.h \
6 event.h \
7 header.h \
8 locker.h \
9 mailbox.h \
10 mailer.h \
11 message.h \
12 mime.h \
13 registrar.h \
14 stream.h \
15 transcode.h \
16 url.h
17
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _ATTRIBUTE_H
19 #define _ATTRIBUTE_H
20
21 #include <sys/types.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifndef __P
28 # ifdef __STDC__
29 # define __P(args) args
30 # else
31 # define __P(args) ()
32 # endif
33 #endif /*__P */
34
35 struct _attribute;
36 typedef struct _attribute * attribute_t;
37
38 #define MU_ATTRIBUTE_ANSWERED 0x01
39 #define MU_ATTRIBUTE_FLAGGED 0x02
40 #define MU_ATTRIBUTE_DELETED 0x04
41 #define MU_ATTRIBUTE_DRAFT 0x08
42 #define MU_ATTRIBUTE_SEEN 0x10
43 #define MU_ATTRIBUTE_READ 0x20
44 #define MU_ATTRIBUTE_RECENT 0x00
45
46 extern int attribute_create __P ((attribute_t *, void *));
47 extern void attribute_destroy __P ((attribute_t *, void *));
48
49 extern int attribute_is_seen __P ((attribute_t));
50 extern int attribute_is_answered __P ((attribute_t));
51 extern int attribute_is_flagged __P ((attribute_t));
52 extern int attribute_is_deleted __P ((attribute_t));
53 extern int attribute_is_draft __P ((attribute_t));
54 extern int attribute_is_recent __P ((attribute_t));
55 extern int attribute_is_read __P ((attribute_t));
56
57 extern int attribute_set_seen __P ((attribute_t));
58 extern int attribute_set_answered __P ((attribute_t));
59 extern int attribute_set_flagged __P ((attribute_t));
60 extern int attribute_set_deleted __P ((attribute_t));
61 extern int attribute_set_draft __P ((attribute_t));
62 extern int attribute_set_recent __P ((attribute_t));
63 extern int attribute_set_read __P ((attribute_t));
64
65 extern int attribute_unset_seen __P ((attribute_t));
66 extern int attribute_unset_answered __P ((attribute_t));
67 extern int attribute_unset_flagged __P ((attribute_t));
68 extern int attribute_unset_deleted __P ((attribute_t));
69 extern int attribute_unset_draft __P ((attribute_t));
70 extern int attribute_unset_recent __P ((attribute_t));
71 extern int attribute_unset_read __P ((attribute_t));
72
73 extern int attribute_get_flags __P ((attribute_t, int *));
74 extern int attribute_set_flags __P ((attribute_t, int));
75
76 extern int attribute_set_set_flags __P ((attribute_t, int (*_set_flags)
77 __P ((attribute_t, int)), void *));
78 extern int attribute_set_unset_flags __P ((attribute_t, int (*_unset_flags)
79 __P ((attribute_t, int)), void *));
80 extern int attribute_set_get_flags __P ((attribute_t, int (*_get_flags)
81 __P ((attribute_t, int *)), void *));
82 extern int attribute_is_equal __P ((attribute_t att1, attribute_t att2));
83
84 extern int attribute_copy __P ((attribute_t dst,
85 attribute_t src));
86
87 extern int string_to_flags __P ((const char *buf, int *pattr));
88 extern int flags_to_string __P ((int flags, char *buf,
89 size_t len, size_t *));
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95 #endif /* _ATTRIBUTE_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _AUTH_H
19 #define _AUTH_H
20
21 #include <sys/types.h>
22
23 #ifndef __P
24 #ifdef __STDC__
25 #define __P(args) args
26 #else
27 #define __P(args) ()
28 #endif
29 #endif /*__P */
30
31 #ifdef _cplusplus
32 extern "C" {
33 #endif
34
35 /* forward declaration */
36 struct _auth;
37 typedef struct _auth *auth_t;
38
39 extern int auth_create __P ((auth_t *, void *owner));
40 extern void auth_destroy __P ((auth_t *, void *owner));
41
42 extern int auth_prologue __P ((auth_t));
43 extern int auth_set_prologue __P ((auth_t auth,
44 int (*_prologue) __P ((auth_t)),
45 void *owner));
46
47 extern int auth_authenticate __P ((auth_t, char **, char **));
48 extern int auth_set_authenticate __P ((auth_t auth,
49 int (*_authenticate)
50 __P ((auth_t, char **, char **)),
51 void *owner));
52
53 extern int auth_epilogue __P ((auth_t));
54 extern int auth_set_epilogue __P ((auth_t auth,
55 int (*_epilogue) __P ((auth_t)),
56 void *owner));
57
58 #ifdef _cplusplus
59 }
60 #endif
61
62 #endif /* _AUTH_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _BODY_H
19 #define _BODY_H
20
21 #include <sys/types.h>
22 #include <mailutils/stream.h>
23
24 #ifndef __P
25 # ifdef __STDC__
26 # define __P(args) args
27 # else
28 # define __P(args) ()
29 # endif
30 #endif /* __P */
31
32 #ifdef _cplusplus
33 extern "C" {
34 #endif
35
36 /* forward declaration */
37 struct _body;
38 typedef struct _body *body_t;
39
40 extern int body_create __P ((body_t *, void *owner));
41 extern void body_destroy __P ((body_t *, void *owner));
42
43 extern int body_get_stream __P ((body_t, stream_t *));
44 extern int body_set_stream __P ((body_t, stream_t, void *owner));
45
46 extern int body_get_filename __P ((body_t, char *, size_t, size_t *));
47 extern int body_set_filename __P ((body_t, const char*));
48
49 extern int body_size __P ((body_t, size_t*));
50 extern int body_set_size __P ((body_t,
51 int (*_size) __P ((body_t, size_t*)),
52 void *owner));
53 extern int body_lines __P ((body_t, size_t *));
54 extern int body_set_lines __P ((body_t,
55 int (*_lines) __P ((body_t, size_t*)),
56 void *owner));
57
58 #ifdef _cplusplus
59 }
60 #endif
61
62 #endif /* _BODY_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _EVENT_H
19 #define _EVENT_H
20
21 #ifndef __P
22 # ifdef __STDC__
23 # define __P(args) args
24 # else
25 # define __P(args) ()
26 # endif
27 #endif /* __P */
28
29 #ifdef _cplusplus
30 extern "C" {
31 #endif
32
33 struct _event
34 {
35 size_t type;
36 void *arg;
37 int (*_action) __P ((size_t type, void *arg));
38 };
39 typedef struct _event *event_t;
40
41 #ifdef _cplusplus
42 }
43 #endif
44
45 #endif /* _EVENT_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _HEADER_H
19 #define _HEADER_H
20
21 #include <sys/types.h>
22 #include <mailutils/stream.h>
23
24 #ifndef __P
25 #ifdef __STDC__
26 #define __P(args) args
27 #else
28 #define __P(args) ()
29 #endif
30 #endif /*__P */
31
32 #ifdef _cplusplus
33 extern "C" {
34 #endif
35
36 #define MU_HEADER_UNIX_FROM "From "
37 #define MU_HEADER_RETURN_PATH "Return-Path"
38 #define MU_HEADER_RECEIVED "Received"
39 #define MU_HEADER_DATE "Date"
40 #define MU_HEADER_FROM "From"
41 #define MU_HEADER_RESENT_FROM "Resent-From"
42 #define MU_HEADER_SUBJECT "Subject"
43 #define MU_HEADER_SENDER "Sender"
44 #define MU_HEADER_RESENT_SENDER "Resent-SENDER"
45 #define MU_HEADER_TO "To"
46 #define MU_HEADER_RESENT_TO "Resent-To"
47 #define MU_HEADER_CC "Cc"
48 #define MU_HEADER_RESENT_CC "Resent-Cc"
49 #define MU_HEADER_BCC "Bcc"
50 #define MU_HEADER_RESENT_BCC "Resent-Bcc"
51 #define MU_HEADER_REPLY_TO "Reply-To"
52 #define MU_HEADER_RESENT_REPLY_TO "Resent-Reply-To"
53 #define MU_HEADER_MESSAGE_ID "Message-ID"
54 #define MU_HEADER_RESENT_MESSAGE_ID "Resent-Message-ID"
55 #define MU_HEADER_IN_REPLY_TO "In-Reply-To"
56 #define MU_HEADER_ENCRYPTED "Encrypted"
57 #define MU_HEADER_PRECEDENCE "Precedence"
58 #define MU_HEADER_STATUS "Status"
59 #define MU_HEADER_CONTENT_LENGTH "Content-Length"
60 #define MU_HEADER_CONTENT_TYPE "Content-Type"
61 #define MU_HEADER_CONTENT_ENCODING "Content-transfer-encoding"
62 #define MU_HEADER_MIME_VERSION "MIME-Version"
63
64 /* Mime support header attribute */
65
66 /* forward declaration */
67 struct _header;
68 typedef struct _header * header_t;
69
70 extern int header_create __P ((header_t *, const char *,
71 size_t, void *));
72 extern void header_destroy __P ((header_t *, void *));
73 extern int header_set_value __P ((header_t, const char *,
74 const char *, int));
75 extern int header_get_value __P ((header_t, const char *, char *,
76 size_t, size_t *));
77 extern int header_get_stream __P ((header_t, stream_t *));
78 extern int header_size __P ((header_t, size_t *));
79 extern int header_lines __P ((header_t, size_t *));
80
81 extern int header_set_stream __P ((header_t, stream_t, void *));
82
83 extern int header_set_set_value __P ((header_t, int (*_set_value)
84 __P ((header_t, const char *,
85 const char *, int)),
86 void *));
87 extern int header_set_get_value __P ((header_t, int (*_get_value)
88 __P ((header_t, const char *,
89 char *, size_t, size_t *)),
90 void *));
91
92 #ifdef _cplusplus
93 }
94 #endif
95
96 #endif /* HEADER_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _LOCKER_H
19 #define _LOCKER_H
20
21 #include <sys/types.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifndef __P
28 # ifdef __STDC__
29 # define __P(args) args
30 # else
31 # define __P(args) ()
32 # endif
33 #endif /*__P */
34
35 struct _locker;
36 typedef struct _locker *locker_t;
37
38 extern int locker_create __P ((locker_t *, char *filename,
39 size_t len, int flags));
40 extern void locker_destroy __P ((locker_t *));
41
42 #define MU_LOCKER_RDLOCK 0
43 #define MU_LOCKER_WRLOCK 1
44
45 /* locking flags */
46 #define MU_LOCKER_PID 1
47 #define MU_LOCKER_FCNTL 2
48 #define MU_LOCKER_TIME 4
49
50 extern int locker_lock __P ((locker_t, int flag));
51 extern int locker_touchlock __P ((locker_t));
52 extern int locker_unlock __P ((locker_t));
53
54 #ifdef __cplusplus
55 }
56 #endif
57
58 #endif /* _MAILBOX_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MAILBOX_H
19 # define _MAILBOX_H
20
21 #include <sys/types.h>
22
23 #include <mailutils/url.h>
24 #include <mailutils/message.h>
25 #include <mailutils/attribute.h>
26 #include <mailutils/auth.h>
27 #include <mailutils/locker.h>
28 #include <mailutils/stream.h>
29
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #ifndef __P
36 # ifdef __STDC__
37 # define __P(args) args
38 # else
39 # define __P(args) ()
40 # endif
41 #endif /*__P */
42
43 /* forward declaration */
44 struct _mailbox;
45 typedef struct _mailbox *mailbox_t;
46
47 /* constructor/destructor and possible types */
48 extern int mailbox_create __P ((mailbox_t *, const char *, int id));
49 extern void mailbox_destroy __P ((mailbox_t *));
50
51 extern int mailbox_create_default __P ((mailbox_t *, const char *));
52
53 /* flags for mailbox_open () */
54 #define MU_MAILBOX_RDONLY MU_STREAM_READ
55 #define MU_MAILBOX_WRONLY MU_STREAM_WRITE
56 #define MU_MAILBOX_RDWR MU_STREAM_RDWR
57 #define MU_MAILBOX_APPEND MU_STREAM_APPEND
58 #define MU_MAILBOX_CREAT MU_STREAM_CREAT
59 #define MU_MAILBOX_NONBLOCK MU_STREAM_NONBLOCK
60
61 extern int mailbox_open __P ((mailbox_t, int flag));
62 extern int mailbox_close __P ((mailbox_t));
63
64 /* messages */
65 extern int mailbox_get_message __P ((mailbox_t, size_t msgno, message_t *msg));
66 extern int mailbox_append_message __P ((mailbox_t, message_t msg));
67 extern int mailbox_messages_count __P ((mailbox_t, size_t *num));
68 extern int mailbox_expunge __P ((mailbox_t));
69
70 /* stream settings */
71 extern int mailbox_get_stream __P ((mailbox_t, stream_t *pstream));
72 extern int mailbox_set_stream __P ((mailbox_t, stream_t stream));
73
74 /* Lock settings */
75 extern int mailbox_get_locker __P ((mailbox_t, locker_t *locker));
76 extern int mailbox_set_locker __P ((mailbox_t, locker_t locker));
77
78 /* Authentication */
79 extern int mailbox_get_auth __P ((mailbox_t, auth_t *auth));
80 extern int mailbox_set_auth __P ((mailbox_t, auth_t auth));
81
82 /* update and scanning*/
83 extern int mailbox_is_updated __P ((mailbox_t));
84 extern int mailbox_scan __P ((mailbox_t, size_t msgno, size_t *count));
85
86 /* mailbox size ? */
87 extern int mailbox_size __P ((mailbox_t, off_t *size));
88
89 extern int mailbox_get_url __P ((mailbox_t, url_t *));
90
91 /* events */
92 #define MU_EVT_MBX_DESTROY 1
93 #define MU_EVT_MBX_CORRUPTED 2
94 #define MU_EVT_MBX_MSG_ADD 4
95 #define MU_EVT_MBX_PROGRESS 8
96
97 extern int mailbox_register __P ((mailbox_t mbox, size_t type,
98 int (*action) (size_t type, void *arg),
99 void *arg));
100 extern int mailbox_deregister __P ((mailbox_t mbox, void *action));
101
102 /* trace */
103 #define MU_MAILBOX_DEBUG_TRACE 1
104 #define MU_MAILBOX_DEBUG_PROT 2
105 extern int mailbox_set_debug_level __P ((mailbox_t mbox, size_t level));
106 extern int mailbox_get_debug_level __P ((mailbox_t mbox, size_t *plevel));
107 extern int mailbox_set_debug_print __P ((mailbox_t mbox, int (*debug_print)
108 __P ((void *arg, const char *,
109 size_t)),
110 void *arg));
111
112
113 #ifdef __cplusplus
114 }
115 #endif
116
117 #endif /* _MAILBOX_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MAILER_H
19 #define _MAILER_H
20
21 #include <sys/types.h>
22 #include <mailutils/message.h>
23
24 #ifndef __P
25 # ifdef __STDC__
26 # define __P(args) args
27 # else
28 # define __P(args) ()
29 # endif
30 #endif /* __P */
31
32 #ifdef _cplusplus
33 extern "C" {
34 #endif
35
36 /* forward declaration */
37 struct _mailer;
38 typedef struct _mailer *mailer_t;
39
40 extern int mailer_create __P ((mailer_t *, message_t));
41 extern int mailer_destroy __P ((mailer_t *));
42 extern int mailer_connect __P ((mailer_t, char *host));
43 extern int mailer_disconnect __P ((mailer_t));
44 extern int mailer_send_header __P ((mailer_t, message_t));
45 extern int mailer_send_message __P ((mailer_t, message_t));
46
47 #ifdef _cplusplus
48 }
49 #endif
50
51 #endif /* _MAILER_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MESSAGE_H
19 #define _MESSAGE_H
20
21 #include <sys/types.h>
22 #include <mailutils/header.h>
23 #include <mailutils/body.h>
24 #include <mailutils/attribute.h>
25 #include <mailutils/stream.h>
26
27
28 #ifndef __P
29 # ifdef __STDC__
30 # define __P(args) args
31 # else
32 # define __P(args) ()
33 # endif
34 #endif /* __P */
35
36 #ifdef _cplusplus
37 extern "C" {
38 #endif
39
40 /* forward declaration */
41 struct _message;
42 typedef struct _message *message_t;
43
44 /* A message is considered to be a container for:
45 * header_t, body_t, and its attribute_t.
46 */
47
48 extern int message_create __P ((message_t *, void *owner));
49 extern void message_destroy __P ((message_t *, void *owner));
50
51 extern int message_get_header __P ((message_t, header_t *));
52 extern int message_set_header __P ((message_t, header_t, void *owner));
53
54 extern int message_get_body __P ((message_t, body_t *));
55 extern int message_set_body __P ((message_t, body_t, void *owner));
56
57 extern int message_get_stream __P ((message_t, stream_t *));
58
59 extern int message_is_mime __P ((message_t));
60
61 extern int message_size __P ((message_t, size_t *));
62 extern int message_lines __P ((message_t, size_t *));
63
64 extern int message_from __P ((message_t, char *, size_t, size_t *));
65 extern int message_set_from __P ((message_t,
66 int (*_from) __P ((message_t, char *,
67 size_t, size_t *)),
68 void *owner));
69 extern int message_received __P ((message_t, char *, size_t, size_t *));
70 extern int message_set_received __P ((message_t, int (*_received)
71 __P ((message_t, char *, size_t,
72 size_t *)), void *owner));
73
74 extern int message_get_attribute __P ((message_t, attribute_t *));
75 extern int message_set_attribute __P ((message_t, attribute_t, void *owner));
76
77 extern int message_get_num_parts __P ((message_t, size_t *nparts));
78 extern int message_set_get_num_parts __P ((message_t, int (*_getNum_parts)
79 __P ((message_t, size_t *)),
80 void *owner));
81
82 extern int message_get_part __P ((message_t, size_t part, message_t *msg));
83 extern int message_set_get_part __P ((message_t, int (*_get_part)
84 __P ((message_t, size_t, message_t *)),
85 void *owner));
86
87 extern int message_get_uidl __P ((message_t, char *buffer, size_t, size_t *));
88 extern int message_set_uidl __P ((message_t, int (*_get_uidl)
89 __P ((message_t, char *, size_t, size_t *)),
90 void *owner));
91
92 /* events */
93 #define MU_EVT_MSG_DESTROY 32
94 extern int message_register __P ((message_t msg, size_t type, int (*action)
95 __P ((size_t typ, void *arg)), void *arg));
96 extern int message_deregister __P ((message_t msg, void *action));
97
98 /* misc functions */
99 extern int message_create_attachment __P ((const char *content_type,
100 const char *encoding,
101 const char *filename,
102 message_t *newmsg));
103 extern int message_save_attachment __P ((message_t msg,
104 const char *filename, void **data));
105 extern int message_encapsulate __P ((message_t msg, message_t *newmsg,
106 void **data));
107 extern int message_unencapsulate __P ((message_t msg, message_t *newmsg,
108 void **data));
109
110 #ifdef _cplusplus
111 }
112 #endif
113
114 #endif /* _MESSAGE_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MIME_H
19 #define _MIME_H
20
21 #include <sys/types.h>
22 #include <mailutils/header.h>
23 #include <mailutils/stream.h>
24
25 #ifndef __P
26 # ifdef __STDC__
27 # define __P(args) args
28 # else
29 # define __P(args) ()
30 # endif
31 #endif /* __P */
32
33 /* mime flags */
34 #define MIME_INCREAMENTAL_PARSER 0x00000001
35
36 #ifdef _cplusplus
37 extern "C" {
38 #endif
39
40 /* forward declaration */
41 struct _mime;
42 typedef struct _mime *mime_t;
43
44 int mime_create __P ((mime_t *pmime, message_t msg, int flags));
45 void mime_destroy __P ((mime_t *pmime));
46 int mime_is_multipart __P ((mime_t mime));
47 int mime_get_num_parts __P ((mime_t mime, int *nparts));
48
49 int mime_get_part __P ((mime_t mime, int part, message_t *msg));
50
51 int mime_add_part __P ((mime_t mime, message_t msg));
52
53 int mime_get_message __P ((mime_t mime, message_t *msg));
54
55 #ifdef _cplusplus
56 }
57 #endif
58
59 #endif /* _MIME_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _REGISTRAR_H
19 #define _REGISTRAR_H
20
21 #include <sys/types.h>
22
23 #include <mailutils/url.h>
24 #include <mailutils/mailbox.h>
25
26 #ifndef __P
27 # ifdef __STDC__
28 # define __P(args) args
29 # else
30 # define __P(args) ()
31 # endif
32 #endif /*__P */
33
34 #ifdef _cplusplus
35 extern "C" {
36 #endif
37
38 struct url_registrar
39 {
40 const char *scheme;
41 int (*_create) __P ((url_t *, const char * name));
42 void (*_destroy) __P ((url_t *));
43 };
44
45 struct mailbox_registrar
46 {
47 const char *name;
48 int (*_create) __P ((mailbox_t *, const char *name));
49 void (*_destroy) __P ((mailbox_t *));
50 };
51
52 struct _registrar;
53
54 typedef struct _registrar* registrar_t;
55
56 /* mailbox registration */
57 extern int registrar_add __P ((struct url_registrar *ureg,
58 struct mailbox_registrar *mreg, int *id));
59 extern int registrar_remove __P ((int id));
60 extern int registrar_get __P ((int id, struct url_registrar **ureg,
61 struct mailbox_registrar **mreg));
62 extern int registrar_num __P ((size_t *num));
63 extern int registrar_get_entry __P ((size_t num, struct url_registrar **ureg,
64 struct mailbox_registrar **mreg,
65 int *id));
66 extern int registrar_list __P ((struct url_registrar **ureg,
67 struct mailbox_registrar **mreg,
68 int *id, registrar_t *reg));
69 #ifdef _cplusplus
70 }
71 #endif
72
73 #endif /* _REGISTRAR_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _STREAM_H
19 # define _STREAM_H
20
21 #include <sys/types.h>
22
23 #ifdef __cplusplus
24 extern "C" { /*}*/
25 #endif
26
27 #ifndef __P
28 # ifdef __STDC__
29 # define __P(args) args
30 # else
31 # define __P(args) ()
32 # endif
33 #endif /*__P */
34
35 struct _stream;
36 typedef struct _stream *stream_t;
37
38 #define MU_STREAM_READ 0x00000001
39 #define MU_STREAM_WRITE 0x00000002
40 #define MU_STREAM_RDWR 0x00000004
41 #define MU_STREAM_APPEND 0x00000008
42 #define MU_STREAM_CREAT 0x00000010
43 #define MU_STREAM_NONBLOCK 0x00000020
44 /* stream will be destroy on stream_destroy */
45 #define MU_STREAM_NO_CHECK 0x00000040
46
47 extern int stream_create __P ((stream_t *, int flags, void *owner));
48
49 extern void stream_destroy __P ((stream_t *, void *owner));
50 extern int stream_set_destroy __P ((stream_t, void (*_destroy)
51 __P ((stream_t)), void *owner));
52
53 extern int stream_open __P ((stream_t, const char *, int, int));
54 extern int stream_set_open __P ((stream_t, int (*_open)
55 __P ((stream_t, const char *, int, int)),
56 void *owner));
57
58 extern int stream_close __P ((stream_t));
59 extern int stream_set_close __P ((stream_t, int (*_close) __P ((stream_t)),
60 void *owner));
61
62 extern int stream_get_fd __P ((stream_t , int *));
63 extern int stream_set_fd __P ((stream_t, int (*_get_fd)(stream_t, int *),
64 void *owner));
65
66 extern int stream_read __P ((stream_t, char *, size_t,
67 off_t, size_t *));
68 extern int stream_set_read __P ((stream_t, int (*_read)
69 __P ((stream_t, char *, size_t,
70 off_t, size_t *)),
71 void *owner));
72
73 extern int stream_readline __P ((stream_t, char *, size_t,
74 off_t, size_t *));
75 extern int stream_set_readline __P ((stream_t, int (*_readline)
76 __P ((stream_t, char *, size_t,
77 off_t, size_t *)),
78 void *owner));
79
80 extern int stream_size __P ((stream_t, off_t *));
81 extern int stream_set_size __P ((stream_t, int (*_size)
82 __P ((stream_t, off_t *)), void *owner));
83
84 extern int stream_truncate __P ((stream_t, off_t));
85 extern int stream_set_truncate __P ((stream_t, int (*_truncate)
86 __P ((stream_t, off_t)), void *owner));
87
88 extern int stream_write __P ((stream_t, const char *, size_t,
89 off_t, size_t *));
90 extern int stream_set_write __P ((stream_t, int (*_write)
91 __P ((stream_t, const char *,
92 size_t, off_t, size_t *)),
93 void *owner));
94
95 extern int stream_flush __P ((stream_t));
96 extern int stream_set_flush __P ((stream_t, int (*_flush)
97 __P ((stream_t)), void *owner));
98
99 extern int stream_get_flags __P ((stream_t, int *pflags));
100 extern int stream_set_flags __P ((stream_t, int flags, void *owner));
101
102 #define MU_STREAM_STATE_OPEN 1
103 #define MU_STREAM_STATE_READ 2
104 #define MU_STREAM_STATE_WRITE 4
105 #define MU_STREAM_STATE_CLOSE 8
106 extern int stream_get_state __P ((stream_t, int *pstate));
107
108 /* misc */
109 extern int file_stream_create __P ((stream_t *stream));
110 extern int mapfile_stream_create __P ((stream_t *stream));
111 extern int encoder_stream_create __P ((stream_t *stream, stream_t iostream,
112 const char *encoding));
113 extern int decoder_stream_create __P ((stream_t *stream, stream_t iostream,
114 const char *encoding));
115 extern int tcp_stream_create __P ((stream_t *stream));
116
117 #ifdef __cplusplus
118 }
119 #endif
120
121 #endif /* _STREAM_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _TRANSCODE_H
19 #define _TRANSCODE_H
20
21 #include <sys/types.h>
22
23 #ifndef __P
24 # ifdef __STDC__
25 # define __P(args) args
26 # else
27 # define __P(args) ()
28 # endif
29 #endif /* __P */
30
31 #ifdef _cplusplus
32 extern "C" {
33 #endif
34
35 /* forward declaration */
36 struct _transcoder;
37 typedef struct _transcoder *transcoder_t;
38
39 struct _transcoder
40 {
41 stream_t ustream; /* user reads/writes decoded/encoded data from here */
42 stream_t stream; /* encoder/decoder read/writes data to here */
43 void (*destroy)(transcoder_t tc);
44 void *tcdata;
45 };
46
47 extern int transcode_create __P ((transcoder_t *, char *encoding));
48 extern void transcode_destroy __P ((transcoder_t *));
49 extern int transcode_get_stream __P ((transcoder_t tc, stream_t *pis));
50 extern int transcode_set_stream __P ((transcoder_t tc, stream_t is));
51
52 #ifdef _cplusplus
53 }
54 #endif
55
56 #endif /* _TRANSCODE_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _URL_H
19 #define _URL_H 1
20
21 #include <sys/types.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifndef __P
28 # if __STDC__
29 # define __P(args) args
30 # else
31 # define __P(args) ()
32 # endif
33 #endif /*!__P */
34
35 /* forward declaration */
36 struct _url;
37 typedef struct _url * url_t;
38
39 extern int url_create __P ((url_t *, const char *name));
40 extern void url_destroy __P ((url_t *));
41
42 extern int url_get_id __P ((const url_t, int *id));
43
44 extern int url_get_scheme __P ((const url_t, char *sch,
45 size_t, size_t *));
46
47 extern int url_get_user __P ((const url_t, char *usr,
48 size_t, size_t *));
49
50 extern int url_get_passwd __P ((const url_t, char *passwd,
51 size_t, size_t *));
52
53 extern int url_get_host __P ((const url_t, char *host,
54 size_t, size_t *));
55
56 extern int url_get_port __P ((const url_t, long *port));
57
58 extern int url_get_path __P ((const url_t, char *path,
59 size_t, size_t *));
60
61 extern int url_get_query __P ((const url_t, char *qeury,
62 size_t, size_t *));
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68 #endif /* URL_H */
1 noinst_LIBRARIES = libmailutils.a 1 noinst_LIBRARIES = libmailutils.a
2 2
3 libmailutils_a_SOURCES = getopt.c getopt1.c md5.c getline.c xstrdup.c \ 3 libmailutils_a_SOURCES = getopt.c getopt1.c md5.c getline.c snprintf.c \
4 xstrtol.c xmalloc.c 4 xstrdup.c xstrtol.c xmalloc.c
5 5
6 noinst_HEADERS = getopt.h md5.h getline.h xstrtol.h xalloc.h 6 noinst_HEADERS = getopt.h md5.h getline.h snprintf.h xstrtol.h xalloc.h
7 7
8 CFLAGS = -Wall -pedantic -g -DTESTING 8 CFLAGS = -Wall -pedantic -g -DTESTING
......
1 CFLAGS = -Wall -pedantic -g -DTESTING 1 CFLAGS = -Wall -pedantic -g -DTESTING
2 INCLUDES = -I$(top_srcdir)/libmailbox -I$(top_srcdir)/lib 2 INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib
3 3
4 bin_PROGRAMS = mail 4 bin_PROGRAMS = mail
5 5
6 mail_DEPENDENCIES = ../libmailbox/libmailbox.la 6 mail_DEPENDENCIES = ../mailbox/libmailbox.la
7 mail_LDADD = ../libmailbox/libmailbox.la ../lib/libmailutils.a 7 mail_LDADD = ../mailbox/libmailbox.la ../lib/libmailutils.a
......
1 /* GNU mailutils - a suite of utilities for electronic mail 1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -20,19 +20,24 @@ ...@@ -20,19 +20,24 @@
20 #endif 20 #endif
21 21
22 #include <errno.h> 22 #include <errno.h>
23 #include <mailbox.h>
24 #include <stdio.h> 23 #include <stdio.h>
25 #include <stdlib.h> 24 #include <stdlib.h>
26 #include <unistd.h> 25 #include <unistd.h>
27 #include <string.h> 26 #include <string.h>
28 #include <getopt.h> 27 #include <getopt.h>
29 28
29 #include <mailutils/mailbox.h>
30
30 #ifdef HAVE_PATHS_H 31 #ifdef HAVE_PATHS_H
31 #include <paths.h> 32 # include <paths.h>
32 #endif 33 #endif
33 34
34 #ifndef _PATH_MAILDIR 35 #ifndef _PATH_MAILDIR
35 #define _PATH_MAILDIR "/var/spool/mail" 36 # define _PATH_MAILDIR "/var/spool/mail"
37 #endif
38
39 #ifndef VERSION
40 # define VERSION "0.0"
36 #endif 41 #endif
37 42
38 static struct option long_options[] = 43 static struct option long_options[] =
...@@ -45,15 +50,26 @@ static struct option long_options[] = ...@@ -45,15 +50,26 @@ static struct option long_options[] =
45 int 50 int
46 main (int argc, char **argv) 51 main (int argc, char **argv)
47 { 52 {
48 char *foo, bar[80]; 53 char bar[80];
49 int i = 0; 54 char buf[128];
50 char c = 0; 55 char foo[80];
51 char *mboxname = 0; 56 mailbox_t mbox;
52 mailbox *mbox = 0; 57 message_t msg;
58 header_t hdr;
59 body_t body;
60 attribute_t attr;
61 stream_t os;
62 int c;
63 char *mboxname = NULL;
64 size_t count = 0;
65 int status;
66 int num = 0;
67 size_t n;
53 68
54 i = getopt_long (argc, argv, "hv", long_options, (int *)0);
55 69
56 switch (i) 70 c = getopt_long (argc, argv, "hv", long_options, (int *)0);
71
72 switch (c)
57 { 73 {
58 case 'v': 74 case 'v':
59 printf("mail (GNU mailutils) %s\n", VERSION); 75 printf("mail (GNU mailutils) %s\n", VERSION);
...@@ -74,25 +90,20 @@ Report bugs to <bug-mailutils@gnu.org>.\n"); ...@@ -74,25 +90,20 @@ Report bugs to <bug-mailutils@gnu.org>.\n");
74 break; 90 break;
75 } 91 }
76 92
93 if (argc > 1)
94 mboxname = argv[1];
77 95
78 96 if ((status = mailbox_create_default (&mbox, mboxname)) != 0 ||
79 mboxname = getenv ("MAIL"); 97 (status = mailbox_open (mbox, MU_MAILBOX_RDWR)) != 0)
80 if (mboxname == NULL)
81 { 98 {
82 foo = getenv ("LOGNAME"); 99 fprintf (stderr, "Ack, %s, reading %s\n", strerror (status), mboxname);
83 mboxname = malloc ((strlen(foo) + strlen(_PATH_MAILDIR) + 2) * sizeof(char));
84 strcpy (mboxname, _PATH_MAILDIR "/");
85 strcat (mboxname, foo);
86 free (foo);
87 }
88
89 mbox = mbox_open (mboxname);
90 if (mbox == NULL)
91 {
92 fprintf (stderr, "Ack, %s, reading %s\n", strerror(errno), mboxname);
93 exit (1); 100 exit (1);
94 } 101 }
95 printf ("Number of messages: %d\n", mbox->messages); 102
103 mailbox_messages_count (mbox, &count);
104 printf ("Experimental Mail. Type ? for help\n");
105 printf ("Number of messages: %d\n", count);
106
96 while (1) 107 while (1)
97 { 108 {
98 printf ("& "); 109 printf ("& ");
...@@ -101,56 +112,166 @@ Report bugs to <bug-mailutils@gnu.org>.\n"); ...@@ -101,56 +112,166 @@ Report bugs to <bug-mailutils@gnu.org>.\n");
101 c = bar[0]; 112 c = bar[0];
102 if (c == 'd' || c == 'D' || c == 'b' || c == 'B' || c == 'h' || 113 if (c == 'd' || c == 'D' || c == 'b' || c == 'B' || c == 'h' ||
103 c == 'H' || c == 'r' || c == 'R' || c == 'f' || c == 'F' || 114 c == 'H' || c == 'r' || c == 'R' || c == 'f' || c == 'F' ||
104 c == 'T' || c == 't' ) 115 c == 'T' || c == 't' || c == 'p' || c == 'P')
116 {
117 if (sscanf (bar, "%80s %d\n", foo, &num) == 1)
105 { 118 {
106 printf ("# "); 119 printf ("# ");
107 fgets (bar, 80, stdin); 120 fgets (bar, 80, stdin);
121 num = atoi (bar);
122 }
108 } 123 }
109 switch (c) 124 switch (c)
110 { 125 {
111 case 'q': 126 case 'q':
112 case 'Q': 127 case 'Q':
113 mbox_close (mbox); 128 printf ("<<Quit>>\n");
129 mailbox_close (mbox);
114 return 0; 130 return 0;
115 break; 131 break;
116 case 'f': 132 case 'f':
117 case 'F': 133 case 'F':
118 foo = mbox_header_line (mbox, atoi (bar) - 1, "from"); 134 printf ("<<From %d>>\n", num);
119 printf ("%s\n", foo); 135 {
120 free (foo); 136 size_t i;
137 if (num == 0)
138 num = 1;
139 for (i = num; i <= count; i++)
140 {
141 if ((status = mailbox_get_message (mbox, i, &msg)) != 0 ||
142 (status = message_get_header (msg, &hdr)) != 0 ||
143 (status = header_get_value (hdr, "From", buf,
144 sizeof(buf), &n)) != 0)
145 {
146 fprintf (stderr, "msg %d: %s\n", i, strerror (status));
147 break;
148 }
149 else
150 printf ("%d From: %s\n", i, buf);
151 if ((i % 10) == 0)
152 {
153 char tmp[16];
154 *tmp = '\0';
155 printf ("\nHit (q|Q)uit to break\n");
156 fgets (tmp, sizeof(tmp), stdin);
157 if (*tmp == 'q' || *tmp == 'Q')
158 break;
159 }
160 }
161 }
121 break; 162 break;
122 case 'r': 163 case 'r':
123 case 'R': 164 case 'R':
124 foo = mbox_get_header (mbox, atoi (bar) - 1); 165 printf ("<<Reply %d>>\n", num);
125 printf ("%s\n", foo);
126 free (foo);
127 foo = mbox_get_body (mbox, atoi (bar) - 1);
128 printf ("%s", foo);
129 free (foo);
130 break; 166 break;
131 case 'h': 167 case 'h':
132 case 'H': 168 case 'H':
133 foo = mbox_get_header (mbox, atoi (bar) - 1); 169 printf ("<<Header %d>>\n", num);
134 printf ("%s", foo); 170 if ((status = mailbox_get_message (mbox, num, &msg)) != 0 ||
135 free (foo); 171 (status = message_get_header (msg, &hdr)) != 0 ||
172 (status = header_get_stream (hdr, &os)) != 0)
173 fprintf (stderr, "msg %d: %s\n", num, strerror (status));
174 else
175 {
176 off_t off = 0;
177 while (stream_read (os, buf, sizeof (buf) - 1,
178 off, &n) == 0 && n != 0)
179 {
180 buf[n] = '\0';
181 printf (buf);
182 off += n;
183 }
184 }
136 break; 185 break;
137 case 'b': 186 case 'b':
138 case 'B': 187 case 'B':
139 foo = mbox_get_body (mbox, atoi (bar) - 1); 188 printf ("<<Body %d>>\n", num);
140 printf ("%s", foo); 189 if ((status = mailbox_get_message (mbox, num, &msg)) != 0 ||
141 free (foo); 190 (status = message_get_body (msg, &body)) != 0 ||
191 (status = body_get_stream (body, &os)) != 0)
192 fprintf (stderr, "msg %d: %s\n", num, strerror (status));
193 else
194 {
195 off_t off = 0;
196 while (stream_read (os, buf, sizeof (buf) - 1,
197 off, &n) == 0 && n != 0)
198 {
199 buf[n] = '\0';
200 printf (buf);
201 off += n;
202 }
203 }
142 break; 204 break;
143 case 'd': 205 case 'd':
144 case 'D': 206 case 'D':
145 mbox_delete (mbox, atoi (bar) - 1); 207 printf ("<<Delete %d>>\n", num);
208 if ((status = mailbox_get_message (mbox, num, &msg)) != 0 ||
209 (status = message_get_attribute (msg, &attr)) != 0)
210 fprintf (stderr, "msg %d: %s\n", num, strerror (status));
211 else
212 {
213 status = attribute_set_deleted (attr);
214 if (status != 0)
215 fprintf (stderr, "Delete %d: %s\n", num, strerror (status));
216 else
217 printf ("msg %d mark deleted\n", num);
218 }
219 break;
220 case 'u':
221 case 'U':
222 printf ("<<Undelete %d>>\n", num);
223 if ((status = mailbox_get_message (mbox, num, &msg)) != 0 ||
224 (status = message_get_attribute (msg, &attr)) != 0)
225 fprintf (stderr, "msg %d: %s\n", num, strerror (status));
226 else
227 {
228 status = attribute_unset_deleted (attr);
229 if (status != 0)
230 fprintf (stderr, "Undelete %d: %s\n", num, strerror (status));
231 else
232 printf ("msg %d unmark deleted\n", num);
233 }
146 break; 234 break;
147 case 'x': 235 case 'x':
148 case 'X': 236 case 'X':
149 mbox_expunge (mbox); 237 printf ("<<Expunge>>\n");
238 status = mailbox_expunge (mbox);
239 if (status != 0)
240 printf ("Expunging: %s\n", strerror (status));
241 mailbox_messages_count (mbox, &count);
242 printf ("Number of messages: %d\n", count);
243 break;
244 case 'p':
245 case 'P':
246 printf ("<<Print %d>>\n", num);
247 if ((status = mailbox_get_message (mbox, num, &msg)) != 0 ||
248 (status = message_get_stream (msg, &os)) != 0)
249 {
250 fprintf (stderr, "msg %d: %s\n", num, strerror (status));
251 break;
252 }
253 else
254 {
255 off_t off = 0;
256 while (stream_read (os, buf, sizeof (buf) - 1,
257 off, &n) == 0 && n != 0)
258 {
259 buf[n] = '\0';
260 printf (buf);
261 off += n;
262 }
263 }
150 break; 264 break;
151 case 't': 265 case '?':
152 case 'T': 266 printf ("\
153 mbox_tester (mbox, atoi (bar) - 1); 267 (d|D)elete num-msg\n\
268 (b|B)ody num-msg\n\
269 (f|F)rom num-msg\n\
270 (h|H)eader num-msg\n\
271 (p|P)rint num-msg\n\
272 (q|Q)uit num-msg\n\
273 (r|R)eply num-msg\n\
274 e(x|X)punge num-msg\n");
154 break; 275 break;
155 default: 276 default:
156 break; 277 break;
......
...@@ -2,16 +2,18 @@ ...@@ -2,16 +2,18 @@
2 2
3 AUTOMAKE_OPTIONS = ../lib/ansi2knr 3 AUTOMAKE_OPTIONS = ../lib/ansi2knr
4 4
5 INCLUDES = -I${srcdir}/include -I${srcdir}/include -I${srcdir}/lib 5 INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox/include -I${srcdir}/lib
6 CFLAGS = -Wall -pedantic -g -DTESTING 6 CFLAGS = -Wall -pedantic -g -DTESTING
7 7
8 SUBDIRS = include 8 SUBDIRS = include
9 9
10 lib_LTLIBRARIES = libmailbox.la 10 lib_LTLIBRARIES = libmailbox.la
11 11
12 EXTRA_DIST = mbx_unixscan.c
13
12 libmailbox_la_SOURCES = \ 14 libmailbox_la_SOURCES = \
13 _cpystr.c attachment.c attribute.c auth.c body.c file_stream.c \ 15 _cpystr.c attachment.c attribute.c auth.c body.c file_stream.c \
14 header.c io.c locker.c mailbox.c mailer.c mapfile_stream.c \ 16 header.c stream.c locker.c mailbox.c mailer.c mapfile_stream.c \
15 mbx_default.c mbx_imap.c mbx_mbox.c mbx_mdir.c mbx_mh.c mbx_mmdf.c \ 17 mbx_default.c mbx_imap.c mbx_mbox.c mbx_mdir.c mbx_mh.c mbx_mmdf.c \
16 mbx_pop.c mbx_unix.c message.c mime.c registrar.c tcp.c trans_stream.c \ 18 mbx_pop.c mbx_unix.c message.c mime.c registrar.c tcp.c trans_stream.c \
17 url.c url_file.c url_imap.c url_mail.c url_mbox.c url_mdir.c \ 19 url.c url_file.c url_imap.c url_mail.c url_mbox.c url_mdir.c \
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <message.h>
19 #include <io.h>
20
21 #include <errno.h> 18 #include <errno.h>
22 #include <stdio.h> 19 #include <stdio.h>
23 #include <stdlib.h> 20 #include <stdlib.h>
24 #include <string.h> 21 #include <string.h>
25 22
23 #include <mailutils/message.h>
24 #include <mailutils/stream.h>
25
26 #define MAX_HDR_LEN 256 26 #define MAX_HDR_LEN 256
27 #define BUF_SIZE 2048 27 #define BUF_SIZE 2048
28 28
......
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <attribute0.h>
19
20 #include <sys/types.h> 18 #include <sys/types.h>
21 #include <stdlib.h> 19 #include <stdlib.h>
22 #include <string.h> 20 #include <string.h>
23 #include <errno.h> 21 #include <errno.h>
24 22
23 #include <attribute0.h>
24
25 int 25 int
26 attribute_create (attribute_t *pattr, void *owner) 26 attribute_create (attribute_t *pattr, void *owner)
27 { 27 {
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <auth0.h>
19 #include <cpystr.h>
20
21 #include <errno.h> 18 #include <errno.h>
22 #include <sys/types.h> 19 #include <sys/types.h>
23 #include <string.h> 20 #include <string.h>
24 #include <stdlib.h> 21 #include <stdlib.h>
25 22
23 #include <auth0.h>
24 #include <cpystr.h>
25
26 int 26 int
27 auth_create (auth_t *pauth, void *owner) 27 auth_create (auth_t *pauth, void *owner)
28 { 28 {
......
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18
19 #include <body0.h>
20 #include <io0.h>
21
22 #include <errno.h> 18 #include <errno.h>
23 #include <stdio.h> 19 #include <stdio.h>
24 #include <stdlib.h> 20 #include <stdlib.h>
25 #include <sys/types.h> 21 #include <sys/types.h>
26 #include <sys/stat.h> 22 #include <sys/stat.h>
27 23
24 #include <body0.h>
25 #include <stream0.h>
26
27
28 static int body_read (stream_t is, char *buf, size_t buflen, 28 static int body_read (stream_t is, char *buf, size_t buflen,
29 off_t off, size_t *pnread ); 29 off_t off, size_t *pnread );
30 static int body_write (stream_t os, const char *buf, size_t buflen, 30 static int body_write (stream_t os, const char *buf, size_t buflen,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
26 #include <fcntl.h> 26 #include <fcntl.h>
27 #include <unistd.h> 27 #include <unistd.h>
28 28
29 #include <io0.h> 29 #include <stream0.h>
30 30
31 struct _file_stream 31 struct _file_stream
32 { 32 {
......
...@@ -19,14 +19,14 @@ ...@@ -19,14 +19,14 @@
19 #ifdef HAVE_CONFIG_H 19 #ifdef HAVE_CONFIG_H
20 # include "config.h" 20 # include "config.h"
21 #endif 21 #endif
22
23 #include <header0.h>
24 #include <io0.h>
25 #include <string.h> 22 #include <string.h>
26 #include <stdlib.h> 23 #include <stdlib.h>
27 #include <stdio.h> 24 #include <stdio.h>
28 #include <errno.h> 25 #include <errno.h>
29 26
27 #include <header0.h>
28 #include <stream0.h>
29
30 static int header_parse (header_t h, const char *blurb, int len); 30 static int header_parse (header_t h, const char *blurb, int len);
31 static int header_read (stream_t is, char *buf, size_t buflen, 31 static int header_read (stream_t is, char *buf, size_t buflen,
32 off_t off, size_t *pnread); 32 off_t off, size_t *pnread);
......
1 SUBDIR = private public 1 noinst_HEADERS = \
2 attribute0.h auth0.h body0.h cpystr.h header0.h mailbox0.h mailer0.h \
3 mbx_imap.h mbx_mbox.h mbx_mdir.h mbx_mmdf.h mbx_pop.h mbx_unix.h \
4 message0.h mime0.h registrar0.h stream0.h tcp0.h url0.h
......
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _ATTRIBUTE0_H
19 # define _ATTRIBUTE0_H
20
21 #include <mailutils/attribute.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifndef __P
28 # ifdef __STDC__
29 # define __P(args) args
30 # else
31 # define __P(args) ()
32 # endif
33 #endif /*__P */
34
35 struct _attribute
36 {
37 void *owner;
38 int flags;
39 int (*_get_flags) __P ((attribute_t, int *));
40 int (*_set_flags) __P ((attribute_t, int));
41 int (*_unset_flags) __P ((attribute_t, int));
42 };
43
44 #ifdef __cplusplus
45 }
46 #endif
47
48 #endif /* _ATTRIBUTE0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _AUTH0_H
19 #define _AUTH0_H
20
21 #include <mailutils/auth.h>
22 #include <sys/types.h>
23
24 #ifndef __P
25 #ifdef __STDC__
26 #define __P(args) args
27 #else
28 #define __P(args) ()
29 #endif
30 #endif /*__P */
31
32 #ifdef _cplusplus
33 extern "C" {
34 #endif
35
36 struct _auth
37 {
38 void *owner;
39 int (*_prologue) (auth_t);
40 int (*_authenticate) (auth_t, char **user, char **passwd);
41 int (*_epilogue) (auth_t);
42 };
43
44
45 #ifdef _cplusplus
46 }
47 #endif
48
49 #endif /* _AUTH0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _BODY0_H
19 #define _BODY0_H
20
21 #include <mailutils/stream.h>
22 #include <mailutils/body.h>
23
24 #include <stdio.h>
25 #include <sys/types.h>
26
27 #ifndef __P
28 # ifdef __STDC__
29 # define __P(args) args
30 # else
31 # define __P(args) ()
32 # endif
33 #endif /* __P */
34
35 #ifdef _cplusplus
36 extern "C" {
37 #endif
38
39 struct _body
40 {
41 void *owner;
42
43 /* it's better and more portable to use stdio */
44 FILE *file;
45 char *filename;
46 stream_t stream;
47 int (*_size) (body_t, size_t*);
48 int (*_lines) (body_t, size_t*);
49 };
50
51 #ifdef _cplusplus
52 }
53 #endif
54
55 #endif /* _BODY0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _CPYSTR_H
19 #define _CPYSTR_H
20
21 #include <sys/types.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifndef __P
28 # if __STDC__
29 # define __P(x) x
30 # else
31 # define __P(x)
32 # endif
33 #endif
34 extern size_t _cpystr __P ((char *dst, const char *src, size_t size));
35
36 #ifdef __cplusplus
37 }
38 #endif
39
40 #endif
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _HEADER0_H
19 #define _HEADER0_H
20
21 #include <mailutils/header.h>
22 #include <stream0.h>
23 #include <sys/types.h>
24
25 #ifdef _cplusplus
26 extern "C" {
27 #endif
28
29 #ifndef __P
30 # ifdef __STDC__
31 # define __P(args) args
32 # else
33 # define __P(args) ()
34 # endif
35 #endif /*__P */
36
37 /* The structure members are offset that point to the begin/end of header
38 fields. */
39 struct _hdr
40 {
41 char *fn;
42 char *fn_end;
43 char *fv;
44 char *fv_end;
45 };
46
47 /* The blurb member represents the headers, hdr_count the number of distinct
48 header field and the layout is done by struct_hdr *hdr. */
49 struct _header
50 {
51 /* Owner. */
52 void *owner;
53 /* Data. */
54 char *temp_blurb;
55 size_t temp_blurb_len;
56 char *blurb;
57 size_t blurb_len;
58 size_t hdr_count;
59 struct _hdr *hdr;
60
61 /* Streams. */
62 stream_t stream;
63 int (*_get_value) __P ((header_t, const char *, char *, size_t , size_t *));
64 int (*_set_value) __P ((header_t, const char *, const char *, int));
65 };
66
67 #ifdef _cplusplus
68 }
69 #endif
70
71 #endif /* _HEADER0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MAILBOX0_H
19 #define _MAILBOX0_H
20
21 #include <mailutils/mailbox.h>
22 #include <mailutils/event.h>
23
24 #include <sys/types.h>
25 #include <stdio.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #ifndef __P
32 # ifdef __STDC__
33 # define __P(args) args
34 # else
35 # define __P(args) ()
36 # endif
37 #endif /*__P */
38
39 struct _mailbox
40 {
41 /* Data */
42 char *name;
43 auth_t auth;
44 locker_t locker;
45 stream_t stream;
46 url_t url;
47
48 /* register events */
49 event_t event;
50 size_t event_num;
51
52 /* debug information */
53 int debug_level;
54 void *debug_arg;
55 char *debug_buffer;
56 size_t debug_bufsize;
57 int (*debug_print) __P ((void *arg, const char *, size_t));
58
59 /* Back pointer to the specific mailbox */
60 void *data;
61
62 /* Public methods */
63
64 int (*_create) __P ((mailbox_t *, const char *));
65 void (*_destroy) __P ((mailbox_t *));
66
67 int (*_open) __P ((mailbox_t, int flag));
68 int (*_close) __P ((mailbox_t));
69
70 /* messages */
71 int (*_get_message) __P ((mailbox_t, size_t msgno, message_t *msg));
72 int (*_append_message) __P ((mailbox_t, message_t msg));
73 int (*_messages_count) __P ((mailbox_t, size_t *num));
74 int (*_expunge) __P ((mailbox_t));
75
76 int (*_scan) __P ((mailbox_t, size_t msgno, size_t *count));
77 int (*_is_updated) __P ((mailbox_t));
78
79 int (*_size) __P ((mailbox_t, off_t *size));
80
81 /* private */
82 int (*_num_deleted) __P ((mailbox_t, size_t *));
83 };
84
85 /* private */
86 extern int mailbox_num_deleted __P ((mailbox_t, size_t *));
87
88 extern int mailbox_notification __P ((mailbox_t mbox, size_t type));
89
90 extern int mailbox_debug __P ((mailbox_t, int level, const char *fmt, ...));
91
92 #ifdef __cplusplus
93 }
94 #endif
95
96 #endif /* _MAILBOX0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MAILER0_H
19 #define _MAILER0_H
20
21 #include <sys/types.h>
22 #include <mailutils/mailer.h>
23
24 #ifdef _cplusplus
25 extern "C" {
26 #endif
27
28 #ifndef __P
29 # ifdef __STDC__
30 # define __P(args) args
31 # else
32 # define __P(args) ()
33 # endif
34 #endif /*__P */
35
36 // mailer states
37 #define MAILER_STATE_HDR 1
38 #define MAILER_STATE_MSG 2
39 #define MAILER_STATE_COMPLETE 3
40
41 // mailer messages
42 #define MAILER_HELO 1
43 #define MAILER_MAIL 2
44 #define MAILER_RCPT 3
45 #define MAILER_DATA 4
46 #define MAILER_RSET 5
47 #define MAILER_QUIT 6
48
49 #define MAILER_LINE_BUF_SIZE 1000
50
51 struct _mailer
52 {
53 int socket;
54 char *hostname;
55 char line_buf[MAILER_LINE_BUF_SIZE];
56 int offset;
57 int state;
58 int add_dot;
59 stream_t stream;
60 char last_char;
61 };
62
63 #ifdef _cplusplus
64 }
65 #endif
66
67 #endif /* MAILER0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MBX_IMAP_H
19 #define _MBX_IMAP_H 1
20
21 #include <mailbox0.h>
22
23 extern int mailbox_imap_create __P ((mailbox_t *mbox, const char *name));
24 extern void mailbox_imap_destroy __P ((mailbox_t *mbox));
25
26 extern struct mailbox_type _mailbox_imap_type;
27
28 #endif /* _MBX_IMAP_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MBX_MBOX_H
19 #define _MBX_MBOX_H 1
20
21 #include <mailutils/mailbox.h>
22
23 extern int mailbox_mbox_create __P ((mailbox_t *mbox, const char *name));
24 extern void mailbox_mbox_destroy __P ((mailbox_t *mbox));
25
26 extern struct mailbox_type _mailbox_mbox_type;
27
28 #endif /* _MBX_MBOX_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MBX_MDIR_H
19 #define _MBX_MDIR_H 1
20
21 #include <mailbox0.h>
22
23 extern int mailbox_maildir_create __P ((mailbox_t *mbox, const char *name));
24 extern void mailbox_maildir_destroy __P ((mailbox_t *mbox));
25
26 extern struct mailbox_type _mailbox_maildir_type;
27
28 #endif /* _MBX_MDIR_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MBX_MMDF_H
19 #define _MBX_MMDF_H 1
20
21 #include <mailbox0.h>
22
23 extern int mailbox_mmdf_create __P ((mailbox_t *mbox, const char *name));
24 extern void mailbox_mmdf_destroy __P ((mailbox_t *mbox));
25
26 extern struct mailbox_type _mailbox_mmdf_type;
27
28 #endif /* _MBX_MMDF_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MBX_POP_H
19 #define _MBX_POP_H 1
20
21 #include <mailbox0.h>
22
23 extern int mailbox_pop_create __P ((mailbox_t *mbox, const char *name));
24 extern void mailbox_pop_destroy __P ((mailbox_t *mbox));
25
26 extern struct mailbox_type _mailbox_pop_type;
27
28 #endif /* _MBX_POP_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MBX_UNIX_H
19 #define _MBX_UNIX_H 1
20
21 #include <mailbox0.h>
22
23 #ifdef __cplucplus
24 extern "C" {
25 #endif
26
27 extern int mailbox_unix_create __P ((mailbox_t *mbox, const char *name));
28 extern void mailbox_unix_destroy __P ((mailbox_t *mbox));
29
30 extern struct mailbox_type _mailbox_unix_type;
31
32 #ifdef __cplucplus
33 }
34 #endif
35
36 #endif /* _MBX_UNIX_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MESSAGE0_H
19 #define _MESSAGE0_H
20
21 #include <mailutils/attribute.h>
22 #include <mailutils/header.h>
23 #include <mailutils/message.h>
24 #include <mailutils/mime.h>
25 #include <mailutils/mailbox.h>
26 #include <mailutils/event.h>
27
28 #include <sys/types.h>
29 #include <stdio.h>
30
31 #ifdef _cplusplus
32 extern "C" {
33 #endif
34
35 #ifndef __P
36 # ifdef __STDC__
37 # define __P(args) args
38 # else
39 # define __P(args) ()
40 # endif
41 #endif /*__P */
42
43 /* forward declaration */
44 struct _message
45 {
46 header_t header;
47 stream_t stream;
48 body_t body;
49 attribute_t attribute;
50 mime_t mime;
51
52 /* who is the owner */
53 void *owner;
54
55 event_t event;
56 size_t event_num;
57
58 /* for message_write */
59 char *hdr_buf;
60 size_t hdr_buflen;
61 int hdr_done;
62
63 int (*_from) __P ((message_t msg, char *, size_t, size_t *));
64 int (*_received) __P ((message_t msg, char *, size_t, size_t *));
65 int (*_get_uidl) __P ((message_t msg, char *, size_t, size_t *));
66 int (*_get_num_parts) __P ((message_t, size_t *nparts));
67 int (*_get_part) __P ((message_t, size_t part, message_t *msg));
68 };
69
70 #ifdef _cplusplus
71 }
72 #endif
73
74 extern void message_notification (message_t msg, size_t type);
75 #endif /* _MESSAGE_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _MIME0_H
19 #define _MIME0_H
20
21 #include <sys/types.h>
22 #include <mailutils/mime.h>
23
24 #ifndef __P
25 #ifdef __STDC__
26 #define __P(args) args
27 #else
28 #define __P(args) ()
29 #endif
30 #endif /*__P */
31
32 #ifdef _cplusplus
33 extern "C" {
34 #endif
35
36 #define MIME_MAX_HDR_LEN 256
37 #define MIME_DFLT_BUF_SIZE 2048
38
39 /* Parser states */
40 #define MIME_STATE_BEGIN_LINE 1
41 #define MIME_STATE_SCAN_BOUNDARY 2
42 #define MIME_STATE_HEADERS 3
43
44 #define MIME_FLAG_MASK 0x0000ffff
45
46 /* private */
47 #define MIME_PARSER_ACTIVE 0x80000000
48 #define MIME_PARSER_HAVE_CR 0x40000000
49 #define MIME_NEW_MESSAGE 0x20000000
50
51 struct _mime
52 {
53 message_t msg;
54 header_t hdrs;
55 stream_t stream;
56 int flags;
57 char *content_type;
58
59 int tparts;
60 int nmtp_parts;
61 struct _mime_part **mtp_parts; /* list of parts in the msg */
62
63 /* parser state */
64 char *boundary;
65 char *cur_line;
66 int line_ndx;
67 int cur_offset;
68 char *cur_buf;
69 int buf_size;
70 char *header_buf;
71 int header_buf_size;
72 int header_length;
73 int body_offset;
74 int body_length;
75 int parser_state;
76 };
77
78 struct _mime_part
79 {
80 char sig[4];
81 mime_t mime;
82 header_t hdr;
83 message_t msg;
84 int body_offset;
85 int body_len;
86 };
87
88 #ifdef _cplusplus
89 }
90 #endif
91
92 #endif /* MIME0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _REGISTRAR0_H
19 #define _REGISTRAR0_H
20
21 #include <mailutils/registrar.h>
22
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #ifndef __P
29 # ifdef __STDC__
30 # define __P(args) args
31 # else
32 # define __P(args) ()
33 # endif
34 #endif /*__P */
35
36 /*
37 Builtin mailbox types.
38 A circular list is use for the builtin.
39 Proper locking is not done when accessing the list.
40 FIXME: not thread-safe. */
41 struct _registrar
42 {
43 struct url_registrar *ureg;
44 struct mailbox_registrar *mreg;
45 int is_allocated;
46 struct _registrar *next;
47 };
48
49
50 /* This is function is obsolete use the registrar_entry_*() ones */
51 extern int registrar_list __P ((struct url_registrar **ureg,
52 struct mailbox_registrar **mreg,
53 int *id, registrar_t *reg));
54 extern int registrar_entry_count __P ((size_t *num));
55 extern int registrar_entry __P ((size_t num, struct url_registrar **ureg,
56 struct mailbox_registrar **mreg,
57 int *id));
58 /* IMAP */
59 extern struct mailbox_registrar _mailbox_imap_registrar;
60 extern struct url_registrar _url_imap_registrar;
61
62 /* FILE */
63 extern struct url_registrar _url_file_registrar;
64 /* MBOX */
65 extern struct mailbox_registrar _mailbox_mbox_registrar;
66 extern struct url_registrar _url_mbox_registrar;
67
68 /* MAILTO */
69 extern struct mailbox_registrar _mailbox_mailto_registrar;
70 extern struct url_registrar _url_mailto_registrar;
71
72 /* MDIR */
73 extern struct mailbox_registrar _mailbox_maildir_registrar;
74 extern struct url_registrar _url_maildir_registrar;
75
76 /* MMDF */
77 extern struct mailbox_registrar _mailbox_mmdf_registrar;
78 extern struct url_registrar _url_mmdf_registrar;
79
80 /* UNIX */
81 extern struct mailbox_registrar _mailbox_unix_registrar;
82 extern struct url_registrar _url_unix_registrar;
83
84 /* POP */
85 extern struct mailbox_registrar _mailbox_pop_registrar;
86 extern struct url_registrar _url_pop_registrar;
87
88 #ifdef __cplusplus
89 }
90 #endif
91
92 #endif /* _REGISTRAR0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Library Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _IO0_H
19 # define _IO0_H
20
21 #include <mailutils/stream.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifndef __P
28 # ifdef __STDC__
29 # define __P(args) args
30 # else
31 # define __P(args) ()
32 # endif
33 #endif /*__P */
34
35 struct _stream
36 {
37 void *owner;
38 int flags;
39 int state;
40 void (*_destroy) __P ((stream_t));
41 int (*_open) __P ((stream_t, const char *, int port, int flags));
42 int (*_close) __P ((stream_t));
43 int (*_get_fd) __P ((stream_t, int *));
44 int (*_read) __P ((stream_t, char *, size_t, off_t, size_t *));
45 int (*_readline) __P ((stream_t, char *, size_t, off_t, size_t *));
46 int (*_write) __P ((stream_t, const char *, size_t, off_t, size_t *));
47 int (*_truncate) __P ((stream_t, off_t));
48 int (*_size) __P ((stream_t, off_t *));
49 int (*_flush) __P ((stream_t));
50 };
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56 #endif /* _IO0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _TCP0_H
19 #define _TCP0_H
20
21 #define TCP_STATE_INIT 1
22 #define TCP_STATE_RESOLVE 2
23 #define TCP_STATE_RESOLVING 3
24 #define TCP_STATE_CONNECTING 4
25 #define TCP_STATE_CONNECTED 5
26
27 struct _tcp_instance {
28 int fd;
29 char *host;
30 int port;
31 int state;
32 unsigned long address;
33 };
34
35 #endif /* _TCP0_H */
1 /* GNU mailutils - a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifndef _URL0_H
19 #define _URL0_H 1
20
21 #include <mailutils/url.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifndef __P
28 # if __STDC__
29 # define __P(args) args
30 # else
31 # define __P(args) ()
32 # endif
33 #endif /*!__P */
34
35 struct _url
36 {
37 /* Data */
38 char *scheme;
39 char *user;
40 char *passwd; /* encoded ?? */
41 char *host;
42 long port;
43 char *path;
44 char *query;
45 int id;
46
47
48 void *data;
49
50 int (*_create) __P ((url_t *url, const char *name));
51 void (*_destroy) __P ((url_t *url));
52
53 /* Methods */
54 int (*_get_id) __P ((const url_t, int *id));
55
56 int (*_get_scheme) __P ((const url_t, char *scheme,
57 size_t len, size_t *n));
58
59 int (*_get_user) __P ((const url_t, char *user,
60 size_t len, size_t *n));
61
62 int (*_get_passwd) __P ((const url_t, char *passwd,
63 size_t len, size_t *n));
64
65 int (*_get_host) __P ((const url_t, char *host,
66 size_t len, size_t *n));
67
68 int (*_get_port) __P ((const url_t, long *port));
69
70 int (*_get_path) __P ((const url_t, char *path,
71 size_t len, size_t *n));
72
73 int (*_get_query) __P ((const url_t, char *query,
74 size_t len, size_t *n));
75 };
76
77
78 /* IMAP */
79
80 /* Mailto */
81
82 /* UNIX MBOX */
83
84 /* Maildir */
85
86 /* MMDF */
87
88 /* POP3 */
89
90 #define MU_POP_PORT 110
91
92 /* UNIX MBOX */
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif /* URL_H */
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <locker.h>
19 #include <errno.h> 18 #include <errno.h>
20 #include <sys/types.h> 19 #include <sys/types.h>
21 #include <stdlib.h> 20 #include <stdlib.h>
...@@ -29,6 +28,8 @@ ...@@ -29,6 +28,8 @@
29 #include <utime.h> 28 #include <utime.h>
30 #include <signal.h> 29 #include <signal.h>
31 30
31 #include <mailutils/locker.h>
32
32 #define LOCKFILE_ATTR 0444 33 #define LOCKFILE_ATTR 0444
33 #define LOCK_EXPIRE_TIME (5 * 60) 34 #define LOCK_EXPIRE_TIME (5 * 60)
34 35
......
...@@ -19,18 +19,17 @@ ...@@ -19,18 +19,17 @@
19 #include <config.h> 19 #include <config.h>
20 #endif 20 #endif
21 21
22 #include <mailbox0.h>
23 #include <message0.h>
24 #include <registrar.h>
25 #include <locker.h>
26 #include <mailutils_errno.h>
27
28 #include <stdio.h> 22 #include <stdio.h>
29 #include <stdlib.h> 23 #include <stdlib.h>
30 #include <string.h> 24 #include <string.h>
31 #include <stdarg.h> 25 #include <stdarg.h>
32 #include <errno.h> 26 #include <errno.h>
33 27
28 #include <mailbox0.h>
29 #include <message0.h>
30 #include <mailutils/registrar.h>
31 #include <mailutils/locker.h>
32
34 /* 33 /*
35 * Point of entry. 34 * Point of entry.
36 * Simple, first check if they ask for something specific; with the ID. 35 * Simple, first check if they ask for something specific; with the ID.
...@@ -40,7 +39,7 @@ ...@@ -40,7 +39,7 @@
40 int 39 int
41 mailbox_create (mailbox_t *pmbox, const char *name, int id) 40 mailbox_create (mailbox_t *pmbox, const char *name, int id)
42 { 41 {
43 int status = MU_ERROR_INVALID_ARG; 42 int status = EINVAL;
44 struct mailbox_registrar *mreg; 43 struct mailbox_registrar *mreg;
45 url_t url = NULL; 44 url_t url = NULL;
46 45
...@@ -83,7 +82,7 @@ int ...@@ -83,7 +82,7 @@ int
83 mailbox_open (mailbox_t mbox, int flag) 82 mailbox_open (mailbox_t mbox, int flag)
84 { 83 {
85 if (mbox == NULL || mbox->_open == NULL) 84 if (mbox == NULL || mbox->_open == NULL)
86 return MU_ERROR_NOT_IMPLEMENTED; 85 return ENOSYS;
87 return mbox->_open (mbox, flag); 86 return mbox->_open (mbox, flag);
88 } 87 }
89 88
...@@ -91,7 +90,7 @@ int ...@@ -91,7 +90,7 @@ int
91 mailbox_close (mailbox_t mbox) 90 mailbox_close (mailbox_t mbox)
92 { 91 {
93 if (mbox == NULL || mbox->_close == NULL) 92 if (mbox == NULL || mbox->_close == NULL)
94 return MU_ERROR_NOT_IMPLEMENTED; 93 return ENOSYS;
95 return mbox->_close (mbox); 94 return mbox->_close (mbox);
96 } 95 }
97 96
...@@ -100,7 +99,7 @@ int ...@@ -100,7 +99,7 @@ int
100 mailbox_append_message (mailbox_t mbox, message_t msg) 99 mailbox_append_message (mailbox_t mbox, message_t msg)
101 { 100 {
102 if (mbox == NULL || mbox->_append_message == NULL) 101 if (mbox == NULL || mbox->_append_message == NULL)
103 return MU_ERROR_NOT_IMPLEMENTED; 102 return ENOSYS;
104 return mbox->_append_message (mbox, msg); 103 return mbox->_append_message (mbox, msg);
105 } 104 }
106 105
...@@ -108,7 +107,7 @@ int ...@@ -108,7 +107,7 @@ int
108 mailbox_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) 107 mailbox_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg)
109 { 108 {
110 if (mbox == NULL || mbox->_get_message == NULL) 109 if (mbox == NULL || mbox->_get_message == NULL)
111 return MU_ERROR_INVALID_ARG; 110 return ENOSYS;
112 return mbox->_get_message (mbox, msgno, pmsg); 111 return mbox->_get_message (mbox, msgno, pmsg);
113 } 112 }
114 113
...@@ -116,7 +115,7 @@ int ...@@ -116,7 +115,7 @@ int
116 mailbox_messages_count (mailbox_t mbox, size_t *num) 115 mailbox_messages_count (mailbox_t mbox, size_t *num)
117 { 116 {
118 if (mbox == NULL || mbox->_messages_count == NULL) 117 if (mbox == NULL || mbox->_messages_count == NULL)
119 return MU_ERROR_NOT_IMPLEMENTED; 118 return ENOSYS;
120 return mbox->_messages_count (mbox, num); 119 return mbox->_messages_count (mbox, num);
121 } 120 }
122 121
...@@ -124,7 +123,7 @@ int ...@@ -124,7 +123,7 @@ int
124 mailbox_expunge (mailbox_t mbox) 123 mailbox_expunge (mailbox_t mbox)
125 { 124 {
126 if (mbox == NULL || mbox->_expunge == NULL) 125 if (mbox == NULL || mbox->_expunge == NULL)
127 return MU_ERROR_NOT_IMPLEMENTED; 126 return ENOSYS;
128 return mbox->_expunge (mbox); 127 return mbox->_expunge (mbox);
129 } 128 }
130 129
...@@ -132,7 +131,7 @@ int ...@@ -132,7 +131,7 @@ int
132 mailbox_num_deleted (mailbox_t mbox, size_t *num) 131 mailbox_num_deleted (mailbox_t mbox, size_t *num)
133 { 132 {
134 if (mbox == NULL || mbox->_num_deleted == NULL) 133 if (mbox == NULL || mbox->_num_deleted == NULL)
135 return MU_ERROR_INVALID_ARG; 134 return ENOSYS;
136 return mbox->_num_deleted (mbox, num); 135 return mbox->_num_deleted (mbox, num);
137 } 136 }
138 137
...@@ -157,7 +156,7 @@ int ...@@ -157,7 +156,7 @@ int
157 mailbox_set_locker (mailbox_t mbox, locker_t locker) 156 mailbox_set_locker (mailbox_t mbox, locker_t locker)
158 { 157 {
159 if (mbox == NULL) 158 if (mbox == NULL)
160 return MU_ERROR_INVALID_ARG; 159 return EINVAL;
161 if (mbox->locker != NULL) 160 if (mbox->locker != NULL)
162 locker_destroy (&mbox->locker); 161 locker_destroy (&mbox->locker);
163 mbox->locker = locker; 162 mbox->locker = locker;
...@@ -168,7 +167,7 @@ int ...@@ -168,7 +167,7 @@ int
168 mailbox_get_locker (mailbox_t mbox, locker_t *plocker) 167 mailbox_get_locker (mailbox_t mbox, locker_t *plocker)
169 { 168 {
170 if (mbox == NULL || plocker == NULL) 169 if (mbox == NULL || plocker == NULL)
171 return MU_ERROR_INVALID_ARG; 170 return EINVAL;
172 if (plocker) 171 if (plocker)
173 *plocker = mbox->locker; 172 *plocker = mbox->locker;
174 return 0; 173 return 0;
...@@ -178,7 +177,7 @@ int ...@@ -178,7 +177,7 @@ int
178 mailbox_set_auth (mailbox_t mbox, auth_t auth) 177 mailbox_set_auth (mailbox_t mbox, auth_t auth)
179 { 178 {
180 if (mbox == NULL) 179 if (mbox == NULL)
181 return MU_ERROR_INVALID_ARG; 180 return EINVAL;
182 mbox->auth = auth; 181 mbox->auth = auth;
183 return 0; 182 return 0;
184 } 183 }
...@@ -187,7 +186,7 @@ int ...@@ -187,7 +186,7 @@ int
187 mailbox_get_auth (mailbox_t mbox, auth_t *pauth) 186 mailbox_get_auth (mailbox_t mbox, auth_t *pauth)
188 { 187 {
189 if (mbox == NULL || pauth == NULL) 188 if (mbox == NULL || pauth == NULL)
190 return MU_ERROR_INVALID_ARG; 189 return EINVAL;
191 if (pauth) 190 if (pauth)
192 *pauth = mbox->auth; 191 *pauth = mbox->auth;
193 return 0; 192 return 0;
...@@ -197,7 +196,7 @@ int ...@@ -197,7 +196,7 @@ int
197 mailbox_set_stream (mailbox_t mbox, stream_t stream) 196 mailbox_set_stream (mailbox_t mbox, stream_t stream)
198 { 197 {
199 if (mbox == NULL) 198 if (mbox == NULL)
200 return MU_ERROR_INVALID_ARG; 199 return EINVAL;
201 mbox->stream = stream; 200 mbox->stream = stream;
202 return 0; 201 return 0;
203 } 202 }
...@@ -206,7 +205,7 @@ int ...@@ -206,7 +205,7 @@ int
206 mailbox_get_stream (mailbox_t mbox, stream_t *pstream) 205 mailbox_get_stream (mailbox_t mbox, stream_t *pstream)
207 { 206 {
208 if (mbox == NULL || pstream == NULL) 207 if (mbox == NULL || pstream == NULL)
209 return MU_ERROR_INVALID_ARG; 208 return EINVAL;
210 if (pstream) 209 if (pstream)
211 *pstream = mbox->stream; 210 *pstream = mbox->stream;
212 return 0; 211 return 0;
...@@ -222,7 +221,7 @@ mailbox_register (mailbox_t mbox, size_t type, ...@@ -222,7 +221,7 @@ mailbox_register (mailbox_t mbox, size_t type,
222 221
223 /* FIXME: I should check for invalid types */ 222 /* FIXME: I should check for invalid types */
224 if (mbox == NULL || action == NULL) 223 if (mbox == NULL || action == NULL)
225 return MU_ERROR_INVALID_ARG; 224 return EINVAL;
226 225
227 /* find a free spot */ 226 /* find a free spot */
228 for (i = 0; i < mbox->event_num; i++) 227 for (i = 0; i < mbox->event_num; i++)
...@@ -240,7 +239,7 @@ mailbox_register (mailbox_t mbox, size_t type, ...@@ -240,7 +239,7 @@ mailbox_register (mailbox_t mbox, size_t type,
240 /* a new one */ 239 /* a new one */
241 event = realloc (mbox->event, (mbox->event_num + 1) * sizeof (*event)); 240 event = realloc (mbox->event, (mbox->event_num + 1) * sizeof (*event));
242 if (event == NULL) 241 if (event == NULL)
243 return MU_ERROR_OUT_OF_MEMORY; 242 return ENOMEM;
244 243
245 mbox->event = event; 244 mbox->event = event;
246 event[mbox->event_num]._action = action; 245 event[mbox->event_num]._action = action;
...@@ -267,7 +266,7 @@ mailbox_deregister (mailbox_t mbox, void *action) ...@@ -267,7 +266,7 @@ mailbox_deregister (mailbox_t mbox, void *action)
267 return 0; 266 return 0;
268 } 267 }
269 } 268 }
270 return MU_ERROR_NO_ENTRY; 269 return ENOENT;
271 } 270 }
272 271
273 int 272 int
...@@ -289,7 +288,7 @@ int ...@@ -289,7 +288,7 @@ int
289 mailbox_set_debug_level (mailbox_t mbox, size_t level) 288 mailbox_set_debug_level (mailbox_t mbox, size_t level)
290 { 289 {
291 if (mbox == NULL) 290 if (mbox == NULL)
292 return MU_ERROR_INVALID_ARG; 291 return EINVAL;
293 mbox->debug_level = level; 292 mbox->debug_level = level;
294 return 0; 293 return 0;
295 } 294 }
...@@ -298,7 +297,7 @@ int ...@@ -298,7 +297,7 @@ int
298 mailbox_get_debug_level (mailbox_t mbox, size_t *plevel) 297 mailbox_get_debug_level (mailbox_t mbox, size_t *plevel)
299 { 298 {
300 if (mbox == NULL || plevel == NULL) 299 if (mbox == NULL || plevel == NULL)
301 return MU_ERROR_INVALID_ARG; 300 return EINVAL;
302 *plevel = mbox->debug_level; 301 *plevel = mbox->debug_level;
303 return 0; 302 return 0;
304 } 303 }
...@@ -308,7 +307,7 @@ mailbox_set_debug_print (mailbox_t mbox, int (*debug_print) ...@@ -308,7 +307,7 @@ mailbox_set_debug_print (mailbox_t mbox, int (*debug_print)
308 (void *arg, const char *, size_t), void *arg) 307 (void *arg, const char *, size_t), void *arg)
309 { 308 {
310 if (mbox == NULL) 309 if (mbox == NULL)
311 return MU_ERROR_INVALID_ARG; 310 return EINVAL;
312 mbox->debug_print = debug_print; 311 mbox->debug_print = debug_print;
313 mbox->debug_arg = arg; 312 mbox->debug_arg = arg;
314 return 0; 313 return 0;
...@@ -319,7 +318,7 @@ mailbox_debug (mailbox_t mbox, int level, const char *fmt, ...) ...@@ -319,7 +318,7 @@ mailbox_debug (mailbox_t mbox, int level, const char *fmt, ...)
319 { 318 {
320 va_list ap; 319 va_list ap;
321 if (mbox == NULL) 320 if (mbox == NULL)
322 return MU_ERROR_INVALID_ARG; 321 return EINVAL;
323 322
324 if (!(mbox->debug_level & level)) 323 if (!(mbox->debug_level & level))
325 return 0; 324 return 0;
...@@ -333,7 +332,7 @@ mailbox_debug (mailbox_t mbox, int level, const char *fmt, ...) ...@@ -333,7 +332,7 @@ mailbox_debug (mailbox_t mbox, int level, const char *fmt, ...)
333 mbox->debug_bufsize = 255; 332 mbox->debug_bufsize = 255;
334 mbox->debug_buffer = malloc (mbox->debug_bufsize); 333 mbox->debug_buffer = malloc (mbox->debug_bufsize);
335 if (mbox->debug_buffer) 334 if (mbox->debug_buffer)
336 return MU_ERROR_OUT_OF_MEMORY; } 335 return ENOMEM; }
337 writen = vsnprintf (mbox->debug_buffer, mbox->debug_bufsize, fmt, ap); 336 writen = vsnprintf (mbox->debug_buffer, mbox->debug_bufsize, fmt, ap);
338 mbox->debug_print (mbox->debug_arg, mbox->debug_buffer, writen); 337 mbox->debug_print (mbox->debug_arg, mbox->debug_buffer, writen);
339 } 338 }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
26 #include <fcntl.h> 26 #include <fcntl.h>
27 #include <unistd.h> 27 #include <unistd.h>
28 28
29 #include <io0.h> 29 #include <stream0.h>
30 30
31 #ifdef _POSIX_MAPPED_FILES 31 #ifdef _POSIX_MAPPED_FILES
32 32
......
1 #include <mailbox.h>
2 #include <string.h> 1 #include <string.h>
3 #include <stdlib.h> 2 #include <stdlib.h>
4 #include <paths.h> 3 #include <paths.h>
5 #include <errno.h> 4 #include <errno.h>
6 #include <stdio.h> 5 #include <stdio.h>
6 #include <mailutils/mailbox.h>
7 7
8 #ifndef _PATH_MAILDIR 8 #ifndef _PATH_MAILDIR
9 # define _PATH_MAILDIR "/var/spool/mail" 9 # define _PATH_MAILDIR "/var/spool/mail"
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <errno.h>
18 #include <mailbox0.h> 19 #include <mailbox0.h>
19 #include <registrar0.h> 20 #include <registrar0.h>
20 #include <errno.h>
21 21
22 22
23 static int mailbox_imap_create (mailbox_t *mbox, const char *name); 23 static int mailbox_imap_create (mailbox_t *mbox, const char *name);
......
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 #include <string.h>
18 #include <errno.h>
19 #include <sys/stat.h>
17 20
18 #include <mailbox0.h> 21 #include <mailbox0.h>
19 #include <registrar0.h> 22 #include <registrar0.h>
20 23
21 #include <string.h>
22 #include <errno.h>
23 #include <sys/stat.h>
24 24
25 static int mailbox_mbox_create (mailbox_t *mbox, const char *name); 25 static int mailbox_mbox_create (mailbox_t *mbox, const char *name);
26 static void mailbox_mbox_destroy (mailbox_t *mbox); 26 static void mailbox_mbox_destroy (mailbox_t *mbox);
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <errno.h>
18 #include <mailbox0.h> 19 #include <mailbox0.h>
19 #include <registrar0.h> 20 #include <registrar0.h>
20 #include <errno.h>
21 21
22 static int mailbox_maildir_create (mailbox_t *mbox, const char *name); 22 static int mailbox_maildir_create (mailbox_t *mbox, const char *name);
23 static void mailbox_maildir_destroy (mailbox_t *mbox); 23 static void mailbox_maildir_destroy (mailbox_t *mbox);
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */ 17 */
18 #include <mailbox0.h>
19 #include <registrar0.h>
20 18
21 #include <dirent.h> 19 #include <dirent.h>
22 #include <errno.h> 20 #include <errno.h>
...@@ -27,6 +25,9 @@ ...@@ -27,6 +25,9 @@
27 #include <stdlib.h> 25 #include <stdlib.h>
28 #include <ctype.h> 26 #include <ctype.h>
29 27
28 #include <mailbox0.h>
29 #include <registrar0.h>
30
30 static int mailbox_mh_create (mailbox_t *pmbox, const char *name); 31 static int mailbox_mh_create (mailbox_t *pmbox, const char *name);
31 static void mailbox_mh_destroy (mailbox_t *pmbox); 32 static void mailbox_mh_destroy (mailbox_t *pmbox);
32 33
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <errno.h>
19
18 #include <mailbox0.h> 20 #include <mailbox0.h>
19 #include <registrar0.h> 21 #include <registrar0.h>
20 22
21 #include <errno.h>
22
23 static int mailbox_mmdf_create (mailbox_t *mbox, const char *name); 23 static int mailbox_mmdf_create (mailbox_t *mbox, const char *name);
24 static void mailbox_mmdf_destroy (mailbox_t *mbox); 24 static void mailbox_mmdf_destroy (mailbox_t *mbox);
25 25
......
...@@ -15,15 +15,6 @@ ...@@ -15,15 +15,6 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <mailbox0.h>
19 #include <io0.h>
20 #include <body0.h>
21 #include <message0.h>
22 #include <registrar0.h>
23 #include <auth0.h>
24 #include <header0.h>
25 #include <attribute0.h>
26
27 #include <termios.h> 18 #include <termios.h>
28 #include <errno.h> 19 #include <errno.h>
29 #include <stdlib.h> 20 #include <stdlib.h>
...@@ -32,6 +23,15 @@ ...@@ -32,6 +23,15 @@
32 #include <unistd.h> 23 #include <unistd.h>
33 #include <fcntl.h> 24 #include <fcntl.h>
34 25
26 #include <mailbox0.h>
27 #include <stream0.h>
28 #include <body0.h>
29 #include <message0.h>
30 #include <registrar0.h>
31 #include <auth0.h>
32 #include <header0.h>
33 #include <attribute0.h>
34
35 35
36 /* The different possible states of a Pop client, it maps to the POP3 commands. 36 /* The different possible states of a Pop client, it maps to the POP3 commands.
37 Note that POP3 is not reentrant. It is only one channel. */ 37 Note that POP3 is not reentrant. It is only one channel. */
...@@ -54,7 +54,7 @@ enum pop_state ...@@ -54,7 +54,7 @@ enum pop_state
54 POP_TOP_TX, POP_TOP_ACK, POP_TOP_RX, 54 POP_TOP_TX, POP_TOP_ACK, POP_TOP_RX,
55 POP_UIDL_TX, POP_UIDL_ACK, 55 POP_UIDL_TX, POP_UIDL_ACK,
56 POP_USER_TX, POP_USER_ACK, 56 POP_USER_TX, POP_USER_ACK,
57 POP_CLOSE_CONNECTION, /* I do not think a shutdown of a connection will 57 POP_CLOSE_CONNECTION /* I do not think a shutdown of a connection will
58 block. More for the symmetry. */ 58 block. More for the symmetry. */
59 }; 59 };
60 60
...@@ -535,6 +535,7 @@ pop_open (mailbox_t mbox, int flags) ...@@ -535,6 +535,7 @@ pop_open (mailbox_t mbox, int flags)
535 /* 535 /*
536 fprintf (stderr, "pop_open unknown state\n"); 536 fprintf (stderr, "pop_open unknown state\n");
537 */ 537 */
538 break;
538 }/* End AUTHORISATION state. */ 539 }/* End AUTHORISATION state. */
539 540
540 /* Spawn cleanup functions. */ 541 /* Spawn cleanup functions. */
...@@ -596,6 +597,7 @@ pop_close (mailbox_t mbox) ...@@ -596,6 +597,7 @@ pop_close (mailbox_t mbox)
596 /* 597 /*
597 fprintf (stderr, "pop_close unknow state"); 598 fprintf (stderr, "pop_close unknow state");
598 */ 599 */
600 break;
599 } /* UPDATE state. */ 601 } /* UPDATE state. */
600 602
601 /* free the messages */ 603 /* free the messages */
...@@ -794,6 +796,7 @@ pop_messages_count (mailbox_t mbox, size_t *pcount) ...@@ -794,6 +796,7 @@ pop_messages_count (mailbox_t mbox, size_t *pcount)
794 /* 796 /*
795 fprintf (stderr, "pomp_messages_count: unknow state\n"); 797 fprintf (stderr, "pomp_messages_count: unknow state\n");
796 */ 798 */
799 break;
797 } 800 }
798 801
799 status = sscanf (bio->buffer, "+OK %d %d", &(mpd->messages_count), 802 status = sscanf (bio->buffer, "+OK %d %d", &(mpd->messages_count),
...@@ -937,6 +940,7 @@ pop_expunge (mailbox_t mbox) ...@@ -937,6 +940,7 @@ pop_expunge (mailbox_t mbox)
937 break; 940 break;
938 default: 941 default:
939 /* fprintf (stderr, "pop_expunge: unknow state\n"); */ 942 /* fprintf (stderr, "pop_expunge: unknow state\n"); */
943 break;
940 } /* switch (state) */ 944 } /* switch (state) */
941 } /* if attribute_is_deleted() */ 945 } /* if attribute_is_deleted() */
942 } /* message_get_attribute() */ 946 } /* message_get_attribute() */
...@@ -1068,6 +1072,7 @@ pop_uidl (message_t msg, char *buffer, size_t buflen, size_t *pnwriten) ...@@ -1068,6 +1072,7 @@ pop_uidl (message_t msg, char *buffer, size_t buflen, size_t *pnwriten)
1068 /* 1072 /*
1069 fprintf (stderr, "pop_uidl state\n"); 1073 fprintf (stderr, "pop_uidl state\n");
1070 */ 1074 */
1075 break;
1071 } 1076 }
1072 1077
1073 CLEAR_STATE (mpd); 1078 CLEAR_STATE (mpd);
...@@ -1181,6 +1186,7 @@ pop_header_read (stream_t is, char *buffer, size_t buflen, ...@@ -1181,6 +1186,7 @@ pop_header_read (stream_t is, char *buffer, size_t buflen,
1181 break; 1186 break;
1182 default: 1187 default:
1183 /* fprintf (stderr, "pop_header_blurb unknown state\n"); */ 1188 /* fprintf (stderr, "pop_header_blurb unknown state\n"); */
1189 break;
1184 } /* switch (state) */ 1190 } /* switch (state) */
1185 1191
1186 if (nread == 0) 1192 if (nread == 0)
...@@ -1295,6 +1301,7 @@ pop_readstream (stream_t is, char *buffer, size_t buflen, ...@@ -1295,6 +1301,7 @@ pop_readstream (stream_t is, char *buffer, size_t buflen,
1295 } 1301 }
1296 default: 1302 default:
1297 /* fprintf (stderr, "pop_readstream unknow state\n"); */ 1303 /* fprintf (stderr, "pop_readstream unknow state\n"); */
1304 break;
1298 } /* Switch state. */ 1305 } /* Switch state. */
1299 1306
1300 if (nread == 0) 1307 if (nread == 0)
......
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
21 #include <registrar0.h> 21 #include <registrar0.h>
22 #include <message0.h> 22 #include <message0.h>
23 #include <url0.h> 23 #include <url0.h>
24 #include <io0.h> 24 #include <stream0.h>
25 #include <body0.h> 25 #include <body0.h>
26 #include <attribute0.h> 26 #include <attribute0.h>
27 #include <header.h> 27 #include <mailutils/header.h>
28 #include <auth.h> 28 #include <mailutils/auth.h>
29 #include <locker.h> 29 #include <mailutils/locker.h>
30 30
31 //#define HAVE_PTHREAD_H 31 //#define HAVE_PTHREAD_H
32 32
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
37 #include <fcntl.h> 37 #include <fcntl.h>
38 #include <unistd.h> 38 #include <unistd.h>
39 #include <signal.h> 39 #include <signal.h>
40 #include <mailutils_errno.h>
41 #include <time.h> 40 #include <time.h>
42 #ifdef HAVE_PTHREAD_H 41 #ifdef HAVE_PTHREAD_H
43 # include <pthread.h> 42 # include <pthread.h>
...@@ -48,6 +47,7 @@ ...@@ -48,6 +47,7 @@
48 #include <string.h> 47 #include <string.h>
49 #include <ctype.h> 48 #include <ctype.h>
50 #include <limits.h> 49 #include <limits.h>
50 #include <errno.h>
51 51
52 #define ATTRIBUTE_IS_DELETED(flag) (flag & MU_ATTRIBUTE_DELETED) 52 #define ATTRIBUTE_IS_DELETED(flag) (flag & MU_ATTRIBUTE_DELETED)
53 #define ATTRIBUTE_IS_EQUAL(flag1, flag2) (flag1 == flag2) 53 #define ATTRIBUTE_IS_EQUAL(flag1, flag2) (flag1 == flag2)
...@@ -160,7 +160,7 @@ unix_create (mailbox_t *pmbox, const char *name) ...@@ -160,7 +160,7 @@ unix_create (mailbox_t *pmbox, const char *name)
160 160
161 /* Sanity check. */ 161 /* Sanity check. */
162 if (name == NULL || *name == '\0') 162 if (name == NULL || *name == '\0')
163 return MU_ERROR_INVALID_ARG; 163 return EINVAL;
164 164
165 name_len = strlen (name); 165 name_len = strlen (name);
166 166
...@@ -183,14 +183,14 @@ unix_create (mailbox_t *pmbox, const char *name) ...@@ -183,14 +183,14 @@ unix_create (mailbox_t *pmbox, const char *name)
183 /* Allocate memory for mbox. */ 183 /* Allocate memory for mbox. */
184 mbox = calloc (1, sizeof (*mbox)); 184 mbox = calloc (1, sizeof (*mbox));
185 if (mbox == NULL) 185 if (mbox == NULL)
186 return MU_ERROR_OUT_OF_MEMORY; 186 return ENOMEM;
187 187
188 /* Allocate specific unix mbox data. */ 188 /* Allocate specific unix mbox data. */
189 mud = mbox->data = calloc (1, sizeof (*mud)); 189 mud = mbox->data = calloc (1, sizeof (*mud));
190 if (mbox->data == NULL) 190 if (mbox->data == NULL)
191 { 191 {
192 unix_destroy (&mbox); 192 unix_destroy (&mbox);
193 return MU_ERROR_OUT_OF_MEMORY; 193 return ENOMEM;
194 } 194 }
195 195
196 /* Copy the name. */ 196 /* Copy the name. */
...@@ -198,7 +198,7 @@ unix_create (mailbox_t *pmbox, const char *name) ...@@ -198,7 +198,7 @@ unix_create (mailbox_t *pmbox, const char *name)
198 if (mbox->name == NULL) 198 if (mbox->name == NULL)
199 { 199 {
200 unix_destroy (&mbox); 200 unix_destroy (&mbox);
201 return MU_ERROR_OUT_OF_MEMORY; 201 return ENOMEM;
202 } 202 }
203 memcpy (mbox->name, name, name_len); 203 memcpy (mbox->name, name, name_len);
204 204
...@@ -212,7 +212,7 @@ unix_create (mailbox_t *pmbox, const char *name) ...@@ -212,7 +212,7 @@ unix_create (mailbox_t *pmbox, const char *name)
212 if (mud->dirname == NULL) 212 if (mud->dirname == NULL)
213 { 213 {
214 unix_destroy (&mbox); 214 unix_destroy (&mbox);
215 return MU_ERROR_OUT_OF_MEMORY; 215 return ENOMEM;
216 } 216 }
217 memcpy (mud->dirname, name, sep - name); 217 memcpy (mud->dirname, name, sep - name);
218 218
...@@ -221,7 +221,7 @@ unix_create (mailbox_t *pmbox, const char *name) ...@@ -221,7 +221,7 @@ unix_create (mailbox_t *pmbox, const char *name)
221 if (mud->basename == NULL) 221 if (mud->basename == NULL)
222 { 222 {
223 unix_destroy (&mbox); 223 unix_destroy (&mbox);
224 return MU_ERROR_OUT_OF_MEMORY; 224 return ENOMEM;
225 } 225 }
226 memcpy (mud->basename, sep, name_len - (sep - name)); 226 memcpy (mud->basename, sep, name_len - (sep - name));
227 } 227 }
...@@ -233,7 +233,7 @@ unix_create (mailbox_t *pmbox, const char *name) ...@@ -233,7 +233,7 @@ unix_create (mailbox_t *pmbox, const char *name)
233 if (mud->dirname == NULL) 233 if (mud->dirname == NULL)
234 { 234 {
235 unix_destroy (&mbox); 235 unix_destroy (&mbox);
236 return MU_ERROR_OUT_OF_MEMORY; 236 return ENOMEM;
237 } 237 }
238 mud->dirname[0] = '.'; 238 mud->dirname[0] = '.';
239 239
...@@ -241,7 +241,7 @@ unix_create (mailbox_t *pmbox, const char *name) ...@@ -241,7 +241,7 @@ unix_create (mailbox_t *pmbox, const char *name)
241 if (mud->basename == NULL) 241 if (mud->basename == NULL)
242 { 242 {
243 unix_destroy (&mbox); 243 unix_destroy (&mbox);
244 return MU_ERROR_OUT_OF_MEMORY; 244 return ENOMEM;
245 } 245 }
246 memcpy (mud->basename, name, name_len); 246 memcpy (mud->basename, name, name_len);
247 } 247 }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 18
19 #include <io0.h> 19 #include <stream0.h>
20 #include <message0.h> 20 #include <message0.h>
21 21
22 #include <errno.h> 22 #include <errno.h>
......
...@@ -18,9 +18,8 @@ ...@@ -18,9 +18,8 @@
18 18
19 #include <message0.h> 19 #include <message0.h>
20 #include <mime0.h> 20 #include <mime0.h>
21 #include <io0.h> 21 #include <stream0.h>
22 #include <body0.h> 22 #include <body0.h>
23 #include <mime.h>
24 23
25 #include <errno.h> 24 #include <errno.h>
26 #include <stdio.h> 25 #include <stdio.h>
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <io0.h>
19
20 #include <errno.h> 18 #include <errno.h>
21 #include <stdlib.h> 19 #include <stdlib.h>
22 #include <stdio.h> 20 #include <stdio.h>
23 21
22 #include <stream0.h>
23
24 int 24 int
25 stream_create (stream_t *pstream, int flags, void *owner) 25 stream_create (stream_t *pstream, int flags, void *owner)
26 { 26 {
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
27 #include <arpa/inet.h> 27 #include <arpa/inet.h>
28 #include <unistd.h> 28 #include <unistd.h>
29 29
30 #include <io0.h> 30 #include <stream0.h>
31 #include <tcp.h> 31 #include <tcp0.h>
32 32
33 static int _tcp_close(stream_t stream) 33 static int _tcp_close(stream_t stream)
34 { 34 {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 #include <stdlib.h> 21 #include <stdlib.h>
22 #include <string.h> 22 #include <string.h>
23 23
24 #include <io0.h> 24 #include <stream0.h>
25 25
26 struct _ts_desc { 26 struct _ts_desc {
27 const char *encoding; 27 const char *encoding;
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
21 #include <stdlib.h> 21 #include <stdlib.h>
22 #include <string.h> 22 #include <string.h>
23 23
24 #include <io0.h> 24 #include <steam0.h>
25 #include <transcode.h> 25 #include <mailutils/transcode.h>
26 26
27 int _base64_decode(stream_t stream, char *optr, size_t osize, off_t offset, size_t *nbytes); 27 int _base64_decode(stream_t stream, char *optr, size_t osize, off_t offset, size_t *nbytes);
28 int _base64_encode(stream_t stream, const char *optr, size_t osize, off_t offset, size_t *nbytes); 28 int _base64_encode(stream_t stream, const char *optr, size_t osize, off_t offset, size_t *nbytes);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <url0.h> 18 #include <url0.h>
19 #include <registrar.h> 19 #include <mailutils/registrar.h>
20 #include <errno.h> 20 #include <errno.h>
21 21
22 static int url_imap_create (url_t *purl, const char *name); 22 static int url_imap_create (url_t *purl, const char *name);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <url0.h> 18 #include <url0.h>
19 #include <registrar.h> 19 #include <mailutils/registrar.h>
20 #include <errno.h> 20 #include <errno.h>
21 21
22 static int url_mailto_create (url_t *purl, const char *name); 22 static int url_mailto_create (url_t *purl, const char *name);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <url0.h> 18 #include <url0.h>
19 #include <registrar.h> 19 #include <mailutils/registrar.h>
20 20
21 #include <errno.h> 21 #include <errno.h>
22 #include <stdlib.h> 22 #include <stdlib.h>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <url0.h> 18 #include <url0.h>
19 #include <registrar.h> 19 #include <mailutils/registrar.h>
20 20
21 #include <errno.h> 21 #include <errno.h>
22 #include <stdlib.h> 22 #include <stdlib.h>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <url0.h> 18 #include <url0.h>
19 #include <registrar.h> 19 #include <mailutils/registrar.h>
20 20
21 #include <errno.h> 21 #include <errno.h>
22 #include <stdlib.h> 22 #include <stdlib.h>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <url0.h> 18 #include <url0.h>
19 #include <registrar.h> 19 #include <mailutils/registrar.h>
20 20
21 #include <errno.h> 21 #include <errno.h>
22 #include <stdlib.h> 22 #include <stdlib.h>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <url0.h> 18 #include <url0.h>
19 #include <registrar.h> 19 #include <mailutils/registrar.h>
20 20
21 #include <errno.h> 21 #include <errno.h>
22 #include <stdlib.h> 22 #include <stdlib.h>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 17
18 #include <url0.h> 18 #include <url0.h>
19 #include <registrar.h> 19 #include <mailutils/registrar.h>
20 20
21 #include <errno.h> 21 #include <errno.h>
22 #include <stdlib.h> 22 #include <stdlib.h>
......