diff options
author | joerg <joerg> | 2008-04-20 15:29:26 +0000 |
---|---|---|
committer | joerg <joerg> | 2008-04-20 15:29:26 +0000 |
commit | 457dd24ea4b0da8133952cd3722ed5696d3b6719 (patch) | |
tree | 49689ee55246910a5792a29a97caacb0d11b15be /net | |
parent | c96976eccd0f395616275e80bd168a4c778d97b4 (diff) | |
download | pkgsrc-457dd24ea4b0da8133952cd3722ed5696d3b6719.tar.gz |
libfetch-2.7:
Add fetchCopyURL.
Diffstat (limited to 'net')
-rw-r--r-- | net/libfetch/Makefile | 4 | ||||
-rw-r--r-- | net/libfetch/files/fetch.c | 27 | ||||
-rw-r--r-- | net/libfetch/files/fetch.h | 3 |
3 files changed, 30 insertions, 4 deletions
diff --git a/net/libfetch/Makefile b/net/libfetch/Makefile index 481b6137abb..7dc5c253c98 100644 --- a/net/libfetch/Makefile +++ b/net/libfetch/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.9 2008/04/19 14:49:23 joerg Exp $ +# $NetBSD: Makefile,v 1.10 2008/04/20 15:29:26 joerg Exp $ # -DISTNAME= libfetch-2.6 +DISTNAME= libfetch-2.7 CATEGORIES= net MASTER_SITES= # empty DISTFILES= # empty diff --git a/net/libfetch/files/fetch.c b/net/libfetch/files/fetch.c index d17227196d6..f1d52dbf9a5 100644 --- a/net/libfetch/files/fetch.c +++ b/net/libfetch/files/fetch.c @@ -1,4 +1,4 @@ -/* $NetBSD: fetch.c,v 1.4 2008/04/19 14:49:23 joerg Exp $ */ +/* $NetBSD: fetch.c,v 1.5 2008/04/20 15:29:26 joerg Exp $ */ /*- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav * All rights reserved. @@ -297,6 +297,31 @@ fetchMakeURL(const char *scheme, const char *host, int port, const char *doc, } /* + * Copy an existing URL. + */ +struct url * +fetchCopyURL(const struct url *src) +{ + struct url *dst; + char *doc; + + /* allocate struct url */ + if ((dst = malloc(sizeof(*dst))) == NULL) { + fetch_syserr(); + return (NULL); + } + if ((doc = strdup(src->doc)) == NULL) { + fetch_syserr(); + free(dst); + return (NULL); + } + *dst = *src; + dst->doc = doc; + + return dst; +} + +/* * Split an URL into components. URL syntax is: * [method:/][/[user[:pwd]@]host[:port]/][document] * This almost, but not quite, RFC1738 URL syntax. diff --git a/net/libfetch/files/fetch.h b/net/libfetch/files/fetch.h index 86696eba7c2..d9f106776f0 100644 --- a/net/libfetch/files/fetch.h +++ b/net/libfetch/files/fetch.h @@ -1,4 +1,4 @@ -/* $NetBSD: fetch.h,v 1.6 2008/04/19 14:49:23 joerg Exp $ */ +/* $NetBSD: fetch.h,v 1.7 2008/04/20 15:29:26 joerg Exp $ */ /*- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav * All rights reserved. @@ -145,6 +145,7 @@ int fetchList(struct url_list *, struct url *, const char *, struct url *fetchMakeURL(const char *, const char *, int, const char *, const char *, const char *); struct url *fetchParseURL(const char *); +struct url *fetchCopyURL(const struct url *); void fetchFreeURL(struct url *); /* URL listening */ |