pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/libfetch libfetch-2.12:
details: https://anonhg.NetBSD.org/pkgsrc/rev/592c6713d6d7
branches: trunk
changeset: 541762:592c6713d6d7
user: joerg <joerg%pkgsrc.org@localhost>
date: Fri Apr 25 16:25:25 2008 +0000
description:
libfetch-2.12:
Make function naming consistent before external code depend on it.
Update man page.
diffstat:
net/libfetch/Makefile | 4 +-
net/libfetch/files/common.c | 6 ++--
net/libfetch/files/fetch.3 | 62 +++++++++++++++++++++++++++++++++---------
net/libfetch/files/fetch.c | 8 ++--
net/libfetch/files/fetch.cat3 | 60 +++++++++++++++++++++++++++++------------
net/libfetch/files/fetch.h | 10 +++---
net/libfetch/files/file.c | 10 +++---
net/libfetch/files/ftp.c | 4 +-
8 files changed, 112 insertions(+), 52 deletions(-)
diffs (truncated from 400 to 300 lines):
diff -r cd6112e651b9 -r 592c6713d6d7 net/libfetch/Makefile
--- a/net/libfetch/Makefile Fri Apr 25 16:18:20 2008 +0000
+++ b/net/libfetch/Makefile Fri Apr 25 16:25:25 2008 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.14 2008/04/24 10:21:33 joerg Exp $
+# $NetBSD: Makefile,v 1.15 2008/04/25 16:25:25 joerg Exp $
#
-DISTNAME= libfetch-2.11
+DISTNAME= libfetch-2.12
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
diff -r cd6112e651b9 -r 592c6713d6d7 net/libfetch/files/common.c
--- a/net/libfetch/files/common.c Fri Apr 25 16:18:20 2008 +0000
+++ b/net/libfetch/files/common.c Fri Apr 25 16:25:25 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.11 2008/04/24 10:21:33 joerg Exp $ */
+/* $NetBSD: common.c,v 1.12 2008/04/25 16:25:25 joerg Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
* Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
@@ -705,14 +705,14 @@
}
void
-fetch_init_url_list(struct url_list *ue)
+fetchInitURLList(struct url_list *ue)
{
ue->length = ue->alloc_size = 0;
ue->urls = NULL;
}
void
-fetch_free_url_list(struct url_list *ue)
+fetchFreeURLList(struct url_list *ue)
{
size_t i;
diff -r cd6112e651b9 -r 592c6713d6d7 net/libfetch/files/fetch.3
--- a/net/libfetch/files/fetch.3 Fri Apr 25 16:18:20 2008 +0000
+++ b/net/libfetch/files/fetch.3 Fri Apr 25 16:25:25 2008 +0000
@@ -24,14 +24,15 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: fetch.3,v 1.64 2007/12/18 11:03:26 des Exp $
-.\" $NetBSD: fetch.3,v 1.5 2008/04/19 14:49:23 joerg Exp $
+.\" $NetBSD: fetch.3,v 1.6 2008/04/25 16:25:25 joerg Exp $
.\"
-.Dd April 19, 2008
+.Dd April 25, 2008
.Dt FETCH 3
.Os
.Sh NAME
.Nm fetchMakeURL ,
.Nm fetchParseURL ,
+.Nm fetchCopyURL ,
.Nm fetchFreeURL ,
.Nm fetchXGetURL ,
.Nm fetchGetURL ,
@@ -58,6 +59,11 @@
.Nm fetchPutFTP ,
.Nm fetchStatFTP ,
.Nm fetchListFTP
+.Nm fetchInitURLList ,
+.Nm fetchFreeURLList ,
+.Nm fetchUnquotePath ,
+.Nm fetchUnquoteFilename ,
+.Nm fetch
.Nd file transfer functions
.Sh LIBRARY
.Lb libfetch
@@ -68,6 +74,8 @@
.Fn fetchMakeURL "const char *scheme" "const char *host" "int port" "const char *doc" "const char *user" "const char *pwd"
.Ft struct url *
.Fn fetchParseURL "const char *URL"
+.Ft struct url *
+.Fn fetchCopyURL "const struct url *u"
.Ft void
.Fn fetchFreeURL "struct url *u"
.Ft fetchIO *
@@ -120,6 +128,14 @@
.Fn fetchStatFTP "struct url *u" "struct url_stat *us" "const char *flags"
.Ft int
.Fn fetchListFTP "struct url_list *list" "struct url *u" "const char *flags"
+.Ft void
+.Fn fetchInitURLList "struct url_list *ul"
+.Ft void
+.Fn fetchFreeURLList "struct url_list *ul"
+.Ft char *
+.Fn fetchUnquotePath "struct url *u"
+.Ft char *
+.Fn fetchUnquoteFilename "struct url *u"
.Sh DESCRIPTION
These functions implement a high-level library for retrieving and
uploading files using Uniform Resource Locators (URLs).
@@ -133,20 +149,26 @@
<scheme>:(//(<user>(:<pwd>)?@)?<host>(:<port>)?)?/(<document>)?
.Ed
.Pp
-If the URL does not seem to begin with a scheme name, the following
-syntax is assumed:
-.Bd -literal
- ((<user>(:<pwd>)?@)?<host>(:<port>)?)?/(<document>)?
-.Ed
+If the URL does not seem to begin with a scheme name, it is assumed to be a local path.
+Only absolute path names are accepted.
.Pp
Note that some components of the URL are not necessarily relevant to
all URL schemes.
For instance, the file scheme only needs the <scheme> and <document>
components.
+.Fn fetchParseURL
+quotes any unsafe character in the URL automatically.
+This is not done by
+.Fn fetchMakeURL .
+.Fn fetchCopyURL
+copies an existing
+.Vt url
+structure.
.Pp
-.Fn fetchMakeURL
+.Fn fetchMakeURL ,
+.Fn fetchParseURL
and
-.Fn fetchParseURL
+.Fn fetchCopyURL
return a pointer to a
.Vt url
structure, which is defined as follows in
@@ -170,8 +192,9 @@
.Ed
.Pp
The pointer returned by
-.Fn fetchMakeURL
-or
+.Fn fetchMakeURL ,
+.Fn fetchCopyURL
+and
.Fn fetchParseURL
should be freed using
.Fn fetchFreeURL .
@@ -245,9 +268,22 @@
.Ed
.Pp
The list should be initialised by calling
-.Fn fetch_init_url_list
+.Fn fetchInitURLList
and the entries be freed by calling
-.Fn fetch_free_url_list .
+.Fn fetchFreeURLList .
+.Pp
+.Fn fetchUnquotePath
+returns the path name part of the URL with any quoting undone.
+Query arguments and fragment identifiers are not included.
+.Fn fetchUnquoteFilename
+returns the last component of the path name as returned by
+.Fn fetchUnquotePath .
+.Fn fetchUnquotePath
+and
+.Fn fetchUnquoteFilename
+return a string that should be deallocated with
+.Fn free
+after use.
.Pp
.Fn fetchXGet ,
.Fn fetchGet ,
diff -r cd6112e651b9 -r 592c6713d6d7 net/libfetch/files/fetch.c
--- a/net/libfetch/files/fetch.c Fri Apr 25 16:18:20 2008 +0000
+++ b/net/libfetch/files/fetch.c Fri Apr 25 16:25:25 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fetch.c,v 1.9 2008/04/24 10:24:04 joerg Exp $ */
+/* $NetBSD: fetch.c,v 1.10 2008/04/25 16:25:25 joerg Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
* Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
@@ -545,7 +545,7 @@
* Skips optional parts like query or fragment identifier.
*/
char *
-fetch_unquote_doc(struct url *url)
+fetchUnquotePath(struct url *url)
{
char *unquoted;
const char *iter;
@@ -576,12 +576,12 @@
* Extract the file name component of a URL.
*/
char *
-fetch_extract_filename(struct url *url)
+fetchUnquoteFilename(struct url *url)
{
char *unquoted, *filename;
const char *last_slash;
- if ((unquoted = fetch_unquote_doc(url)) == NULL)
+ if ((unquoted = fetchUnquotePath(url)) == NULL)
return NULL;
if ((last_slash = strrchr(unquoted, '/')) == NULL)
diff -r cd6112e651b9 -r 592c6713d6d7 net/libfetch/files/fetch.cat3
--- a/net/libfetch/files/fetch.cat3 Fri Apr 25 16:18:20 2008 +0000
+++ b/net/libfetch/files/fetch.cat3 Fri Apr 25 16:25:25 2008 +0000
@@ -1,12 +1,14 @@
FETCH(3) NetBSD Library Functions Manual FETCH(3)
NNAAMMEE
- ffeettcchhMMaakkeeUURRLL, ffeettcchhPPaarrsseeUURRLL, ffeettcchhFFrreeeeUURRLL, ffeettcchhXXGGeettUURRLL, ffeettcchhGGeettUURRLL,
- ffeettcchhPPuuttUURRLL, ffeettcchhSSttaattUURRLL, ffeettcchhLLiissttUURRLL, ffeettcchhXXGGeett, ffeettcchhGGeett, ffeettcchhPPuutt,
- ffeettcchhSSttaatt, ffeettcchhLLiisstt, ffeettcchhXXGGeettFFiillee, ffeettcchhGGeettFFiillee, ffeettcchhPPuuttFFiillee,
- ffeettcchhSSttaattFFiillee, ffeettcchhLLiissttFFiillee, ffeettcchhXXGGeettHHTTTTPP, ffeettcchhGGeettHHTTTTPP,
ffeettcchhPPuuttHHTTTTPP,
- ffeettcchhSSttaattHHTTTTPP, ffeettcchhLLiissttHHTTTTPP, ffeettcchhXXGGeettFFTTPP, ffeettcchhGGeettFFTTPP, ffeettcchhPPuuttFFTTPP,
- ffeettcchhSSttaattFFTTPP, ffeettcchhLLiissttFFTTPP -- file transfer functions
+ ffeettcchhMMaakkeeUURRLL, ffeettcchhPPaarrsseeUURRLL, ffeettcchhCCooppyyUURRLL, ffeettcchhFFrreeeeUURRLL, ffeettcchhXXGGeettUURRLL,
+ ffeettcchhGGeettUURRLL, ffeettcchhPPuuttUURRLL, ffeettcchhSSttaattUURRLL, ffeettcchhLLiissttUURRLL, ffeettcchhXXGGeett,
+ ffeettcchhGGeett, ffeettcchhPPuutt, ffeettcchhSSttaatt, ffeettcchhLLiisstt, ffeettcchhXXGGeettFFiillee, ffeettcchhGGeettFFiillee,
+ ffeettcchhPPuuttFFiillee, ffeettcchhSSttaattFFiillee, ffeettcchhLLiissttFFiillee, ffeettcchhXXGGeettHHTTTTPP,
ffeettcchhGGeettHHTTTTPP,
+ ffeettcchhPPuuttHHTTTTPP, ffeettcchhSSttaattHHTTTTPP, ffeettcchhLLiissttHHTTTTPP, ffeettcchhXXGGeettFFTTPP, ffeettcchhGGeettFFTTPP,
+ ffeettcchhPPuuttFFTTPP, ffeettcchhSSttaattFFTTPP, ffeettcchhLLiissttFFTTPP ffeettcchhIInniittUURRLLLLiisstt,
+ ffeettcchhFFrreeeeUURRLLLLiisstt, ffeettcchhUUnnqquuootteePPaatthh, ffeettcchhUUnnqquuootteeFFiilleennaammee, ffeettcchh -- file
+ transfer functions
LLIIBBRRAARRYY
library ``libfetch''
@@ -22,6 +24,9 @@
_s_t_r_u_c_t _u_r_l _*
ffeettcchhPPaarrsseeUURRLL(_c_o_n_s_t _c_h_a_r _*_U_R_L);
+ _s_t_r_u_c_t _u_r_l _*
+ ffeettcchhCCooppyyUURRLL(_c_o_n_s_t _s_t_r_u_c_t _u_r_l _*_u);
+
_v_o_i_d
ffeettcchhFFrreeeeUURRLL(_s_t_r_u_c_t _u_r_l _*_u);
@@ -100,6 +105,18 @@
_i_n_t
ffeettcchhLLiissttFFTTPP(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_l_i_s_t, _s_t_r_u_c_t _u_r_l _*_u, _c_o_n_s_t _c_h_a_r _*_f_l_a_g_s);
+ _v_o_i_d
+ ffeettcchhIInniittUURRLLLLiisstt(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_u_l);
+
+ _v_o_i_d
+ ffeettcchhFFrreeeeUURRLLLLiisstt(_s_t_r_u_c_t _u_r_l___l_i_s_t _*_u_l);
+
+ _c_h_a_r _*
+ ffeettcchhUUnnqquuootteePPaatthh(_s_t_r_u_c_t _u_r_l _*_u);
+
+ _c_h_a_r _*
+ ffeettcchhUUnnqquuootteeFFiilleennaammee(_s_t_r_u_c_t _u_r_l _*_u);
+
DDEESSCCRRIIPPTTIIOONN
These functions implement a high-level library for retrieving and upload-
ing files using Uniform Resource Locators (URLs).
@@ -111,17 +128,17 @@
<scheme>:(//(<user>(:<pwd>)?@)?<host>(:<port>)?)?/(<document>)?
- If the URL does not seem to begin with a scheme name, the following syn-
- tax is assumed:
-
- ((<user>(:<pwd>)?@)?<host>(:<port>)?)?/(<document>)?
+ If the URL does not seem to begin with a scheme name, it is assumed to be
+ a local path. Only absolute path names are accepted.
Note that some components of the URL are not necessarily relevant to all
URL schemes. For instance, the file scheme only needs the <scheme> and
- <document> components.
+ <document> components. ffeettcchhPPaarrsseeUURRLL() quotes any unsafe character in
+ the URL automatically. This is not done by ffeettcchhMMaakkeeUURRLL().
+ ffeettcchhCCooppyyUURRLL() copies an existing _u_r_l structure.
- ffeettcchhMMaakkeeUURRLL() and ffeettcchhPPaarrsseeUURRLL() return a pointer to a _u_r_l structure,
- which is defined as follows in <_f_e_t_c_h_._h>:
+ ffeettcchhMMaakkeeUURRLL(), ffeettcchhPPaarrsseeUURRLL() and ffeettcchhCCooppyyUURRLL() return a pointer to a
+ _u_r_l structure, which is defined as follows in <_f_e_t_c_h_._h>:
#define URL_SCHEMELEN 16
#define URL_USERLEN 256
@@ -139,8 +156,8 @@
size_t length;
};
- The pointer returned by ffeettcchhMMaakkeeUURRLL() or ffeettcchhPPaarrsseeUURRLL() should be freed
- using ffeettcchhFFrreeeeUURRLL().
+ The pointer returned by ffeettcchhMMaakkeeUURRLL(), ffeettcchhCCooppyyUURRLL() and
+ ffeettcchhPPaarrsseeUURRLL() should be freed using ffeettcchhFFrreeeeUURRLL().
ffeettcchhXXGGeettUURRLL(), ffeettcchhGGeettUURRLL(), and ffeettcchhPPuuttUURRLL() constitute the recom-
mended interface to the ffeettcchh library. They examine the URL passed to
@@ -181,8 +198,15 @@
struct url *urls;
};
- The list should be initialised by calling ffeettcchh__iinniitt__uurrll__lliisstt() and the
- entries be freed by calling ffeettcchh__ffrreeee__uurrll__lliisstt().
+ The list should be initialised by calling ffeettcchhIInniittUURRLLLLiisstt() and the
+ entries be freed by calling ffeettcchhFFrreeeeUURRLLLLiisstt().
+
+ ffeettcchhUUnnqquuootteePPaatthh() returns the path name part of the URL with any quoting
+ undone. Query arguments and fragment identifiers are not included.
Home |
Main Index |
Thread Index |
Old Index