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
fb88ec09
...
fb88ec09f517d42e4bc1a9a45009b12db7602a5d
authored
2004-01-12 12:24:09 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(amd_url_init): New function
1 parent
56f96e76
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
1 deletions
mailbox/amd.c
mailbox/include/amd.h
mailbox/amd.c
View file @
fb88ec0
...
...
@@ -65,6 +65,7 @@
#include <mailutils/observer.h>
#include <mailbox0.h>
#include <registrar0.h>
#include <url0.h>
#include <amd.h>
static
void
amd_destroy
__P
((
mailbox_t
mailbox
));
...
...
@@ -197,7 +198,6 @@ static int
amd_open
(
mailbox_t
mailbox
,
int
flags
)
{
struct
_amd_data
*
amd
=
mailbox
->
data
;
int
status
=
0
;
struct
stat
st
;
mailbox
->
flags
=
flags
;
...
...
@@ -1314,3 +1314,50 @@ amd_envelope_sender (envelope_t envelope, char *buf, size_t len, size_t *psize)
return
0
;
}
static
void
amd_url_destroy
(
url_t
url
ARG_UNUSED
)
{
}
int
amd_url_init
(
url_t
url
,
const
char
*
scheme
)
{
const
char
*
name
=
url_to_string
(
url
);
const
char
*
path_ptr
=
name
;
size_t
len
=
strlen
(
name
);
size_t
scheme_len
=
strlen
(
scheme
);
if
(
!
name
)
return
0
;
if
(
strncmp
(
MU_PATH_SCHEME
,
name
,
MU_PATH_SCHEME_LEN
)
==
0
)
path_ptr
=
name
;
/* reject the obvious */
else
if
(
strncmp
(
scheme
,
name
,
scheme_len
)
!=
0
||
len
<
scheme_len
+
1
)
return
EINVAL
;
else
path_ptr
=
name
+
scheme_len
;
/* TYPE */
url
->
_destroy
=
amd_url_destroy
;
/* SCHEME */
url
->
scheme
=
strdup
(
scheme
);
if
(
url
->
scheme
==
NULL
)
{
amd_url_destroy
(
url
);
return
ENOMEM
;
}
/* PATH */
url
->
path
=
strdup
(
path_ptr
);
if
(
url
->
path
==
NULL
)
{
amd_url_destroy
(
url
);
return
ENOMEM
;
}
return
0
;
}
...
...
mailbox/include/amd.h
View file @
fb88ec0
...
...
@@ -97,3 +97,4 @@ void _amd_message_insert __P((struct _amd_data *mhd,
int
amd_message_stream_open
__P
((
struct
_amd_message
*
mhm
));
void
amd_message_stream_close
__P
((
struct
_amd_message
*
mhm
));
void
amd_cleanup
(
void
*
arg
);
int
amd_url_init
(
url_t
url
,
const
char
*
scheme
);
...
...
Please
register
or
sign in
to post a comment