summaryrefslogtreecommitdiff
path: root/net/libfetch
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2008-04-05 02:51:14 +0000
committerjoerg <joerg@pkgsrc.org>2008-04-05 02:51:14 +0000
commita41011ddfbea7c7e6fac719767f5fd49b0bddc34 (patch)
tree8c6536f75df0a54d3cbff524cfcf053c008d7a2f /net/libfetch
parentd3b6313e6671ea612bc40b179d8a054396d25a5c (diff)
downloadpkgsrc-a41011ddfbea7c7e6fac719767f5fd49b0bddc34.tar.gz
Actually return the list, not print it.
Diffstat (limited to 'net/libfetch')
-rw-r--r--net/libfetch/files/common.c7
-rw-r--r--net/libfetch/files/ftp.c9
2 files changed, 10 insertions, 6 deletions
diff --git a/net/libfetch/files/common.c b/net/libfetch/files/common.c
index 1e224c668ed..b333bf04898 100644
--- a/net/libfetch/files/common.c
+++ b/net/libfetch/files/common.c
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.5 2008/04/02 15:33:14 joerg Exp $ */
+/* $NetBSD: common.c,v 1.6 2008/04/05 02:51:14 joerg Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
* All rights reserved.
@@ -642,7 +642,10 @@ fetch_add_entry(struct url_ent **p, int *size, int *len,
tmp = *p + *len;
snprintf(tmp->name, PATH_MAX, "%s", name);
- memcpy(&tmp->stat, us, sizeof(*us));
+ if (us)
+ memcpy(&tmp->stat, us, sizeof(*us));
+ else
+ memset(&tmp->stat, 0, sizeof(*us));
(*len)++;
(++tmp)->name[0] = 0;
diff --git a/net/libfetch/files/ftp.c b/net/libfetch/files/ftp.c
index 59de42f2d67..7413362c23d 100644
--- a/net/libfetch/files/ftp.c
+++ b/net/libfetch/files/ftp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ftp.c,v 1.13 2008/04/05 02:42:13 joerg Exp $ */
+/* $NetBSD: ftp.c,v 1.14 2008/04/05 02:51:14 joerg Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
* All rights reserved.
@@ -1190,6 +1190,7 @@ fetchFilteredListFTP(struct url *url, const char *pattern, const char *flags)
char buf[2 * PATH_MAX], *eol, *eos;
ssize_t len;
size_t cur_off;
+ int list_size, list_len;
/* XXX What about proxies? */
f = ftp_request(url, "NLST", pattern, NULL, ftp_get_proxy(url, flags), flags);
@@ -1208,8 +1209,8 @@ fetchFilteredListFTP(struct url *url, const char *pattern, const char *flags)
eos = eol - 1;
else
eos = eol;
- fwrite(buf, eos - buf, 1, stdout);
- puts("");
+ *eos = '\0';
+ fetch_add_entry(&ue, &list_size, &list_len, buf, NULL);
cur_off -= eol - buf + 1;
memmove(buf, eol + 1, cur_off);
}
@@ -1222,7 +1223,7 @@ fetchFilteredListFTP(struct url *url, const char *pattern, const char *flags)
return NULL;
}
fetchIO_close(f);
- return (NULL);
+ return ue;
}
/*