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
d8d1ab2f
...
d8d1ab2f11e4a14506f054f2afc48ad0808c6a5a
authored
1999-12-22 05:01:01 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Makefile.am _cpystr.c chewurl.c cpystr.h url.c url_mbox.c
url_pop.c thighning up things.
1 parent
06e9cb84
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
28 deletions
url/Makefile.am
url/_cpystr.c
url/chewurl.c
url/cpystr.h
url/url.c
url/url_mbox.c
url/url_pop.c
url/Makefile.am
View file @
d8d1ab2
...
...
@@ -4,12 +4,13 @@ AUTOMAKE_OPTIONS = ../lib/ansi2knr
CFLAGS
=
-Wall -pedantic -g
include_HEADERS
=
url.h url_mbox.h url_pop.h url_imap.h url_mailto.h
include_HEADERS
=
url.h url_mbox.h url_unix.h url_mdir.h url_mmdf.h url_pop.h
\
url_imap.h url_mail.h
noinst_HEADERS
=
cpystr.h
base_sources
=
_cpystr.c url.c urli.c url_
imap.c url_mailto
.c
\
url_m
box.c url_pop
.c
base_sources
=
_cpystr.c url.c urli.c url_
mbox.c url_unix.c url_mdir
.c
\
url_m
mdf.c url_pop.c url_imap.c url_mail
.c
chewurl_SOURCES
=
$(base_sources)
chewurl.c
...
...
url/_cpystr.c
View file @
d8d1ab2
...
...
@@ -19,7 +19,7 @@
#include <string.h>
int
_cpystr
(
c
onst
char
*
src
,
char
*
dst
,
unsigned
int
size
)
_cpystr
(
c
har
*
dst
,
const
char
*
src
,
unsigned
int
size
)
{
unsigned
int
len
=
src
?
strlen
(
src
)
:
0
;
...
...
url/chewurl.c
View file @
d8d1ab2
#include <url.h>
#include <url_pop.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int
main
(
int
argc
,
char
**
argv
)
main
()
{
int
status
,
i
;
long
port
;
...
...
url/cpystr.h
View file @
d8d1ab2
...
...
@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _
URL0
_H
#define _
URL0
_H
#ifndef _
CPYSTR
_H
#define _
CPYSTR
_H
#ifndef __P
# ifdef __STDC__
...
...
@@ -25,6 +25,6 @@
# define __P(x)
# endif
#endif
extern
int
_cpystr
__P
((
c
onst
char
*
src
,
char
*
dst
,
unsigned
int
size
));
extern
int
_cpystr
__P
((
c
har
*
dst
,
const
char
*
src
,
unsigned
int
size
));
#endif
...
...
url/url.c
View file @
d8d1ab2
...
...
@@ -16,9 +16,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <url_mbox.h>
#include <url_unix.h>
#include <url_mdir.h>
#include <url_mmdf.h>
#include <url_pop.h>
#include <url_imap.h>
#include <url_mail
to
.h>
#include <url_mail.h>
#include <cpystr.h>
#include <string.h>
...
...
@@ -46,8 +49,11 @@ static struct url_builtin
}
url_builtin
[]
=
{
{
NULL
,
0
,
&
url_builtin
[
1
]
},
/* Sentinel, head list */
{
&
_url_mbox_type
,
0
,
&
url_builtin
[
2
]
},
{
&
_url_pop_type
,
0
,
&
url_builtin
[
3
]
},
{
&
_url_imap_type
,
0
,
&
url_builtin
[
4
]
},
{
&
_url_unix_type
,
0
,
&
url_builtin
[
3
]
},
{
&
_url_maildir_type
,
0
,
&
url_builtin
[
4
]
},
{
&
_url_mmdf_type
,
0
,
&
url_builtin
[
5
]
},
{
&
_url_pop_type
,
0
,
&
url_builtin
[
6
]
},
{
&
_url_imap_type
,
0
,
&
url_builtin
[
7
]
},
{
&
_url_mailto_type
,
0
,
&
url_builtin
[
0
]
},
};
...
...
@@ -108,7 +114,8 @@ url_list_mtype (struct url_type **mlist, int *n)
struct
url_type
*
utype
;
int
i
;
if
((
i
=
url_list_type
(
NULL
,
0
))
<=
0
||
(
utype
=
malloc
(
i
))
==
NULL
)
if
((
i
=
url_list_type
(
NULL
,
0
))
<=
0
||
(
utype
=
calloc
(
i
,
sizeof
(
*
utype
)))
==
NULL
)
{
return
-
1
;
}
...
...
@@ -188,13 +195,13 @@ url_destroy (url_t *purl)
static
int
get_scheme
(
const
url_t
u
,
char
*
s
,
int
n
)
{
return
_cpystr
(
u
->
scheme
,
s
,
n
);
return
_cpystr
(
s
,
u
->
scheme
,
n
);
}
static
int
get_user
(
const
url_t
u
,
char
*
s
,
int
n
)
{
return
_cpystr
(
u
->
user
,
s
,
n
);
return
_cpystr
(
s
,
u
->
user
,
n
);
}
/* FIXME: We should not store passwd in clear, but rather
...
...
@@ -202,13 +209,13 @@ get_user (const url_t u, char * s, int n)
static
int
get_passwd
(
const
url_t
u
,
char
*
s
,
int
n
)
{
return
_cpystr
(
u
->
passwd
,
s
,
n
);
return
_cpystr
(
s
,
u
->
passwd
,
n
);
}
static
int
get_host
(
const
url_t
u
,
char
*
s
,
int
n
)
{
return
_cpystr
(
u
->
host
,
s
,
n
);
return
_cpystr
(
s
,
u
->
host
,
n
);
}
static
int
...
...
@@ -221,13 +228,13 @@ get_port (const url_t u, long * p)
static
int
get_path
(
const
url_t
u
,
char
*
s
,
int
n
)
{
return
_cpystr
(
u
->
path
,
s
,
n
);
return
_cpystr
(
s
,
u
->
path
,
n
);
}
static
int
get_query
(
const
url_t
u
,
char
*
s
,
int
n
)
{
return
_cpystr
(
u
->
query
,
s
,
n
);
return
_cpystr
(
s
,
u
->
query
,
n
);
}
static
int
...
...
url/url_mbox.c
View file @
d8d1ab2
...
...
@@ -51,10 +51,11 @@ url_mbox_init (url_t *purl, const char *name)
{
url_t
url
;
int
len
;
struct
url_type
*
utype
=
&
_url_mbox_type
;
/* reject the obvious */
if
(
name
==
NULL
||
strncmp
(
"file://"
,
name
,
7
)
!=
0
||
(
len
=
strlen
(
name
))
<
8
/* 7(scheme)+1(path)*/
)
if
(
name
==
NULL
||
strncmp
(
utype
->
scheme
,
name
,
utype
->
len
)
!=
0
||
(
len
=
strlen
(
name
))
<
utype
->
len
+
1
/* 7(scheme)+1(path)*/
)
{
return
-
1
;
}
...
...
@@ -72,24 +73,24 @@ url_mbox_init (url_t *purl, const char *name)
/* SCHEME */
/* strdup ("file://") the hard way */
url
->
scheme
=
malloc
(
7
+
1
);
url
->
scheme
=
malloc
(
utype
->
len
+
1
);
if
(
url
->
scheme
==
NULL
)
{
u
rl_mbox
_destroy
(
&
url
);
u
type
->
_destroy
(
&
url
);
return
-
1
;
}
memcpy
(
url
->
scheme
,
"file://"
,
8
);
memcpy
(
url
->
scheme
,
utype
->
scheme
,
utype
->
len
+
1
/* including the NULL */
);
/* PATH */
name
+=
7
;
/* pass the scheme */
len
-=
7
;
name
+=
utype
->
len
;
/* pass the scheme */
len
-=
utype
->
len
;
/* decremente the len */
url
->
path
=
malloc
(
len
+
1
);
if
(
url
->
path
==
NULL
)
{
u
rl_mbox
_destroy
(
&
url
);
u
type
->
_destroy
(
&
url
);
return
-
1
;
}
memcpy
(
url
->
path
,
name
,
len
+
1
);
memcpy
(
url
->
path
,
name
,
len
+
1
/* including the NULL */
);
*
purl
=
url
;
return
0
;
...
...
url/url_pop.c
View file @
d8d1ab2
...
...
@@ -33,7 +33,7 @@ static int get_auth (const url_pop_t up, char *s, int n);
static
int
get_auth
(
const
url_pop_t
up
,
char
*
s
,
int
n
)
{
return
_cpystr
(
up
->
auth
,
s
,
n
);
return
_cpystr
(
s
,
up
->
auth
,
n
);
}
int
...
...
Please
register
or
sign in
to post a comment