summaryrefslogtreecommitdiff
path: root/sys/src
diff options
context:
space:
mode:
authorftrvxmtrx <ftrvxmtrx@gmail.com>2013-02-16 22:06:26 +0100
committerftrvxmtrx <ftrvxmtrx@gmail.com>2013-02-16 22:06:26 +0100
commitb8990cfbb4f5aede73e01dc1838c1c5c19dc072a (patch)
tree260263aa4d029b1f5dd4f1fa19cee7732361165a /sys/src
parent012273f39d239fa3b65ff17e699db5f91eb701c6 (diff)
ftpfs: do not call getfields after NLST
Diffstat (limited to 'sys/src')
-rw-r--r--sys/src/cmd/ip/ftpfs/proto.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/src/cmd/ip/ftpfs/proto.c b/sys/src/cmd/ip/ftpfs/proto.c
index d96ac036f..60feff6f1 100644
--- a/sys/src/cmd/ip/ftpfs/proto.c
+++ b/sys/src/cmd/ip/ftpfs/proto.c
@@ -502,7 +502,7 @@ strpunct(char *p)
* decode a Unix or Plan 9 directory listing
*/
static Dir*
-crackdir(char *p, String **remname)
+crackdir(char *p, String **remname, int nlst)
{
char *field[15];
char *dfield[4];
@@ -513,9 +513,15 @@ crackdir(char *p, String **remname)
memset(&d, 0, sizeof(d));
- n = getfields(p, field, 15, 1, " \t");
- if(n > 2 && strcmp(field[n-2], "->") == 0)
- n -= 2;
+ if(nlst != 0){
+ field[0] = p;
+ n = 1;
+ } else {
+ n = getfields(p, field, 15, 1, " \t");
+ if(n > 2 && strcmp(field[n-2], "->") == 0)
+ n -= 2;
+ }
+
switch(os){
case TSO:
cp = strchr(field[0], '.');
@@ -786,7 +792,7 @@ readdir(Node *node)
n--;
line[n - 1] = 0;
- d = crackdir(line, &remname);
+ d = crackdir(line, &remname, (usenlist || usenlst));
if(d == nil)
continue;
files++;