diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 1998-12-21 19:41:50 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 1998-12-21 19:41:50 +0000 |
| commit | ce71b7364c992f636a7a20bc68d99e564269fa0a (patch) | |
| tree | daeceef714ad7444829535c209d95d8dc547b1e9 /lib/libfetch/fetch.c | |
| parent | bfc338e0bbdd9eb35d19f0959ef02313ca5453c2 (diff) | |
Notes
Diffstat (limited to 'lib/libfetch/fetch.c')
| -rw-r--r-- | lib/libfetch/fetch.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c index 1dba89e061f2..d8d2443787ce 100644 --- a/lib/libfetch/fetch.c +++ b/lib/libfetch/fetch.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: fetch.c,v 1.6 1998/11/06 22:14:08 des Exp $ + * $Id: fetch.c,v 1.7 1998/12/16 10:24:54 des Exp $ */ #include <sys/param.h> @@ -119,6 +119,25 @@ fetchStat(struct url *URL, struct url_stat *us, char *flags) } /* + * Select the appropriate protocol for the URL scheme, and return a + * list of files in the directory pointed to by the URL. + */ +struct url_ent * +fetchList(struct url *URL, char *flags) +{ + if (strcasecmp(URL->scheme, "file") == 0) + return fetchListFile(URL, flags); + else if (strcasecmp(URL->scheme, "http") == 0) + return fetchListHTTP(URL, flags); + else if (strcasecmp(URL->scheme, "ftp") == 0) + return fetchListFTP(URL, flags); + else { + _url_seterr(URL_BAD_SCHEME); + return NULL; + } +} + +/* * Attempt to parse the given URL; if successful, call fetchGet(). */ FILE * @@ -174,6 +193,24 @@ fetchStatURL(char *URL, struct url_stat *us, char *flags) } /* + * Attempt to parse the given URL; if successful, call fetchList(). + */ +struct url_ent * +fetchListURL(char *URL, char *flags) +{ + struct url *u; + struct url_ent *ue; + + if ((u = fetchParseURL(URL)) == NULL) + return NULL; + + ue = fetchList(u, flags); + + free(u); + return ue; +} + +/* * Split an URL into components. URL syntax is: * method:[//[user[:pwd]@]host[:port]]/[document] * This almost, but not quite, RFC1738 URL syntax. |
