Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
33fdea47
...
33fdea476cfc31d1a1e2e4b55fac3f1ee462e25c
authored
2001-10-30 14:06:46 +0000
by
Sam Roberts
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added new example, mbox-check.c
1 parent
b6e19557
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
3 deletions
examples/Makefile
examples/mbox-check.c
examples/Makefile
View file @
33fdea4
...
...
@@ -2,14 +2,18 @@
CFLAGS
=
-g -I../include -Wall
LDFLAGS
=
-g -static
LDLIBS
=
../mailbox/.libs/libmailbox.a ../lib/libmailutils.a
-lsocket
LDLIBS
=
-lsocket
EXES
=
addr mbox-explode mbox-dates mbox-auth url-parse
MULIBS
=
../mailbox/.libs/libmailbox.a ../lib/libmailutils.a
$(EXES)
:
$(LDLIBS)
EXES
=
addr mbox-explode mbox-dates mbox-auth url-parse mbox-check
$(EXES)
:
$(MULIBS)
default
:
$(EXES)
$(EXES)
:
$(MBOXLIB)
# example of parsing the date fields, prints all the incorrectly
# formatted dates in a mailbox.
...
...
examples/mbox-check.c
0 → 100644
View file @
33fdea4
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <mailutils/mailbox.h>
#include <mailutils/address.h>
#include <mailutils/registrar.h>
#include <mailutils/parse822.h>
int
main
(
int
argc
,
char
**
argv
)
{
mailbox_t
mbox
;
size_t
count
=
0
;
char
*
mboxname
=
argv
[
1
];
int
status
;
/* Register desired mailbox formats. */
{
list_t
bookie
;
registrar_get_list
(
&
bookie
);
list_append
(
bookie
,
path_record
);
list_append
(
bookie
,
pop_record
);
list_append
(
bookie
,
imap_record
);
}
if
((
status
=
mailbox_create_default
(
&
mbox
,
mboxname
))
!=
0
)
{
fprintf
(
stderr
,
"could not create <%s>: %s
\n
"
,
mboxname
,
strerror
(
status
));
return
status
;
}
{
mu_debug_t
debug
;
mailbox_get_debug
(
mbox
,
&
debug
);
mu_debug_set_level
(
debug
,
MU_DEBUG_TRACE
|
MU_DEBUG_PROT
);
}
if
((
status
=
mailbox_open
(
mbox
,
MU_STREAM_READ
))
!=
0
)
{
fprintf
(
stderr
,
"could not open <%s>: %s
\n
"
,
mboxname
,
strerror
(
status
));
mailbox_destroy
(
&
mbox
);
exit
(
1
);
}
if
((
status
=
mailbox_messages_count
(
mbox
,
&
count
))
!=
0
)
{
fprintf
(
stderr
,
"could not count <%s>: %s
\n
"
,
mboxname
,
strerror
(
status
));
mailbox_close
(
mbox
);
mailbox_destroy
(
&
mbox
);
exit
(
1
);
}
mailbox_close
(
mbox
);
mailbox_destroy
(
&
mbox
);
printf
(
"count %d messages in <%s>
\n
"
,
count
,
mboxname
);
return
0
;
}
Please
register
or
sign in
to post a comment