[go: up one dir, main page]

Menu

[r56]: / trunk / man / libmail_mbox.3  Maximize  Restore  History

Download this file

92 lines (87 with data), 2.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.\" This file is part of libmail.
.\"
.\" (c) 2009 - Dimitris Mandalidis <mandas@users.sourceforge.net>
.\"
.\" libmail is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" libmail is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with libmail. If not, see <http://www.gnu.org/licenses/>.
.TH LIBMAIL_MBOX 3 "2009-05-31" "version 0.3" "libmail - A mail handling library"
.SH NAME
mbox_check - libmail's mbox supporting functions
.SH SYNOPSIS
.nf
.B #include <libmail/libmail.h>
.B #include <libmail/mbox.h>
.sp
.BI "int mbox_check(libmail_local_mailbox_t *" "server" ", int *" "n_new_messages" ", int *" "n_messages" );
.fi
.SH DESCRIPTION
.B mbox_check()
takes a pointer to
.B libmail_local_mailbox_t
structure which identify the mailbox location. More specifically
.I libmail_local_mailbox_t
is defined as follows :
.sp
.nf
typedef struct libmail_local_mailbox_t {
char location[PATH_MAX+1];
} libmail_local_mailbox_t;
.fi
.sp
In
.I location
the path of the local mailbox is specified.
.B mbox_check()
checks for messages filling the
.I n_messages
and
.I n_new_messages
with the number of total and new messages respectively.
.SH "RETURN VALUE"
.B mbox_check()
returns
.B LIBMAIL_SUCCESS
on success,
.B LIBMAIL_SYSERROR
on system error (errno defined in <errno.h> is set) and
.B LIBMAIL_MBOX_ISDIR
if the user specified his/her mailbox as a directory
.TP
You can retrieve a short description about a specific error through libmail_strerror()
.SH "SEE ALSO"
.BR "mbox" "(5)" "libmail_strerror" "(3)"
.SH "AUTHOR"
Dimitris Mandalidis <mandas AT users DOT sourceforge DOT net>
.SH "EXAMPLES"
A short example on using libmail mbox support follows:
.sp
.nf
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <libmail/libmail.h>
#include <libmail/mbox.h>
#include <libmail/error.h>
void mbox_test(void) {
int result;
libmail_local_mailbox_t mbox_server;
int n_new_messages, n_messages;
strcpy(mbox_server.location, "/var/mail/mandas");
if ((result = mbox_check(&mbox_server, &n_new_messages, &n_messages)) != 0) {
printf("ERROR: %s", libmail_strerror(result));
exit(EXIT_FAILURE);
}
printf("%d total messages and %d new messages", n_messages, n_new_messages);
return;
}
.fi