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
12be7d8c
...
12be7d8c26495b31e440a2a1217c558b46498662
authored
2004-06-02 11:04:07 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Revise the usage of return codes.
1 parent
74a44780
Show whitespace changes
Inline
Side-by-side
Showing
59 changed files
with
366 additions
and
219 deletions
auth/gsasl.c
auth/tls.c
examples/addr.c
imap4d/namespace.c
lib/mu_dbm.c
mail/util.c
mailbox/address.c
mailbox/amd.c
mailbox/attachment.c
mailbox/attribute.c
mailbox/auth.c
mailbox/body.c
mailbox/debug.c
mailbox/envelope.c
mailbox/file_stream.c
mailbox/filter.c
mailbox/filter_trans.c
mailbox/folder.c
mailbox/header.c
mailbox/imap/folder.c
mailbox/imap/mbox.c
mailbox/iterator.c
mailbox/list.c
mailbox/mailcap.c
mailbox/mailer.c
mailbox/mapfile_stream.c
mailbox/mbox/folder.c
mailbox/mbox/mbox.c
mailbox/mbox/url.c
mailbox/mbx_default.c
mailbox/memory_stream.c
mailbox/message.c
mailbox/mime.c
mailbox/monitor.c
mailbox/mu_auth.c
mailbox/observer.c
mailbox/pop/mbox.c
mailbox/pop/pop3_capa.c
mailbox/pop/pop3_carrier.c
mailbox/pop/pop3_list.c
mailbox/pop/pop3_lista.c
mailbox/pop/pop3_retr.c
mailbox/pop/pop3_stat.c
mailbox/pop/pop3_timeout.c
mailbox/pop/pop3_top.c
mailbox/pop/pop3_uidl.c
mailbox/pop/pop3_uidla.c
mailbox/property.c
mailbox/refcount.c
mailbox/registrar.c
mailbox/rfc2047.c
mailbox/sendmail.c
mailbox/smtp.c
mailbox/stream.c
mailbox/tcp.c
mailbox/ticket.c
mailbox/url.c
mailbox/wicket.c
mh/mh_ctx.c
auth/gsasl.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <mailutils/argp.h>
#include <mailutils/error.h>
#include <mailutils/errno.h>
#include <mailutils/mu_auth.h>
#include <mailutils/nls.h>
#include <mailutils/stream.h>
...
...
@@ -288,7 +289,7 @@ gsasl_stream_create (stream_t *stream, int fd,
int
rc
;
if
(
stream
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
if
((
flags
&
~
(
MU_STREAM_READ
|
MU_STREAM_WRITE
))
||
(
flags
&
(
MU_STREAM_READ
|
MU_STREAM_WRITE
))
==
...
...
auth/tls.c
View file @
12be7d8
...
...
@@ -32,6 +32,7 @@
#include <mailutils/tls.h>
#include <mailutils/nls.h>
#include <mailutils/stream.h>
#include <mailutils/errno.h>
#include <lbuf.h>
...
...
@@ -521,7 +522,7 @@ tls_stream_create (stream_t *stream, int in_fd, int out_fd, int flags)
int
rc
;
if
(
stream
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
s
=
calloc
(
1
,
sizeof
(
*
s
));
if
(
s
==
NULL
)
...
...
examples/addr.c
View file @
12be7d8
...
...
@@ -23,7 +23,7 @@
#include <mailutils/errno.h>
#include <mailutils/mutil.h>
#define EPARSE
E
NOENT
#define EPARSE
MU_ERR_
NOENT
static
int
parse
(
const
char
*
str
)
...
...
imap4d/namespace.c
View file @
12be7d8
...
...
@@ -170,7 +170,6 @@ char *
namespace_checkfullpath
(
char
*
name
,
const
char
*
pattern
,
const
char
*
delim
)
{
struct
namespace_info
info
;
url_t
url
=
NULL
;
char
*
p
,
*
path
=
NULL
;
char
*
scheme
=
NULL
;
...
...
lib/mu_dbm.c
View file @
12be7d8
...
...
@@ -275,7 +275,7 @@ mu_dbm_firstkey (DBM_FILE db)
key
.
data
=
NULL
;
key
.
size
=
0
;
if
(
ret
==
DB_NOTFOUND
)
errno
=
E
NOENT
;
errno
=
MU_ERR_
NOENT
;
else
errno
=
ret
;
}
...
...
@@ -299,7 +299,7 @@ mu_dbm_nextkey (DBM_FILE db, DBM_DATUM pkey /*unused*/)
key
.
data
=
NULL
;
key
.
size
=
0
;
if
(
ret
==
DB_NOTFOUND
)
errno
=
E
NOENT
;
errno
=
MU_ERR_
NOENT
;
else
errno
=
ret
;
}
...
...
mail/util.c
View file @
12be7d8
...
...
@@ -1269,7 +1269,7 @@ util_get_message (mailbox_t mbox, size_t msgno, message_t *msg)
if
(
msgno
>
total
)
{
util_error_range
(
msgno
);
return
E
NOENT
;
return
MU_ERR_
NOENT
;
}
status
=
mailbox_get_message
(
mbox
,
msgno
,
msg
);
...
...
mailbox/address.c
View file @
12be7d8
...
...
@@ -206,7 +206,7 @@ address_get_nth (address_t addr, size_t no, address_t *pret)
{
address_t
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
*
pret
=
address_dup
(
subaddr
);
return
0
;
}
...
...
@@ -223,7 +223,7 @@ address_get_personal (address_t addr, size_t no, char *buf, size_t len,
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
i
=
mu_cpystr
(
buf
,
subaddr
->
personal
,
len
);
if
(
n
)
...
...
@@ -243,7 +243,7 @@ address_get_comments (address_t addr, size_t no, char *buf, size_t len,
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
i
=
mu_cpystr
(
buf
,
subaddr
->
comments
,
len
);
if
(
n
)
...
...
@@ -263,7 +263,7 @@ address_get_email (address_t addr, size_t no, char *buf, size_t len,
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
i
=
mu_cpystr
(
buf
,
subaddr
->
email
,
len
);
if
(
n
)
...
...
@@ -348,7 +348,7 @@ address_aget_personal (address_t addr, size_t no, char **buf)
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
if
(
subaddr
->
personal
)
{
...
...
@@ -372,7 +372,7 @@ address_aget_comments (address_t addr, size_t no, char **buf)
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
if
(
subaddr
->
comments
)
{
...
...
@@ -396,7 +396,7 @@ address_aget_email (address_t addr, size_t no, char **buf)
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
if
(
subaddr
->
email
)
{
...
...
@@ -421,7 +421,7 @@ address_aget_local_part (address_t addr, size_t no, char **buf)
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
if
(
subaddr
->
local_part
)
{
...
...
@@ -446,7 +446,7 @@ address_aget_domain (address_t addr, size_t no, char **buf)
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
if
(
subaddr
->
domain
)
{
...
...
@@ -472,7 +472,7 @@ address_get_local_part (address_t addr, size_t no, char *buf, size_t len,
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
i
=
mu_cpystr
(
buf
,
subaddr
->
local_part
,
len
);
if
(
n
)
...
...
@@ -492,7 +492,7 @@ address_get_domain (address_t addr, size_t no, char *buf, size_t len,
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
i
=
mu_cpystr
(
buf
,
subaddr
->
domain
,
len
);
if
(
n
)
...
...
@@ -512,7 +512,7 @@ address_get_route (address_t addr, size_t no, char *buf, size_t len,
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
i
=
mu_cpystr
(
buf
,
subaddr
->
route
,
len
);
if
(
n
)
...
...
@@ -554,7 +554,7 @@ address_is_group (address_t addr, size_t no, int *yes)
subaddr
=
_address_get_nth
(
addr
,
no
);
if
(
!
subaddr
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
if
(
yes
)
*
yes
=
_address_is_group
(
subaddr
);
...
...
mailbox/amd.c
View file @
12be7d8
...
...
@@ -55,6 +55,7 @@
#include <mailutils/debug.h>
#include <mailutils/envelope.h>
#include <mailutils/error.h>
#include <mailutils/errno.h>
#include <mailutils/header.h>
#include <mailutils/locker.h>
#include <mailutils/message.h>
...
...
@@ -244,7 +245,9 @@ amd_init_mailbox (mailbox_t mailbox, size_t amd_size, struct _amd_data **pamd)
struct
_amd_data
*
amd
;
size_t
name_len
;
if
(
mailbox
==
NULL
||
amd_size
<
sizeof
(
*
amd
))
if
(
mailbox
==
NULL
)
return
MU_ERR_MBX_NULL
;
if
(
amd_size
<
sizeof
(
*
amd
))
return
EINVAL
;
amd
=
mailbox
->
data
=
calloc
(
1
,
amd_size
);
...
...
@@ -338,7 +341,7 @@ static int
amd_close
(
mailbox_t
mailbox
)
{
if
(
!
mailbox
)
return
EINVA
L
;
return
MU_ERR_MBX_NUL
L
;
return
0
;
}
...
...
@@ -463,7 +466,9 @@ amd_get_message (mailbox_t mailbox, size_t msgno, message_t *pmsg)
struct
_amd_message
*
mhm
;
/* Sanity checks. */
if
(
pmsg
==
NULL
||
amd
==
NULL
)
if
(
pmsg
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
amd
==
NULL
)
return
EINVAL
;
/* If we did not start a scanning yet do it now. */
...
...
@@ -642,7 +647,9 @@ amd_append_message (mailbox_t mailbox, message_t msg)
struct
_amd_data
*
amd
=
mailbox
->
data
;
struct
_amd_message
*
mhm
;
if
(
!
mailbox
||
!
msg
)
if
(
!
mailbox
)
return
MU_ERR_MBX_NULL
;
if
(
!
msg
)
return
EINVAL
;
mhm
=
calloc
(
1
,
amd
->
msg_size
);
...
...
mailbox/attachment.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -43,6 +43,7 @@
#include <mailutils/header.h>
#include <mailutils/message.h>
#include <mailutils/stream.h>
#include <mailutils/errno.h>
#define MAX_HDR_LEN 256
#define BUF_SIZE 2048
...
...
@@ -74,7 +75,9 @@ message_create_attachment (const char *content_type, const char *encoding,
char
*
header
,
*
name
=
NULL
,
*
fname
=
NULL
;
int
ret
;
if
(
filename
==
NULL
||
newmsg
==
NULL
)
if
(
newmsg
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
filename
==
NULL
)
return
EINVAL
;
if
((
ret
=
message_create
(
newmsg
,
NULL
))
==
0
)
...
...
@@ -266,7 +269,7 @@ message_get_attachment_name (message_t msg, char *name, size_t bufsz, size_t *sz
ret = ENOMEM;
}
else
ret =
E
NOENT;
ret =
MU_ERR_
NOENT;
}
return ret;
}
...
...
@@ -277,8 +280,8 @@ int message_aget_attachment_name(message_t msg, char** name)
size_t
sz
=
0
;
int
ret
=
0
;
if
(
name
==
NULL
)
return
EINVA
L
;
if
(
name
==
NULL
)
return
MU_ERR_OUT_PTR_NUL
L
;
if
((
ret
=
message_get_attachment_name
(
msg
,
NULL
,
0
,
&
sz
))
!=
0
)
return
ret
;
...
...
@@ -313,7 +316,7 @@ message_get_attachment_name (message_t msg, char *buf, size_t bufsz, size_t *sz)
/* If the header wasn't there, we'll fall back to Content-Type, but
other errors are fatal. */
if
(
ret
!=
0
&&
ret
!=
E
NOENT
)
if
(
ret
!=
0
&&
ret
!=
MU_ERR_
NOENT
)
return
ret
;
if
(
ret
==
0
&&
value
!=
NULL
)
...
...
@@ -350,7 +353,7 @@ message_get_attachment_name (message_t msg, char *buf, size_t bufsz, size_t *sz)
strncpy
(
buf
,
name
,
bufsz
);
}
else
ret
=
E
NOENT
;
ret
=
MU_ERR_
NOENT
;
return
ret
;
}
...
...
@@ -456,8 +459,10 @@ message_encapsulate (message_t msg, message_t * newmsg, void **data)
size_t
nbytes
;
body_t
body
;
if
(
msg
==
NULL
||
newmsg
==
NULL
)
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
newmsg
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
((
ret
=
_attachment_setup
(
&
info
,
msg
,
&
ostream
,
data
))
!=
0
)
return
ret
;
...
...
@@ -514,8 +519,10 @@ message_unencapsulate (message_t msg, message_t * newmsg, void **data)
stream_t
istream
,
ostream
;
struct
_msg_info
*
info
=
NULL
;
if
(
msg
==
NULL
||
newmsg
==
NULL
)
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
newmsg
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
((
data
==
NULL
||
*
data
==
NULL
)
&&
(
ret
=
message_get_header
(
msg
,
&
hdr
))
==
0
)
...
...
mailbox/attribute.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -28,6 +28,7 @@
# include <strings.h>
#endif
#include <mailutils/errno.h>
#include <attribute0.h>
static
int
flags_to_string
__P
((
int
,
char
*
,
size_t
,
size_t
*
));
...
...
@@ -37,7 +38,7 @@ attribute_create (attribute_t *pattr, void *owner)
{
attribute_t
attr
;
if
(
pattr
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
attr
=
calloc
(
1
,
sizeof
(
*
attr
));
if
(
attr
==
NULL
)
return
ENOMEM
;
...
...
@@ -90,8 +91,10 @@ attribute_set_modified (attribute_t attr)
int
attribute_get_flags
(
attribute_t
attr
,
int
*
pflags
)
{
if
(
attr
==
NULL
||
pflags
==
NULL
)
if
(
attr
==
NULL
)
return
EINVAL
;
if
(
pflags
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
attr
->
_get_flags
)
return
attr
->
_get_flags
(
attr
,
pflags
);
*
pflags
=
attr
->
flags
;
...
...
mailbox/auth.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -48,7 +48,7 @@ authority_create (authority_t *pauthority, ticket_t ticket, void *owner)
{
authority_t
authority
;
if
(
pauthority
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
authority
=
calloc
(
1
,
sizeof
(
*
authority
));
if
(
authority
==
NULL
)
return
ENOMEM
;
...
...
@@ -93,8 +93,10 @@ authority_set_ticket (authority_t authority, ticket_t ticket)
int
authority_get_ticket
(
authority_t
authority
,
ticket_t
*
pticket
)
{
if
(
authority
==
NULL
||
pticket
==
NULL
)
if
(
authority
==
NULL
)
return
EINVAL
;
if
(
pticket
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
authority
->
ticket
==
NULL
)
{
int
status
=
ticket_create
(
&
(
authority
->
ticket
),
authority
);
...
...
mailbox/body.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -30,6 +30,7 @@
#include <mailutils/stream.h>
#include <mailutils/mutil.h>
#include <mailutils/errno.h>
#include <body0.h>
#define BODY_MODIFIED 0x10000
...
...
@@ -53,7 +54,9 @@ body_create (body_t *pbody, void *owner)
{
body_t
body
;
if
(
pbody
==
NULL
||
owner
==
NULL
)
if
(
pbody
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
owner
==
NULL
)
return
EINVAL
;
body
=
calloc
(
1
,
sizeof
(
*
body
));
...
...
@@ -140,8 +143,10 @@ body_get_filename (body_t body, char *filename, size_t len, size_t *pn)
int
body_get_stream
(
body_t
body
,
stream_t
*
pstream
)
{
if
(
body
==
NULL
||
pstream
==
NULL
)
if
(
body
==
NULL
)
return
EINVAL
;
if
(
pstream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
body
->
stream
==
NULL
)
{
...
...
mailbox/debug.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
#include <mailutils/errno.h>
#include <debug0.h>
int
...
...
@@ -31,7 +32,7 @@ mu_debug_create (mu_debug_t *pdebug, void *owner)
{
mu_debug_t
debug
;
if
(
pdebug
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
debug
=
calloc
(
sizeof
(
*
debug
),
1
);
if
(
debug
==
NULL
)
return
ENOMEM
;
...
...
mailbox/envelope.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1999, 2000
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -20,6 +20,7 @@
#endif
#include <errno.h>
#include <stdlib.h>
#include <mailutils/errno.h>
#include <envelope0.h>
int
...
...
@@ -27,7 +28,7 @@ envelope_create (envelope_t *penvelope, void *owner)
{
envelope_t
envelope
;
if
(
penvelope
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
envelope
=
calloc
(
1
,
sizeof
(
*
envelope
));
if
(
envelope
==
NULL
)
return
ENOMEM
;
...
...
mailbox/file_stream.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -486,7 +486,7 @@ file_stream_create (stream_t *stream, const char* filename, int flags)
int
ret
;
if
(
stream
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
fs
=
calloc
(
1
,
sizeof
(
struct
_file_stream
));
if
(
fs
==
NULL
)
...
...
@@ -528,7 +528,7 @@ stdio_stream_create (stream_t *stream, FILE *file, int flags)
int
ret
;
if
(
stream
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
if
(
file
==
NULL
)
return
EINVAL
;
...
...
@@ -954,7 +954,7 @@ _prog_stream_create (struct _prog_stream **pfs,
int
ret
;
if
(
stream
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
if
(
progname
==
NULL
||
(
flags
&
MU_STREAM_NO_CLOSE
))
return
EINVAL
;
...
...
mailbox/filter.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -36,6 +36,7 @@ First draft: Alain Magloire.
#include <mailutils/iterator.h>
#include <mailutils/stream.h>
#include <mailutils/errno.h>
static
void
filter_destroy
(
stream_t
stream
)
...
...
@@ -138,7 +139,7 @@ int
filter_get_list
(
list_t
*
plist
)
{
if
(
plist
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
monitor_wrlock
(
&
filter_monitor
);
if
(
filter_list
==
NULL
)
{
...
...
@@ -171,7 +172,9 @@ filter_create (stream_t *pstream, stream_t stream, const char *name,
int
status
;
list_t
list
=
NULL
;
if
(
pstream
==
NULL
||
stream
==
NULL
||
name
==
NULL
)
if
(
pstream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
stream
==
NULL
||
name
==
NULL
)
return
EINVAL
;
filter_get_list
(
&
list
);
...
...
@@ -256,6 +259,6 @@ filter_create (stream_t *pstream, stream_t stream, const char *name,
stream_set_destroy
(
*
pstream
,
filter_destroy
,
filter
);
}
else
status
=
E
NOENT
;
status
=
MU_ERR_
NOENT
;
return
status
;
}
...
...
mailbox/filter_trans.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -29,6 +29,7 @@ First Draft: Dave Inglis.
#include <string.h>
#include <mailutils/stream.h>
#include <mailutils/errno.h>
#include <filter0.h>
...
...
@@ -76,7 +77,9 @@ trans_read (filter_t filter, char *optr, size_t osize, off_t offset,
int
ret
=
0
,
i
;
size_t
bytes
,
*
nbytes
=
&
bytes
;
if
(
optr
==
NULL
||
osize
==
0
)
if
(
optr
==
NULL
)
return
MU_ERR_OUT_NULL
;
if
(
osize
==
0
)
return
EINVAL
;
if
(
n_bytes
)
...
...
mailbox/folder.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -32,6 +32,7 @@
#include <mailutils/registrar.h>
#include <mailutils/stream.h>
#include <mailutils/url.h>
#include <mailutils/errno.h>
#include <folder0.h>
...
...
@@ -61,7 +62,7 @@ folder_create (folder_t *pfolder, const char *name)
int
found
=
0
;
if
(
pfolder
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
/* Look in the registrar list(iterator), for a possible concrete mailbox
implementatio that could match the URL. */
...
...
@@ -147,7 +148,7 @@ folder_create (folder_t *pfolder, const char *name)
}
}
else
status
=
E
NOENT
;
status
=
MU_ERR_
NOENT
;
return
status
;
}
...
...
@@ -239,8 +240,10 @@ folder_set_stream (folder_t folder, stream_t stream)
int
folder_get_stream
(
folder_t
folder
,
stream_t
*
pstream
)
{
if
(
folder
==
NULL
||
pstream
==
NULL
)
if
(
folder
==
NULL
)
return
EINVAL
;
if
(
pstream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
pstream
=
folder
->
stream
;
return
0
;
}
...
...
@@ -259,8 +262,10 @@ folder_set_authority (folder_t folder, authority_t authority)
int
folder_get_authority
(
folder_t
folder
,
authority_t
*
pauthority
)
{
if
(
folder
==
NULL
||
pauthority
==
NULL
)
if
(
folder
==
NULL
)
return
EINVAL
;
if
(
pauthority
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
pauthority
=
folder
->
authority
;
return
0
;
}
...
...
@@ -268,8 +273,10 @@ folder_get_authority (folder_t folder, authority_t *pauthority)
int
folder_get_observable
(
folder_t
folder
,
observable_t
*
pobservable
)
{
if
(
folder
==
NULL
||
pobservable
==
NULL
)
if
(
folder
==
NULL
)
return
EINVAL
;
if
(
pobservable
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
folder
->
observable
==
NULL
)
{
...
...
@@ -304,8 +311,10 @@ folder_set_debug (folder_t folder, mu_debug_t debug)
int
folder_get_debug
(
folder_t
folder
,
mu_debug_t
*
pdebug
)
{
if
(
folder
==
NULL
||
pdebug
==
NULL
)
if
(
folder
==
NULL
)
return
EINVAL
;
if
(
pdebug
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
folder
->
debug
==
NULL
)
{
int
status
=
mu_debug_create
(
&
(
folder
->
debug
),
folder
);
...
...
@@ -391,8 +400,10 @@ folder_rename (folder_t folder, const char *oldname, const char *newname)
int
folder_get_url
(
folder_t
folder
,
url_t
*
purl
)
{
if
(
folder
==
NULL
||
purl
==
NULL
)
if
(
folder
==
NULL
)
return
EINVAL
;
if
(
purl
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
purl
=
folder
->
url
;
return
0
;
}
...
...
mailbox/header.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -31,6 +31,7 @@
#include <mailutils/stream.h>
#include <mailutils/address.h>
#include <mailutils/mutil.h>
#include <mailutils/errno.h>
#include <header0.h>
...
...
@@ -451,7 +452,7 @@ header_get_fvalue (header_t header, const char *name, char *buffer,
{
size_t
i
,
fn_len
,
fv_len
=
0
;
size_t
name_len
;
int
err
=
E
NOENT
;
int
err
=
MU_ERR_
NOENT
;
for
(
i
=
0
,
name_len
=
strlen
(
name
);
i
<
header
->
fhdr_count
;
i
++
)
{
...
...
@@ -503,7 +504,7 @@ header_get_value (header_t header, const char *name, char *buffer,
switch
(
err
)
{
case
EINVAL
:
/* Permanent failure. */
err
=
E
NOENT
;
err
=
MU_ERR_
NOENT
;
case
ENOMEM
:
if
(
pn
)
*
pn
=
0
;
...
...
@@ -603,7 +604,7 @@ header_get_value (header_t header, const char *name, char *buffer,
if
(
pn
)
*
pn
=
total
;
return
(
total
==
0
)
?
E
NOENT
:
0
;
return
(
total
==
0
)
?
MU_ERR_
NOENT
:
0
;
}
int
...
...
@@ -701,7 +702,7 @@ header_get_field_name (header_t header, size_t num, char *buf,
}
if
(
header
->
hdr_count
==
0
||
num
>
header
->
hdr_count
||
num
==
0
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
num
--
;
len
=
(
header
->
hdr
[
num
].
fn_end
-
header
->
hdr
[
num
].
fn
);
...
...
@@ -755,7 +756,7 @@ header_get_field_value (header_t header, size_t num, char *buf,
}
if
(
header
->
hdr_count
==
0
||
num
>
header
->
hdr_count
||
num
==
0
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
num
--
;
len
=
header
->
hdr
[
num
].
fv_end
-
header
->
hdr
[
num
].
fv
;
...
...
@@ -828,8 +829,11 @@ header_lines (header_t header, size_t *plines)
{
int
n
;
size_t
lines
=
0
;
if
(
header
==
NULL
||
plines
==
NULL
)
if
(
header
==
NULL
)
return
EINVAL
;
if
(
plines
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
/* Overload. */
if
(
header
->
_lines
)
...
...
@@ -1195,8 +1199,10 @@ header_readline (stream_t is, char *buf, size_t buflen, off_t off, size_t *pn)
int
header_get_stream
(
header_t
header
,
stream_t
*
pstream
)
{
if
(
header
==
NULL
||
pstream
==
NULL
)
if
(
header
==
NULL
)
return
EINVAL
;
if
(
pstream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
header
->
stream
==
NULL
)
{
int
status
=
stream_create
(
&
(
header
->
stream
),
MU_STREAM_RDWR
,
header
);
...
...
mailbox/imap/folder.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -802,7 +802,7 @@ folder_imap_list (folder_t folder, const char *ref, const char *name,
/* NOOP. */
if
(
pflist
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_NUL
L
;
status
=
folder_open
(
folder
,
folder
->
flags
);
if
(
status
!=
0
)
...
...
@@ -960,7 +960,7 @@ folder_imap_lsub (folder_t folder, const char *ref, const char *name,
/* NOOP. */
if
(
pflist
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_NUL
L
;
status
=
folder_open
(
folder
,
folder
->
flags
);
if
(
status
!=
0
)
...
...
@@ -1031,6 +1031,7 @@ folder_imap_rename (folder_t folder, const char *oldpath, const char *newpath)
{
f_imap_t
f_imap
=
folder
->
data
;
int
status
=
0
;
if
(
oldpath
==
NULL
||
newpath
==
NULL
)
return
EINVAL
;
...
...
mailbox/imap/mbox.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -36,6 +36,7 @@
#include <mailutils/debug.h>
#include <mailutils/envelope.h>
#include <mailutils/error.h>
#include <mailutils/errno.h>
#include <mailutils/header.h>
#include <mailutils/message.h>
#include <mailutils/mutil.h>
...
...
@@ -441,7 +442,9 @@ imap_get_message (mailbox_t mailbox, size_t msgno, message_t *pmsg)
msg_imap_t
msg_imap
;
int
status
=
0
;
if
(
pmsg
==
NULL
||
msgno
==
0
||
msgno
>
m_imap
->
messages_count
)
if
(
pmsg
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
msgno
==
0
||
msgno
>
m_imap
->
messages_count
)
return
EINVAL
;
/* Check to see if we have already this message. */
...
...
@@ -1768,7 +1771,7 @@ imap_header_get_value (header_t header, const char *field, char * buffer,
if
(
plen
)
*
plen
=
len
;
if
(
len
==
0
)
status
=
E
NOENT
;
status
=
MU_ERR_
NOENT
;
}
free
(
value
);
return
status
;
...
...
@@ -2057,7 +2060,7 @@ fetch_operation (f_imap_t f_imap, msg_imap_t msg_imap, char *buffer,
/* The server may have timeout any case connection is gone away. */
if
(
status
==
0
&&
f_imap
->
isopen
==
0
&&
f_imap
->
string
.
offset
==
0
)
status
=
EBADF
;
status
=
MU_ERR_CONN_CLOSED
;
if
(
buffer
)
stream_read
(
f_imap
->
string
.
stream
,
buffer
,
buflen
,
0
,
plen
);
...
...
mailbox/iterator.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1999, 2000
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -24,12 +24,15 @@
#include <list0.h>
#include <iterator0.h>
#include <mailutils/errno.h>
int
iterator_create
(
iterator_t
*
piterator
,
list_t
list
)
{
iterator_t
iterator
;
if
(
piterator
==
NULL
||
list
==
NULL
)
if
(
piterator
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
list
==
NULL
)
return
EINVAL
;
iterator
=
calloc
(
sizeof
(
*
iterator
),
1
);
if
(
iterator
==
NULL
)
...
...
@@ -48,7 +51,9 @@ iterator_dup (iterator_t *piterator, iterator_t orig)
{
iterator_t
iterator
;
if
(
piterator
==
NULL
||
orig
==
NULL
)
if
(
piterator
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
orig
==
NULL
)
return
EINVAL
;
iterator
=
calloc
(
sizeof
(
*
iterator
),
1
);
if
(
iterator
==
NULL
)
...
...
@@ -108,7 +113,7 @@ int
iterator_current
(
iterator_t
iterator
,
void
**
pitem
)
{
if
(
!
iterator
->
cur
)
return
E
NOENT
;
return
MU_ERR_
NOENT
;
*
pitem
=
iterator
->
cur
->
item
;
return
0
;
}
...
...
@@ -126,6 +131,8 @@ iterator_get_list (iterator_t iterator, list_t *plist)
{
if
(
!
iterator
)
return
EINVAL
;
if
(
!
plist
)
return
MU_ERR_OUT_PTR_NULL
;
*
plist
=
iterator
->
list
;
return
0
;
}
...
...
mailbox/list.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -24,6 +24,7 @@
#include <list0.h>
#include <iterator0.h>
#include <mailutils/errno.h>
int
list_create
(
list_t
*
plist
)
...
...
@@ -32,7 +33,7 @@ list_create (list_t *plist)
int
status
;
if
(
plist
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
list
=
calloc
(
sizeof
(
*
list
),
1
);
if
(
list
==
NULL
)
return
ENOMEM
;
...
...
@@ -131,8 +132,10 @@ list_is_empty (list_t list)
int
list_count
(
list_t
list
,
size_t
*
pcount
)
{
if
(
list
==
NULL
||
pcount
==
NULL
)
if
(
list
==
NULL
)
return
EINVAL
;
if
(
pcount
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
pcount
=
list
->
count
;
return
0
;
}
...
...
@@ -160,7 +163,7 @@ list_locate (list_t list, void *item, void **ret_item)
{
struct
list_data
*
current
,
*
previous
;
list_comparator_t
comp
;
int
status
=
E
NOENT
;
int
status
=
MU_ERR_
NOENT
;
if
(
list
==
NULL
)
return
EINVAL
;
...
...
@@ -186,7 +189,7 @@ list_insert (list_t list, void *item, void *new_item)
{
struct
list_data
*
current
;
list_comparator_t
comp
;
int
status
=
E
NOENT
;
int
status
=
MU_ERR_
NOENT
;
if
(
list
==
NULL
)
return
EINVAL
;
...
...
@@ -230,7 +233,7 @@ list_remove (list_t list, void *item)
{
struct
list_data
*
current
,
*
previous
;
list_comparator_t
comp
;
int
status
=
E
NOENT
;
int
status
=
MU_ERR_
NOENT
;
if
(
list
==
NULL
)
return
EINVAL
;
...
...
@@ -259,7 +262,7 @@ list_replace (list_t list, void *old_item, void *new_item)
{
struct
list_data
*
current
,
*
previous
;
list_comparator_t
comp
;
int
status
=
E
NOENT
;
int
status
=
MU_ERR_
NOENT
;
if
(
list
==
NULL
)
return
EINVAL
;
...
...
@@ -284,10 +287,12 @@ list_get (list_t list, size_t indx, void **pitem)
{
struct
list_data
*
current
;
size_t
count
;
int
status
=
E
NOENT
;
int
status
=
MU_ERR_
NOENT
;
if
(
list
==
NULL
||
pitem
==
NULL
)
if
(
list
==
NULL
)
return
EINVAL
;
if
(
pitem
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
monitor_rdlock
(
list
->
monitor
);
for
(
current
=
list
->
head
.
next
,
count
=
0
;
current
!=
&
(
list
->
head
);
current
=
current
->
next
,
count
++
)
...
...
mailbox/mailcap.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -55,10 +55,10 @@ mu_mailcap_create (mu_mailcap_t * pmailcap, stream_t stream)
mu_mailcap_t
mailcap
;
int
status
=
0
;
if
(
stream
==
NULL
||
pmailcap
==
NULL
)
{
if
(
stream
==
NULL
)
return
EINVAL
;
}
if
(
pmailcap
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
mailcap
=
calloc
(
1
,
sizeof
(
*
mailcap
));
if
(
mailcap
!=
NULL
)
...
...
@@ -106,10 +106,9 @@ int
mu_mailcap_entries_count
(
mu_mailcap_t
mailcap
,
size_t
*
pcount
)
{
int
status
=
0
;
if
(
mailcap
==
NULL
)
{
status
=
EINVAL
;
}
if
(
pcount
!=
NULL
)
{
*
pcount
=
mailcap
->
entries_count
;
...
...
@@ -122,13 +121,13 @@ mu_mailcap_get_entry (mu_mailcap_t mailcap, size_t no,
mu_mailcap_entry_t
*
pentry
)
{
int
status
=
0
;
if
(
mailcap
==
NULL
||
pentry
==
NULL
)
{
if
(
mailcap
==
NULL
)
status
=
EINVAL
;
}
else
if
(
pentry
==
NULL
)
status
=
MU_ERR_OUT_PTR_NULL
;
else
if
(
no
==
0
||
no
>
mailcap
->
entries_count
)
{
status
=
E
NOENT
;
status
=
MU_ERR_
NOENT
;
}
else
{
...
...
@@ -223,7 +222,7 @@ mu_mailcap_entry_get_field (mu_mailcap_entry_t entry, size_t no,
}
else
if
(
no
==
0
||
no
>
entry
->
fields_count
)
{
status
=
E
NOENT
;
status
=
MU_ERR_
NOENT
;
}
else
{
...
...
mailbox/mailer.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -92,7 +92,7 @@ mailer_create (mailer_t * pmailer, const char *name)
int
found
=
0
;
if
(
pmailer
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
if
(
name
==
NULL
)
mailer_get_url_default
(
&
name
);
...
...
@@ -339,9 +339,10 @@ mailer_set_stream (mailer_t mailer, stream_t stream)
int
mailer_get_stream
(
mailer_t
mailer
,
stream_t
*
pstream
)
{
if
(
mailer
==
NULL
||
pstream
==
NULL
)
if
(
mailer
==
NULL
)
return
EINVAL
;
if
(
pstream
)
if
(
pstream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
pstream
=
mailer
->
stream
;
return
0
;
}
...
...
@@ -350,9 +351,10 @@ int
mailer_get_observable
(
mailer_t
mailer
,
observable_t
*
pobservable
)
{
/* FIXME: I should check for invalid types */
if
(
mailer
==
NULL
||
pobservable
==
NULL
)
if
(
mailer
==
NULL
)
return
EINVAL
;
if
(
pobservable
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
mailer
->
observable
==
NULL
)
{
int
status
=
observable_create
(
&
(
mailer
->
observable
),
mailer
);
...
...
@@ -366,8 +368,10 @@ mailer_get_observable (mailer_t mailer, observable_t * pobservable)
int
mailer_get_property
(
mailer_t
mailer
,
property_t
*
pproperty
)
{
if
(
mailer
==
NULL
||
pproperty
==
NULL
)
if
(
mailer
==
NULL
)
return
EINVAL
;
if
(
pproperty
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
mailer
->
property
==
NULL
)
{
int
status
=
property_create
(
&
(
mailer
->
property
),
mailer
);
...
...
@@ -391,8 +395,10 @@ mailer_set_debug (mailer_t mailer, mu_debug_t debug)
int
mailer_get_debug
(
mailer_t
mailer
,
mu_debug_t
*
pdebug
)
{
if
(
mailer
==
NULL
||
pdebug
==
NULL
)
if
(
mailer
==
NULL
)
return
EINVAL
;
if
(
pdebug
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
mailer
->
debug
==
NULL
)
{
int
status
=
mu_debug_create
(
&
(
mailer
->
debug
),
mailer
);
...
...
@@ -406,8 +412,10 @@ mailer_get_debug (mailer_t mailer, mu_debug_t * pdebug)
int
mailer_get_url
(
mailer_t
mailer
,
url_t
*
purl
)
{
if
(
!
mailer
||
!
purl
)
if
(
!
mailer
)
return
EINVAL
;
if
(
!
purl
)
return
MU_ERR_OUT_PTR_NULL
;
*
purl
=
mailer
->
url
;
return
0
;
}
...
...
mailbox/mapfile_stream.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <mailutils/stream.h>
#include <mailutils/errno.h>
#ifdef _POSIX_MAPPED_FILES
#include <sys/mman.h>
...
...
@@ -347,7 +348,9 @@ mapfile_stream_create (stream_t *stream, const char* filename, int flags)
struct
_mapfile_stream
*
fs
;
int
ret
;
if
(
stream
==
NULL
||
filename
==
NULL
)
if
(
stream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
filename
==
NULL
)
return
EINVAL
;
fs
=
calloc
(
1
,
sizeof
(
struct
_mapfile_stream
));
...
...
mailbox/mbox/folder.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -38,6 +38,7 @@
#include <mailutils/url.h>
#include <mailutils/stream.h>
#include <mailutils/mutil.h>
#include <mailutils/errno.h>
/* We export url parsing and the initialisation of
the mailbox, via the register entry/record. */
...
...
@@ -327,7 +328,7 @@ folder_mbox_lsub (folder_t folder, const char *ref ARG_UNUSED, const char *name,
size_t
j
=
0
;
if
(
pflist
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_NUL
L
;
if
(
name
==
NULL
||
*
name
==
'\0'
)
name
=
"*"
;
...
...
@@ -393,7 +394,7 @@ folder_mbox_unsubscribe (folder_t folder, const char *name)
return
0
;
}
}
return
E
NOENT
;
return
MU_ERR_
NOENT
;
}
static
char
*
...
...
mailbox/mbox/mbox.c
View file @
12be7d8
...
...
@@ -985,7 +985,7 @@ mbox_header_get_fvalue (header_t header, const char *name, char *buffer,
size_t
i
,
fv_len
=
0
;
message_t
msg
=
header_get_owner
(
header
);
mbox_message_t
mum
=
message_get_owner
(
msg
);
int
err
=
E
NOENT
;
int
err
=
MU_ERR_
NOENT
;
for
(
i
=
0
;
i
<
HDRSIZE
;
i
++
)
{
if
(
*
name
==
*
(
fhdr_table
[
i
])
&&
strcasecmp
(
fhdr_table
[
i
],
name
)
==
0
)
...
...
@@ -1004,7 +1004,7 @@ mbox_header_get_fvalue (header_t header, const char *name, char *buffer,
err
=
0
;
}
else
err
=
E
NOENT
;
err
=
MU_ERR_
NOENT
;
break
;
}
}
...
...
@@ -1168,7 +1168,9 @@ mbox_get_message (mailbox_t mailbox, size_t msgno, message_t *pmsg)
message_t
msg
=
NULL
;
/* Sanity checks. */
if
(
pmsg
==
NULL
||
mud
==
NULL
)
if
(
pmsg
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
mud
==
NULL
)
return
EINVAL
;
/* If we did not start a scanning yet do it now. */
...
...
@@ -1288,6 +1290,7 @@ mbox_append_message (mailbox_t mailbox, message_t msg)
{
int
status
=
0
;
mbox_data_t
mud
=
mailbox
->
data
;
if
(
msg
==
NULL
||
mud
==
NULL
)
return
EINVAL
;
...
...
@@ -1661,6 +1664,7 @@ static int
mbox_messages_count
(
mailbox_t
mailbox
,
size_t
*
pcount
)
{
mbox_data_t
mud
=
mailbox
->
data
;
if
(
mud
==
NULL
)
return
EINVAL
;
...
...
mailbox/mbox/url.c
View file @
12be7d8
...
...
@@ -30,6 +30,7 @@
#include <registrar0.h>
#include <url0.h>
#include <mailutils/errno.h>
static
void
url_mbox_destroy
(
url_t
purl
);
...
...
@@ -225,7 +226,7 @@ _url_mbox_init (url_t url)
else
{
url_mbox_destroy
(
url
);
return
E
NOENT
;
return
MU_ERR_
NOENT
;
}
}
else
if
(
strncasecmp
(
p
,
"user="
,
5
)
==
0
)
...
...
@@ -248,7 +249,7 @@ _url_mbox_init (url_t url)
else
{
url_mbox_destroy
(
url
);
return
E
NOENT
;
return
MU_ERR_
NOENT
;
}
}
...
...
mailbox/mbx_default.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -303,7 +303,7 @@ mailbox_create_default (mailbox_t *pmbox, const char *mail)
/* Sanity. */
if
(
pmbox
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
/* Other utilities may not understand GNU mailutils url namespace, so
use FOLDER instead, to not confuse others by using MAIL. */
...
...
mailbox/memory_stream.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <mailutils/stream.h>
#include <mailutils/errno.h>
#undef min
#define min(a,b) ((a) < (b) ? (a) : (b))
...
...
@@ -221,7 +222,7 @@ memory_stream_create (stream_t * stream, const char *filename, int flags)
int
ret
;
if
(
stream
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
mfs
=
calloc
(
1
,
sizeof
(
*
mfs
));
...
...
mailbox/message.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -76,7 +76,7 @@ message_create (message_t *pmsg, void *owner)
int
status
;
if
(
pmsg
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
msg
=
calloc
(
1
,
sizeof
(
*
msg
));
if
(
msg
==
NULL
)
return
ENOMEM
;
...
...
@@ -173,7 +173,9 @@ message_create_copy (message_t *to, message_t from)
size_t
n
=
0
;
char
buf
[
512
];
if
(
!
to
||
!
from
)
if
(
!
to
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
!
from
)
return
EINVAL
;
if
((
status
=
message_create
(
to
,
NULL
)))
...
...
@@ -249,8 +251,10 @@ message_clear_modified (message_t msg)
int
message_get_mailbox
(
message_t
msg
,
mailbox_t
*
pmailbox
)
{
if
(
msg
==
NULL
||
pmailbox
==
NULL
)
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
pmailbox
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
pmailbox
=
msg
->
mailbox
;
return
0
;
}
...
...
@@ -269,8 +273,10 @@ message_set_mailbox (message_t msg, mailbox_t mailbox, void *owner)
int
message_get_header
(
message_t
msg
,
header_t
*
phdr
)
{
if
(
msg
==
NULL
||
phdr
==
NULL
)
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
phdr
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
/* Is it a floating mesg */
if
(
msg
->
header
==
NULL
)
...
...
@@ -311,8 +317,10 @@ message_set_header (message_t msg, header_t hdr, void *owner)
int
message_get_body
(
message_t
msg
,
body_t
*
pbody
)
{
if
(
msg
==
NULL
||
pbody
==
NULL
)
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
pbody
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
/* Is it a floating mesg. */
if
(
msg
->
body
==
NULL
)
...
...
@@ -382,8 +390,10 @@ message_set_stream (message_t msg, stream_t stream, void *owner)
int
message_get_stream
(
message_t
msg
,
stream_t
*
pstream
)
{
if
(
msg
==
NULL
||
pstream
==
NULL
)
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
pstream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
msg
->
stream
==
NULL
)
{
...
...
@@ -478,8 +488,10 @@ message_size (message_t msg, size_t *psize)
int
message_get_envelope
(
message_t
msg
,
envelope_t
*
penvelope
)
{
if
(
msg
==
NULL
||
penvelope
==
NULL
)
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
penvelope
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
msg
->
envelope
==
NULL
)
{
...
...
@@ -512,9 +524,10 @@ message_set_envelope (message_t msg, envelope_t envelope, void *owner)
int
message_get_attribute
(
message_t
msg
,
attribute_t
*
pattribute
)
{
if
(
msg
==
NULL
||
pattribute
==
NULL
)
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
pattribute
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
msg
->
attribute
==
NULL
)
{
attribute_t
attribute
;
...
...
mailbox/mime.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -34,6 +34,7 @@
#include <mailutils/stream.h>
#include <mailutils/body.h>
#include <mailutils/header.h>
#include <mailutils/errno.h>
#include <mime0.h>
#ifndef TRUE
...
...
@@ -407,7 +408,7 @@ _mimepart_body_read (stream_t stream, char *buf, size_t buflen, off_t off,
int
ret
=
0
;
if
(
nbytes
==
NULL
)
return
(
EINVAL
)
;
return
MU_ERR_OUT_NULL
;
*
nbytes
=
0
;
read_len
=
(
int
)
mime_part
->
len
-
(
int
)
off
;
...
...
@@ -761,7 +762,7 @@ mime_create (mime_t * pmime, message_t msg, int flags)
}
else
{
if
(
ret
==
E
NOENT
)
if
(
ret
==
MU_ERR_
NOENT
)
{
ret
=
0
;
if
((
mime
->
content_type
=
...
...
mailbox/monitor.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -33,7 +33,7 @@
#include <stdlib.h>
#include <monitor0.h>
#include <mailutils/errno.h>
#ifdef WITH_PTHREAD
pthread_mutex_t
monitor_lock
=
PTHREAD_MUTEX_INITIALIZER
;
...
...
@@ -82,7 +82,7 @@ monitor_create (monitor_t *pmonitor, int flags, void *owner)
monitor_t
monitor
;
if
(
pmonitor
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
monitor
=
calloc
(
1
,
sizeof
(
*
monitor
));
if
(
monitor
==
NULL
)
...
...
mailbox/mu_auth.c
View file @
12be7d8
...
...
@@ -47,6 +47,8 @@
#include <mailutils/error.h>
#include <mailutils/nls.h>
/* FIXME: The functions from this module assign values to errno and
use ENOENT instead of MU_ERR_NOENT */
/*#define DEBUG(c) do { printf c; printf("\n"); } while (0)*/
#define DEBUG(c)
...
...
mailbox/observer.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1999, 2000
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -24,7 +24,7 @@
#include <mailutils/list.h>
#include <mailutils/iterator.h>
#include <mailutils/errno.h>
#include <observer0.h>
int
...
...
@@ -110,7 +110,7 @@ observable_create (observable_t *pobservable, void *owner)
observable_t
observable
;
int
status
;
if
(
pobservable
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
observable
=
calloc
(
sizeof
(
*
observable
),
1
);
if
(
observable
==
NULL
)
return
ENOMEM
;
...
...
@@ -208,7 +208,7 @@ observable_detach (observable_t observable, observer_t observer)
free
(
event
);
}
else
status
=
E
NOENT
;
status
=
MU_ERR_
NOENT
;
return
status
;
}
...
...
mailbox/pop/mbox.c
View file @
12be7d8
...
...
@@ -1305,7 +1305,7 @@ pop_message_size (message_t msg, size_t *psize)
CLEAR_STATE
(
mpd
);
if
(
status
!=
2
)
status
=
EINVAL
;
status
=
MU_ERR_PARSE
;
/* The size of the message is with the extra '\r' octet for everyline.
Substract to get, hopefully, a good count. */
...
...
@@ -1535,7 +1535,7 @@ pop_uidl (message_t msg, char *buffer, size_t buflen, size_t *pnwriten)
status
=
sscanf
(
mpd
->
buffer
,
"+OK %d %127s
\n
"
,
&
num
,
uniq
);
if
(
status
!=
2
)
{
status
=
EINVAL
;
status
=
MU_ERR_PARSE
;
buflen
=
0
;
}
else
...
...
mailbox/pop/pop3_capa.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -36,8 +36,10 @@ mu_pop3_capa (mu_pop3_t pop3, list_t *plist)
{
int
status
;
if
(
pop3
==
NULL
||
plist
==
NULL
)
if
(
pop3
==
NULL
)
return
EINVAL
;
if
(
plist
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
switch
(
pop3
->
state
)
{
...
...
mailbox/pop/pop3_carrier.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -45,8 +45,10 @@ int
mu_pop3_get_carrier
(
mu_pop3_t
pop3
,
stream_t
*
pcarrier
)
{
/* Sanity checks. */
if
(
pop3
==
NULL
||
pcarrier
==
NULL
)
if
(
pop3
==
NULL
)
return
EINVAL
;
if
(
pcarrier
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
pcarrier
=
pop3
->
carrier
;
return
0
;
...
...
mailbox/pop/pop3_list.c
View file @
12be7d8
...
...
@@ -29,8 +29,10 @@ mu_pop3_list (mu_pop3_t pop3, unsigned int msgno, size_t *psize)
{
int
status
;
if
(
pop3
==
NULL
||
msgno
==
0
||
psize
==
NULL
)
if
(
pop3
==
NULL
||
msgno
==
0
)
return
EINVAL
;
if
(
psize
==
NULL
)
return
MU_ERR_OUT_NULL
;
switch
(
pop3
->
state
)
{
...
...
mailbox/pop/pop3_lista.c
View file @
12be7d8
...
...
@@ -30,8 +30,10 @@ mu_pop3_list_all (mu_pop3_t pop3, list_t *plist)
{
int
status
;
if
(
pop3
==
NULL
||
plist
==
NULL
)
if
(
pop3
==
NULL
)
return
EINVAL
;
if
(
plist
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
switch
(
pop3
->
state
)
{
...
...
mailbox/pop/pop3_retr.c
View file @
12be7d8
...
...
@@ -29,8 +29,10 @@ mu_pop3_retr (mu_pop3_t pop3, unsigned int msgno, stream_t *pstream)
{
int
status
;
if
(
pop3
==
NULL
||
msgno
==
0
||
pstream
==
NULL
)
if
(
pop3
==
NULL
||
msgno
==
0
)
return
EINVAL
;
if
(
pstream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
switch
(
pop3
->
state
)
{
...
...
mailbox/pop/pop3_stat.c
View file @
12be7d8
...
...
@@ -28,8 +28,10 @@ mu_pop3_stat (mu_pop3_t pop3, unsigned *msg_count, size_t *size)
{
int
status
;
if
(
pop3
==
NULL
||
msg_count
==
NULL
||
size
==
NULL
)
if
(
pop3
==
NULL
||
msg_count
==
NULL
)
return
EINVAL
;
if
(
size
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
switch
(
pop3
->
state
)
{
...
...
mailbox/pop/pop3_timeout.c
View file @
12be7d8
...
...
@@ -38,8 +38,10 @@ int
mu_pop3_get_timeout
(
mu_pop3_t
pop3
,
int
*
ptimeout
)
{
/* Sanity checks. */
if
(
pop3
==
NULL
||
ptimeout
==
NULL
)
if
(
pop3
==
NULL
)
return
EINVAL
;
if
(
ptimeout
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
ptimeout
=
pop3
->
timeout
;
return
0
;
...
...
mailbox/pop/pop3_top.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -28,9 +28,10 @@ mu_pop3_top (mu_pop3_t pop3, unsigned msgno, unsigned int lines, stream_t *pstre
{
int
status
;
if
(
pop3
==
NULL
||
msgno
==
0
||
pstream
==
NULL
)
if
(
pop3
==
NULL
||
msgno
==
0
)
return
EINVAL
;
if
(
pstream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
switch
(
pop3
->
state
)
{
...
...
mailbox/pop/pop3_uidl.c
View file @
12be7d8
...
...
@@ -29,8 +29,10 @@ mu_pop3_uidl (mu_pop3_t pop3, unsigned int msgno, char **uidl)
{
int
status
;
if
(
pop3
==
NULL
||
uidl
==
NULL
)
if
(
pop3
==
NULL
)
return
EINVAL
;
if
(
uidl
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
switch
(
pop3
->
state
)
{
...
...
mailbox/pop/pop3_uidla.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -29,8 +29,10 @@ mu_pop3_uidl_all (mu_pop3_t pop3, list_t *plist)
{
int
status
;
if
(
pop3
==
NULL
||
plist
==
NULL
)
if
(
pop3
==
NULL
)
return
EINVAL
;
if
(
plist
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
switch
(
pop3
->
state
)
{
...
...
mailbox/property.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -22,6 +22,7 @@
# include <strings.h>
#endif
#include <mailutils/errno.h>
#include <property0.h>
#undef min
...
...
@@ -35,7 +36,7 @@ property_create (property_t *pp, void *owner)
{
property_t
prop
;
if
(
pp
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
prop
=
calloc
(
1
,
sizeof
*
prop
);
if
(
prop
==
NULL
)
return
ENOMEM
;
...
...
mailbox/refcount.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -31,7 +31,7 @@ mu_refcount_create (mu_refcount_t *prefcount)
int
status
=
0
;
mu_refcount_t
refcount
;
if
(
prefcount
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
refcount
=
calloc
(
1
,
sizeof
*
refcount
);
if
(
refcount
!=
NULL
)
{
...
...
mailbox/registrar.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -29,6 +29,7 @@
#include <mailutils/iterator.h>
#include <mailutils/list.h>
#include <mailutils/monitor.h>
#include <mailutils/errno.h>
#include <registrar0.h>
...
...
@@ -42,7 +43,7 @@ registrar_get_list (list_t *plist)
{
int
status
=
0
;
if
(
plist
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
monitor_wrlock
(
&
registrar_monitor
);
if
(
registrar_list
==
NULL
)
status
=
list_create
(
&
registrar_list
);
...
...
@@ -108,8 +109,10 @@ record_set_is_scheme (record_t record, int (*_is_scheme)
int
record_get_url
(
record_t
record
,
int
(
*
(
*
_purl
))
__P
((
url_t
)))
{
if
(
record
==
NULL
||
_purl
==
NULL
)
if
(
record
==
NULL
)
return
EINVAL
;
if
(
_purl
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
/* Overload. */
if
(
record
->
_get_url
)
return
record
->
_get_url
(
record
,
_purl
);
...
...
@@ -139,8 +142,10 @@ record_set_get_url (record_t record, int (*_get_url)
int
record_get_mailbox
(
record_t
record
,
int
(
*
(
*
_pmailbox
))
__P
((
mailbox_t
)))
{
if
(
record
==
NULL
||
_pmailbox
==
NULL
)
if
(
record
==
NULL
)
return
EINVAL
;
if
(
_pmailbox
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
/* Overload. */
if
(
record
->
_get_mailbox
)
return
record
->
_get_mailbox
(
record
,
_pmailbox
);
...
...
@@ -170,8 +175,10 @@ record_set_get_mailbox (record_t record, int (*_get_mailbox)
int
record_get_mailer
(
record_t
record
,
int
(
*
(
*
_pmailer
))
__P
((
mailer_t
)))
{
if
(
record
==
NULL
||
_pmailer
==
NULL
)
if
(
record
==
NULL
)
return
EINVAL
;
if
(
_pmailer
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
/* Overload. */
if
(
record
->
_get_mailer
)
return
record
->
_get_mailer
(
record
,
_pmailer
);
...
...
@@ -201,8 +208,10 @@ record_set_get_mailer (record_t record, int (*_get_mailer)
int
record_get_folder
(
record_t
record
,
int
(
*
(
*
_pfolder
))
__P
((
folder_t
)))
{
if
(
record
==
NULL
||
_pfolder
==
NULL
)
if
(
record
==
NULL
)
return
EINVAL
;
if
(
_pfolder
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
/* Overload. */
if
(
record
->
_get_folder
)
return
record
->
_get_folder
(
record
,
_pfolder
);
...
...
mailbox/rfc2047.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -38,8 +38,10 @@ rfc2047_decode (const char *tocode, const char *input, char **ptostr)
size_t
bufpos
;
size_t
run_count
=
0
;
if
(
!
tocode
||
!
input
||
!
ptostr
)
if
(
!
tocode
||
!
input
)
return
EINVAL
;
if
(
!
ptostr
)
return
MU_ERR_OUT_PTR_NULL
;
/* Prepare a temporary copy of the input string (strtok_r is
going to modify it. */
...
...
@@ -605,10 +607,10 @@ rfc2047_encode (const char *charset, const char *encoding,
int
is_compose
;
int
state
;
if
(
!
charset
||
!
encoding
||
!
text
||
!
result
)
return
EINVA
L
;
if
(
!
charset
||
!
encoding
||
!
text
)
return
EINVAL
;
if
(
!
result
)
return
MU_ERR_OUT_PTR_NUL
L
;
/* Check for a known encoding */
do
...
...
@@ -633,7 +635,7 @@ rfc2047_encode (const char *charset, const char *encoding,
break
;
}
return
E
NOENT
;
return
MU_ERR_
NOENT
;
}
while
(
0
);
...
...
mailbox/sendmail.c
View file @
12be7d8
...
...
@@ -40,6 +40,7 @@
#include <mailutils/url.h>
#include <mailutils/header.h>
#include <mailutils/body.h>
#include <mailutils/errno.h>
#include <mailer0.h>
#include <registrar0.h>
...
...
@@ -365,6 +366,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from,
header_t
hdr
;
body_t
body
;
int
found_nl
=
0
;
int
exit_status
;
message_get_header
(
msg
,
&
hdr
);
header_get_stream
(
hdr
,
&
stream
);
...
...
@@ -430,7 +432,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from,
close
(
sendmail
->
fd
);
rc
=
waitpid
(
sendmail
->
pid
,
&
status
,
0
);
rc
=
waitpid
(
sendmail
->
pid
,
&
exit_
status
,
0
);
if
(
rc
<
0
)
{
...
...
@@ -439,13 +441,19 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from,
"waitpid(%d) failed: %s
\n
"
,
sendmail
->
pid
,
strerror
(
status
));
}
else
if
(
WIFEXITED
(
status
))
else
if
(
WIFEXITED
(
exit_
status
))
{
status
=
WEXITSTATUS
(
status
);
exit_status
=
WEXITSTATUS
(
exit_
status
);
MAILER_DEBUG2
(
mailer
,
MU_DEBUG_TRACE
,
"%s exited with: %s
\n
"
,
sendmail
->
path
,
strerror
(
status
));
"%s exited with: %d
\n
"
,
sendmail
->
path
,
exit_status
);
status
=
(
exit_status
==
0
)
?
0
:
MU_ERR_PROCESS_EXITED
;
}
else
if
(
WIFSIGNALED
(
exit_status
))
status
=
MU_ERR_PROCESS_SIGNALED
;
else
status
=
MU_ERR_PROCESS_UNKNOWN_FAILURE
;
/* Shouldn't this notification only happen on success? */
observable_notify
(
mailer
->
observable
,
MU_EVT_MAILER_MESSAGE_SENT
);
}
...
...
@@ -453,7 +461,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from,
break
;
}
sendmail
->
state
=
SENDMAIL_OPEN
;
sendmail
->
state
=
(
status
==
0
)
?
SENDMAIL_OPEN
:
SENDMAIL_CLOSED
;
return
status
;
}
...
...
mailbox/smtp.c
View file @
12be7d8
...
...
@@ -500,8 +500,8 @@ message_has_bcc (message_t msg)
status
=
header_get_value
(
header
,
MU_HEADER_BCC
,
NULL
,
0
,
&
bccsz
);
/*
E
NOENT, or there was a Bcc: field. */
return
status
==
E
NOENT
?
0
:
1
;
/*
MU_ERR_
NOENT, or there was a Bcc: field. */
return
status
==
MU_ERR_
NOENT
?
0
:
1
;
}
/*
...
...
@@ -874,7 +874,7 @@ _smtp_set_from (smtp_t smtp, message_t msg, address_t from)
}
break
;
case
E
NOENT
:
case
MU_ERR_
NOENT
:
/* Use the environment. */
mail_from
=
mu_get_user_email
(
NULL
);
...
...
@@ -969,7 +969,7 @@ _smtp_set_rcpt (smtp_t smtp, message_t msg, address_t to)
smtp_address_add
(
&
smtp
->
rcpt_to
,
value
);
free
(
value
);
}
else
if
(
status
!=
E
NOENT
)
else
if
(
status
!=
MU_ERR_
NOENT
)
goto
end
;
status
=
header_aget_value
(
header
,
MU_HEADER_CC
,
&
value
);
...
...
@@ -979,7 +979,7 @@ _smtp_set_rcpt (smtp_t smtp, message_t msg, address_t to)
smtp_address_add
(
&
smtp
->
rcpt_to
,
value
);
free
(
value
);
}
else
if
(
status
!=
E
NOENT
)
else
if
(
status
!=
MU_ERR_
NOENT
)
goto
end
;
status
=
header_aget_value
(
header
,
MU_HEADER_BCC
,
&
value
);
...
...
@@ -988,7 +988,7 @@ _smtp_set_rcpt (smtp_t smtp, message_t msg, address_t to)
smtp_address_add
(
&
smtp
->
rcpt_bcc
,
value
);
free
(
value
);
}
else
if
(
status
!=
E
NOENT
)
else
if
(
status
!=
MU_ERR_
NOENT
)
goto
end
;
/* If to or bcc is present, the must be OK. */
...
...
mailbox/stream.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -36,7 +36,7 @@
#include <string.h>
#include <mailutils/property.h>
#include <mailutils/errno.h>
#include <stream0.h>
static
int
refill
(
stream_t
,
off_t
);
...
...
@@ -52,7 +52,9 @@ int
stream_create
(
stream_t
*
pstream
,
int
flags
,
void
*
owner
)
{
stream_t
stream
;
if
(
pstream
==
NULL
||
owner
==
NULL
)
if
(
pstream
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
owner
==
NULL
)
return
EINVAL
;
stream
=
calloc
(
1
,
sizeof
(
*
stream
));
if
(
stream
==
NULL
)
...
...
@@ -441,8 +443,10 @@ stream_get_fd2 (stream_t stream, int *pfd1, int *pfd2)
int
stream_get_flags
(
stream_t
stream
,
int
*
pfl
)
{
if
(
stream
==
NULL
||
pfl
==
NULL
)
if
(
stream
==
NULL
)
return
EINVAL
;
if
(
pfl
==
NULL
)
return
MU_ERR_OUT_NULL
;
*
pfl
=
stream
->
flags
;
return
0
;
}
...
...
@@ -505,8 +509,10 @@ stream_flush (stream_t stream)
int
stream_get_state
(
stream_t
stream
,
int
*
pstate
)
{
if
(
stream
==
NULL
||
pstate
==
NULL
)
if
(
stream
==
NULL
)
return
EINVAL
;
if
(
pstate
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
pstate
=
stream
->
state
;
return
0
;
}
...
...
mailbox/tcp.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1999, 2000
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -154,7 +154,9 @@ _tcp_get_fd (stream_t stream, int *fd, int *fd2)
{
struct
_tcp_instance
*
tcp
=
stream_get_owner
(
stream
);
if
(
fd
==
NULL
||
tcp
->
fd
==
-
1
)
if
(
fd
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
tcp
->
fd
==
-
1
)
return
EINVAL
;
if
(
fd2
)
return
ENOSYS
;
...
...
@@ -171,7 +173,7 @@ _tcp_read (stream_t stream, char *buf, size_t buf_size, off_t offset, size_t * b
offset
=
offset
;
if
(
br
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_NUL
L
;
*
br
=
0
;
if
((
bytes
=
recv
(
tcp
->
fd
,
buf
,
buf_size
,
0
))
==
-
1
)
{
...
...
@@ -191,7 +193,7 @@ _tcp_write (stream_t stream, const char *buf, size_t buf_size, off_t offset,
offset
=
offset
;
if
(
bw
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_NUL
L
;
*
bw
=
0
;
if
((
bytes
=
send
(
tcp
->
fd
,
buf
,
buf_size
,
0
))
==
-
1
)
{
...
...
mailbox/ticket.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -28,6 +28,7 @@
#include <termios.h>
#include <mailutils/mutil.h>
#include <mailutils/errno.h>
#include <auth0.h>
static
void
...
...
@@ -51,7 +52,7 @@ ticket_create (ticket_t *pticket, void *owner)
{
ticket_t
ticket
;
if
(
pticket
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
ticket
=
calloc
(
1
,
sizeof
(
*
ticket
));
if
(
ticket
==
NULL
)
return
ENOMEM
;
...
...
@@ -114,8 +115,10 @@ ticket_pop (ticket_t ticket, url_t url, const char *challenge, char **parg)
{
int
rc
=
-
1
;
if
(
ticket
==
NULL
||
parg
==
NULL
)
if
(
ticket
==
NULL
)
return
EINVAL
;
if
(
parg
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
if
(
ticket
->
_pop
)
rc
=
ticket
->
_pop
(
ticket
,
url
,
challenge
,
parg
);
if
(
rc
!=
0
&&
isatty
(
fileno
(
stdin
)))
...
...
@@ -149,8 +152,10 @@ ticket_pop (ticket_t ticket, url_t url, const char *challenge, char **parg)
int
ticket_get_data
(
ticket_t
ticket
,
void
**
data
)
{
if
(
ticket
==
NULL
||
data
==
NULL
)
if
(
ticket
==
NULL
)
return
EINVAL
;
if
(
data
==
NULL
)
return
MU_ERR_OUT_PTR_NULL
;
*
data
=
ticket
->
data
;
return
0
;
}
...
...
mailbox/url.c
View file @
12be7d8
...
...
@@ -28,13 +28,9 @@
#endif
#include <mailutils/mutil.h>
#include <mailutils/errno.h>
#include <url0.h>
#ifndef EPARSE
# define EPARSE ENOENT
#endif
/*
TODO: implement functions to create a url and encode it properly.
*/
...
...
@@ -201,7 +197,7 @@ url_parse0 (url_t u, char *name)
p
=
strchr
(
name
,
':'
);
if
(
p
==
NULL
)
{
return
E
PARSE
;
return
MU_ERR_
PARSE
;
}
*
p
++
=
0
;
...
...
@@ -280,7 +276,7 @@ url_parse0 (url_t u, char *name)
/* Check for garbage after the port: we should be on the start
of a path, a query, or at the end of the string. */
if
(
*
p
&&
strcspn
(
p
,
"/?"
)
!=
0
)
return
E
PARSE
;
return
MU_ERR_
PARSE
;
}
else
p
=
u
->
host
+
strcspn
(
u
->
host
,
"/?"
);
...
...
mailbox/wicket.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2003
, 2004
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -55,7 +55,7 @@ wicket_create (wicket_t *pwicket, const char *filename)
struct
stat
st
;
if
(
pwicket
==
NULL
)
return
EINVA
L
;
return
MU_ERR_OUT_PTR_NUL
L
;
if
(
filename
)
{
...
...
mh/mh_ctx.c
View file @
12be7d8
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002
, 2004
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -49,7 +49,7 @@ mh_context_read (mh_context_t *ctx)
FILE
*
fp
;
if
(
!
ctx
)
return
EINVA
L
;
return
MU_ERR_OUT_NUL
L
;
if
(
stat
(
ctx
->
name
,
&
st
))
return
errno
;
...
...
@@ -83,14 +83,14 @@ mh_context_write (mh_context_t *ctx)
FILE
*
fp
;
if
(
!
ctx
)
return
EINVA
L
;
return
MU_ERR_OUT_NUL
L
;
fp
=
fopen
(
ctx
->
name
,
"w"
);
if
(
!
fp
)
{
mh_error
(
_
(
"can't write context file %s: %s"
),
ctx
->
name
,
strerror
(
errno
));
return
1
;
return
MU_ERR_FAILURE
;
}
header_get_stream
(
ctx
->
header
,
&
stream
);
...
...
Please
register
or
sign in
to post a comment