Commit ff8d17bd ff8d17bdc5d74ef0a692271ac12dbed6c4409fda by Alain Magloire

_cpystr.c chewurl.c cpystr.h test_url url.c url.h url_mbox.c

 	url_mdir.c url_pop.c url_pop.h url_unix.c urli.c
tight things up.
1 parent 3f5059d8
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
......@@ -17,11 +17,12 @@
#include <cpystr.h>
#include <string.h>
#include <errno.h>
int
_cpystr (char *dst, const char *src, unsigned int size)
size_t
_cpystr (char *dst, const char *src, size_t size)
{
unsigned int len = src ? strlen (src) : 0 ;
size_t len = src ? strlen (src) : 0 ;
if (dst == NULL || size == 0)
{
......
......@@ -13,6 +13,7 @@ main ()
char buffer[1024];
char str[1024];
struct url_type *utype;
size_t len = sizeof (buffer);
url_list_mtype (&utype, &status);
for (i = 0; i < status; i++)
......@@ -26,30 +27,36 @@ main ()
{
str[strlen(str) - 1] = '\0'; /* chop newline */
status = url_init (&u, str);
if (status == -1) {
if (status != 0) {
printf("%s --> FAILED\n", str);
continue;
}
printf("%s --> SUCCESS\n", str);
url_get_scheme (u, buffer, sizeof (buffer));
url_get_scheme (u, buffer, len, NULL);
printf("\tscheme <%s>\n", buffer);
url_get_user (u, buffer, sizeof (buffer));
url_get_user (u, buffer, len, NULL);
printf("\tuser <%s>\n", buffer);
url_get_passwd (u, buffer, sizeof (buffer));
url_get_passwd (u, buffer, len, NULL);
printf("\tpasswd <%s>\n", buffer);
url_pop_get_auth (u, buffer, sizeof (buffer));
printf("\tauth <%s>\n", buffer);
//url_pop_get_auth (u, buffer, len, NULL);
//printf("\tauth <%s>\n", buffer);
url_get_host (u, buffer, sizeof (buffer));
url_get_host (u, buffer, len, NULL);
printf("\thost <%s>\n", buffer);
url_get_port (u, &port);
printf("\tport %ld\n", port);
url_get_path (u, buffer, len, NULL);
printf("\tpath <%s>\n", buffer);
url_get_query (u, buffer, len, NULL);
printf("\tquery <%s>\n", buffer);
url_destroy (&u);
}
return 0;
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
......@@ -18,13 +18,23 @@
#ifndef _CPYSTR_H
#define _CPYSTR_H
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __P
# ifdef __STDC__
# if __STDC__
# define __P(x) x
# else
# define __P(x)
# endif
#endif
extern int _cpystr __P ((char *dst, const char *src, unsigned int size));
extern size_t _cpystr __P ((char *dst, const char *src, size_t size));
#ifdef __cplusplus
}
#endif
#endif
......
file:///usr/spool/alain
pop://<user>;auth=<auth>@<host>:<port>
pop://rg@mailsrv.qualcomm.com
pop://rg;AUTH=+APOP@mail.eudora.com:8110
......@@ -6,3 +7,9 @@ pop://me
pop:/joe@qnx.com
pop://;Auth=+me@joe
pop://alain;ATU=me@joe
unix:///var/mail/alain
unix://usr/spool/mail
file:///usr/spool/alain
mdir://home/alain
mmdf://u
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
......@@ -29,14 +29,20 @@
#include <errno.h>
/* Forward prototypes */
static int get_scheme (const url_t, char *, int);
static int get_user (const url_t, char *, int);
static int get_passwd (const url_t, char *, int);
static int get_host (const url_t, char *, int);
static int get_port (const url_t, long *);
static int get_path (const url_t, char *, int);
static int get_query (const url_t, char *, int);
static int get_id (const url_t, int *id);
static int get_scheme (const url_t, char *, size_t, size_t *);
static int get_mscheme (const url_t, char **, size_t *);
static int get_user (const url_t, char *, size_t, size_t *);
static int get_muser (const url_t, char **, size_t *);
static int get_passwd (const url_t, char *, size_t, size_t *);
static int get_mpasswd (const url_t, char **, size_t *);
static int get_host (const url_t, char *, size_t, size_t *);
static int get_mhost (const url_t, char **, size_t *);
static int get_port (const url_t, long *);
static int get_path (const url_t, char *, size_t, size_t *);
static int get_mpath (const url_t, char **, size_t *);
static int get_query (const url_t, char *, size_t, size_t *);
static int get_mquery (const url_t, char **, size_t *);
static int get_id (const url_t, int *id);
/*
Builtin url types.
......@@ -94,34 +100,42 @@ url_remove_type (const struct url_type *utype)
}
int
url_list_type (struct url_type *list, int n)
url_list_type (struct url_type *list, size_t len, size_t *n)
{
struct url_builtin *current;
int i;
size_t i = 0;
for (i = 0, current = url_builtin->next; current != url_builtin;
current = current->next, i++)
{
if (list)
if (i < n)
list[i] = *(current->utype);
{
if (i < len)
list[i] = *(current->utype);
else
break;
}
}
return i;
if (n)
*n = i;
return 0;
}
int
url_list_mtype (struct url_type **mlist, int *n)
url_list_mtype (struct url_type **mlist, size_t *n)
{
struct url_type *utype;
int i;
size_t i;
if ((i = url_list_type (NULL, 0)) <= 0
|| (utype = calloc (i, sizeof (*utype))) == NULL)
url_list_type (NULL, 0, &i);
utype = calloc (i, sizeof (*utype));
if (utype == NULL)
{
return -1;
return ENOMEM;
}
*mlist = utype;
return *n = url_list_type (utype, i);
url_list_type (utype, i, n);
return 0;
}
int
......@@ -159,18 +173,30 @@ url_init (url_t * purl, const char *name)
url->utype = utype;
if (url->_get_scheme == NULL)
url->_get_scheme = get_scheme;
if (url->_get_mscheme == NULL)
url->_get_mscheme = get_mscheme;
if (url->_get_user == NULL)
url->_get_user = get_user;
if (url->_get_muser == NULL)
url->_get_muser = get_muser;
if (url->_get_passwd == NULL)
url->_get_passwd = get_passwd;
if (url->_get_mpasswd == NULL)
url->_get_mpasswd = get_mpasswd;
if (url->_get_host == NULL)
url->_get_host = get_host;
if (url->_get_mhost == NULL)
url->_get_mhost = get_mhost;
if (url->_get_port == NULL)
url->_get_port = get_port;
if (url->_get_path == NULL)
url->_get_path = get_path;
if (url->_get_mpath == NULL)
url->_get_mpath = get_mpath;
if (url->_get_query == NULL)
url->_get_query = get_query;
if (url->_get_mquery == NULL)
url->_get_mquery = get_mquery;
if (url->_get_id == NULL)
url->_get_id = get_id;
}
......@@ -193,29 +219,117 @@ url_destroy (url_t *purl)
/* Simple stub functions they all call _cpystr */
static int
get_scheme (const url_t u, char * s, int n)
get_scheme (const url_t u, char *s, size_t len, size_t *n)
{
return _cpystr (s, u->scheme, n);
size_t i;
if (u == NULL)
return EINVAL;
i = _cpystr (s, u->scheme, len);
if (n)
*n = i;
return 0;
}
static int
get_mscheme (const url_t u, char **s, size_t *n)
{
size_t i;
if (u == NULL || s == NULL || u->_get_scheme (u, NULL, 0, &i) != 0)
{
return EINVAL;
}
*s = malloc (++i);
if (*s == NULL)
{
return ENOMEM;
}
u->_get_scheme (u, *s, 0, n);
return 0;
}
static int
get_user (const url_t u, char * s, int n)
get_user (const url_t u, char *s, size_t len, size_t *n)
{
return _cpystr (s, u->user, n);
size_t i;
if (u == NULL)
return EINVAL;
i = _cpystr (s, u->user, len);
if (n)
*n = i;
return 0;
}
static int
get_muser (const url_t u, char **s, size_t *n)
{
size_t i;
if (u == NULL || s == NULL || u->_get_user (u, NULL, 0, &i) != 0)
{
return EINVAL;
}
*s = malloc (++i);
if (*s == NULL)
{
return ENOMEM;
}
u->_get_user (u, *s, i, n);
return 0;
}
/* FIXME: We should not store passwd in clear, but rather
have a simple encoding, and decoding mechanism */
static int
get_passwd (const url_t u, char * s, int n)
get_passwd (const url_t u, char *s, size_t len, size_t *n)
{
return _cpystr (s, u->passwd, n);
size_t i;
if (u == NULL)
return EINVAL;
i = _cpystr (s, u->passwd, len);
if (n)
*n = i;
return 0;
}
static int
get_mpasswd (const url_t u, char **s, size_t *n)
{
size_t i;
if (u == NULL || s == NULL || u->_get_passwd (u, NULL, 0, &i) != 0)
{
return EINVAL;
}
*s = malloc (++i);
if (*s == NULL)
{
return ENOMEM;
}
u->_get_passwd (u, *s, i, n);
return 0;
}
static int
get_host (const url_t u, char * s, int n)
get_host (const url_t u, char *s, size_t len, size_t *n)
{
return _cpystr (s, u->host, n);
size_t i;
if (u == NULL)
return EINVAL;
i = _cpystr (s, u->host, len);
if (n)
*n = i;
return 0;
}
static int
get_mhost (const url_t u, char **s, size_t *n)
{
size_t i;
if (u == NULL || s == NULL || u->_get_host (u, NULL, 0, &i) != 0)
{
return EINVAL;
}
*s = malloc (++i);
if (*s == NULL)
{
return ENOMEM;
}
u->_get_host (u, *s, i, n);
return 0;
}
static int
......@@ -226,15 +340,59 @@ get_port (const url_t u, long * p)
}
static int
get_path (const url_t u, char * s, int n)
get_path (const url_t u, char *s, size_t len, size_t *n)
{
return _cpystr(s, u->path, n);
size_t i;
if (u == NULL)
return EINVAL;
i = _cpystr(s, u->path, len);
if (n)
*n = i;
return 0;
}
static int
get_mpath (const url_t u, char **s, size_t *n)
{
size_t i;
if (u == NULL || s == NULL || u->_get_path (u, NULL, 0, &i) != 0)
{
return EINVAL;
}
*s = malloc (++i);
if (*s == NULL)
{
return ENOMEM;
}
u->_get_path (u, *s, i, n);
return 0;
}
static int
get_query (const url_t u, char * s, int n)
get_query (const url_t u, char *s, size_t len, size_t *n)
{
size_t i;
if (u == NULL)
return EINVAL;
i = _cpystr(s, u->query, len);
if (n)
*n = i;
return 0;
}
static int
get_mquery (const url_t u, char **s, size_t *n)
{
return _cpystr(s, u->query, n);
size_t i;
if (u == NULL || s == NULL || u->_get_query (u, NULL, 0, &i) != 0)
{
return EINVAL;
}
*s = malloc (++i);
if (*s == NULL)
{
return ENOMEM;
}
u->_get_query (u, *s, i, n);
return 0;
}
static int
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -18,12 +18,15 @@
#ifndef _URL_H
#define _URL_H 1
#include <sys/types.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __P
# ifdef __STDC__
# if __STDC__
# define __P(args) args
# else
# define __P(args) ()
......@@ -37,7 +40,7 @@ typedef struct _url * url_t;
struct url_type
{
char *scheme;
int len;
size_t len;
char *description;
int id;
int (*_init) __P ((url_t *, const char * name));
......@@ -59,21 +62,40 @@ struct _url
const struct url_type * utype;
/* Methods */
int (*_get_scheme) __P ((const url_t, char *scheme, int len));
int (*_get_user) __P ((const url_t, char *user, int len));
int (*_get_passwd) __P ((const url_t, char *passwd, int len));
int (*_get_host) __P ((const url_t, char *host, int len));
int (*_get_port) __P ((const url_t, long *port));
int (*_get_path) __P ((const url_t, char *path, int len));
int (*_get_query) __P ((const url_t, char *query, int len));
int (*_get_id) __P ((const url_t, int *id));
int (*_get_scheme) __P ((const url_t, char *scheme,
size_t len, size_t *n));
int (*_get_mscheme) __P ((const url_t, char **, size_t *n));
int (*_get_user) __P ((const url_t, char *user,
size_t len, size_t *n));
int (*_get_muser) __P ((const url_t, char **, size_t *n));
int (*_get_passwd) __P ((const url_t, char *passwd,
size_t len, size_t *n));
int (*_get_mpasswd) __P ((const url_t, char **, size_t *n));
int (*_get_host) __P ((const url_t, char *host,
size_t len, size_t *n));
int (*_get_mhost) __P ((const url_t, char **, size_t *n));
int (*_get_port) __P ((const url_t, long *port));
int (*_get_path) __P ((const url_t, char *path,
size_t len, size_t *n));
int (*_get_mpath) __P ((const url_t, char **, size_t *n));
int (*_get_query) __P ((const url_t, char *query,
size_t len, size_t *n));
int (*_get_mquery) __P ((const url_t, char **, size_t *n));
int (*_get_id) __P ((const url_t, int *id));
};
extern int url_init __P ((url_t *, const char *name));
extern void url_destroy __P ((url_t *));
extern int url_list_type __P ((struct url_type list[], int len));
extern int url_list_mtype __P ((struct url_type *mlist[], int *len));
extern int url_list_type __P ((struct url_type list[], size_t l, size_t *n));
extern int url_list_mtype __P ((struct url_type **mlist, size_t *n));
extern int url_add_type __P ((struct url_type *utype));
extern int url_remove_type __P ((const struct url_type *utype));
......@@ -83,24 +105,42 @@ extern int url_remove_type __P ((const struct url_type *utype));
# define INLINE
#endif
extern INLINE int url_get_scheme __P ((const url_t, char *scheme, int len));
extern INLINE int url_get_user __P ((const url_t, char *user, int len));
extern INLINE int url_get_passwd __P ((const url_t, char *passwd, int len));
extern INLINE int url_get_host __P ((const url_t, char *host, int len));
extern INLINE int url_get_scheme __P ((const url_t, char *sch,
size_t, size_t *));
extern INLINE int url_get_mscheme __P ((const url_t, char **, size_t *));
extern INLINE int url_get_user __P ((const url_t, char *usr,
size_t, size_t *));
extern INLINE int url_get_muser __P ((const url_t, char **, size_t *));
extern INLINE int url_get_passwd __P ((const url_t, char *passwd,
size_t, size_t *));
extern INLINE int url_get_mpasswd __P ((const url_t, char **, size_t *));
extern INLINE int url_get_host __P ((const url_t, char *host,
size_t, size_t *));
extern INLINE int url_get_mhost __P ((const url_t, char **, size_t *));
extern INLINE int url_get_port __P ((const url_t, long *port));
extern INLINE int url_get_path __P ((const url_t, char *path, int len));
extern INLINE int url_get_query __P ((const url_t, char *query, int len));
extern INLINE int url_get_id __P ((const url_t, int *id));
extern INLINE int url_get_path __P ((const url_t, char *path,
size_t, size_t *));
extern INLINE int url_get_mpath __P ((const url_t, char **, size_t *));
extern INLINE int url_get_query __P ((const url_t, char *qeury,
size_t, size_t *));
extern INLINE int url_get_mquery __P ((const url_t, char **, size_t *));
extern INLINE int url_get_id __P ((const url_t, int *id));
#ifdef URL_MACROS
# define url_get_scheme(url, scheme, n) url->_get_scheme (url, scheme, n)
# define url_get_user(url, user, n) url->_get_user (url, user, n)
# define url_get_passwd(url, passwd, n) url->_get_passwd (url, passwd, n)
# define url_get_host(url, host, n) url->_get_host (url, host, n)
# define url_get_port(url, port) url->_get_port (url, port)
# define url_get_path(url, path, n) url->_get_path (url, path, n)
# define url_get_query(url, query, n) url->_get_query (url, query, n)
# define url_get_id(url, id) url->_get_id (url, id)
# define url_get_scheme(url, scheme, l, n) url->_get_scheme (url, scheme,l, n)
# define url_get_mscheme(url, mscheme, n) url->_get_mscheme (url, mscheme, n)
# define url_get_user(url, user, l, n) url->_get_user (url, user, l, n)
# define url_get_muser(url, muser, n) url->_get_muser (url, muser, n)
# define url_get_passwd(url, passwd, l, n) url->_get_passwd (url, passwd, l, n)
# define url_get_mpasswd(url, mpasswd, n) url->_get_mpasswd (url, mpasswd, n)
# define url_get_host(url, host, l, n) url->_get_host (url, host, l, n)
# define url_get_mhost(url, mhost, n) url->_get_mhost (url, mhost, n)
# define url_get_port(url, port) url->_get_port (url, port)
# define url_get_path(url, path, l, n) url->_get_path (url, path, l, n)
# define url_get_mpath(url, mpath, n) url->_get_mpath (url, mpath, n)
# define url_get_query(url, query, l, n) url->_get_query (url, query, l, n)
# define url_get_mquery(url, mquery, n) url->_get_mquery (url, mquery, n)
# define url_get_id(url, id) url->_get_id (url, id)
#endif /* URL_MACROS */
#ifdef __cplusplus
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -50,7 +50,7 @@ int
url_mbox_init (url_t *purl, const char *name)
{
url_t url;
int len;
size_t len;
struct url_type *utype = &_url_mbox_type;
/* reject the obvious */
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -50,7 +50,7 @@ int
url_maildir_init (url_t *purl, const char *name)
{
url_t url;
int len;
size_t len;
struct url_type *utype = &_url_maildir_type;
/* reject the obvious */
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -19,6 +19,7 @@
#include <cpystr.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
struct url_type _url_pop_type =
{
......@@ -28,18 +29,25 @@ struct url_type _url_pop_type =
url_pop_init, url_pop_destroy
};
static int get_auth (const url_pop_t up, char *s, int n);
static int get_auth (const url_pop_t up, char *s, size_t len, size_t *);
static int
get_auth (const url_pop_t up, char * s, int n)
get_auth (const url_pop_t up, char *s, size_t len, size_t *n)
{
return _cpystr (s, up->auth, n);
size_t i;
if (up)
return EINVAL;
i = _cpystr (s, up->auth, len);
if (n)
*n = i;
return 0;
}
int
(url_pop_get_auth) (const url_t url, char * auth, int n)
(url_pop_get_auth) (const url_t url, char *auth, size_t len, size_t *n)
{
return ((url_pop_t) (url->data))->_get_auth(url->data, auth, n);
return (url) ? ((url_pop_t)(url->data))->_get_auth(url->data, auth, len, n)
: EINVAL;
}
void
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -41,7 +41,7 @@ struct _url_pop
/* we use the fields from url_t */
/* user, passwd, host, port */
char * auth;
int (*_get_auth) __P ((const url_pop_t, char *, int));
int (*_get_auth) __P ((const url_pop_t, char *, size_t, size_t *));
};
extern int url_pop_init __P ((url_t *, const char *name));
......@@ -60,12 +60,12 @@ extern struct url_type _url_pop_type;
#endif
/* pop*/
extern int url_pop_get_auth (const url_t, char *, int);
extern int url_pop_get_auth (const url_t, char *, size_t, size_t *);
#ifdef MU_URL_MACROS
/* pop */
# define url_pop_get_auth(url, auth, n) (((url_pop_t) \
(url->data))->_get_auth(url->data, auth, n))
# define url_pop_get_auth(url, auth, l, n) (((url_pop_t) \
(url->data))->_get_auth(url->data, auth, l, n))
#endif /* MU_URL_MACROS */
#ifdef __cplusplus
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
......@@ -50,7 +50,7 @@ int
url_unix_init (url_t *purl, const char *name)
{
url_t url;
int len;
size_t len;
struct url_type *utype = &_url_unix_type;
/* reject the obvious */
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
......@@ -16,35 +16,74 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <url.h>
#include <errno.h>
int
(url_get_scheme) (const url_t url, char *scheme, int n)
{ return url->_get_scheme(url, scheme, n); }
int (url_get_scheme) (const url_t url, char *scheme, size_t len, size_t *n)
{
return (url) ? url->_get_scheme(url, scheme, len, n) : EINVAL;
}
int
(url_get_user) (const url_t url, char *user, int n)
{ return url->_get_user(url, user, n); }
int (url_get_mscheme) (const url_t url, char **mscheme, size_t *n)
{
return (url) ? url->_get_mscheme(url, mscheme, n) : EINVAL;
}
int
(url_get_passwd) (const url_t url, char *passwd, int n)
{ return url->_get_passwd(url, passwd, n); }
int (url_get_user) (const url_t url, char *user, size_t len, size_t *n)
{
return (url) ? url->_get_user(url, user, len, n) : EINVAL;
}
int
(url_get_host) (const url_t url, char *host, int n)
{ return url->_get_host(url, host, n); }
int (url_get_muser) (const url_t url, char **muser, size_t *n)
{
return (url) ? url->_get_muser(url, muser, n) : EINVAL;
}
int
(url_get_port) (const url_t url, long *port)
{ return url->_get_port(url, port); }
int (url_get_passwd) (const url_t url, char *passwd, size_t len, size_t *n)
{
return (url) ? url->_get_passwd(url, passwd, len, n) : EINVAL;
}
int
(url_get_path) (const url_t url, char *path, int n)
{ return url->_get_path(url, path, n); }
int (url_get_mpasswd) (const url_t url, char **mpasswd, size_t *n)
{
return (url) ? url->_get_mpasswd(url, mpasswd, n) : EINVAL;
}
int
(url_get_query) (const url_t url, char *query, int n)
{ return url->_get_query(url, query, n); }
int (url_get_host) (const url_t url, char *host, size_t len, size_t *n)
{
return (url) ? url->_get_host(url, host, len, n) : EINVAL;
}
int
(url_get_id) (const url_t url, int *id)
{ return url->_get_id (url, id); }
int (url_get_mhost) (const url_t url, char **mhost, size_t *n)
{
return (url) ? url->_get_mhost(url, mhost, n) : EINVAL;
}
int (url_get_port) (const url_t url, long *port)
{
return (url) ? url->_get_port(url, port) : EINVAL;
}
int (url_get_path) (const url_t url, char *path, size_t len, size_t *n)
{
return (url) ? url->_get_path(url, path, len, n) : EINVAL;
}
int (url_get_mpath) (const url_t url, char **mpath, size_t *n)
{
return (url) ? url->_get_mpath(url, mpath, n) : EINVAL;
}
int (url_get_query) (const url_t url, char *query, size_t len, size_t *n)
{
return (url) ? url->_get_query(url, query, len, n) : EINVAL;
}
int (url_get_mquery) (const url_t url, char **mquery, size_t *n)
{
return (url) ? url->_get_mquery(url, mquery, n) : EINVAL;
}
int (url_get_id) (const url_t url, int *id)
{
return (url) ? url->_get_id (url, id) : EINVAL;
}
......