version 1.29, 2001/03/16 08:16:18 |
version 1.30, 2001/03/16 09:55:53 |
|
|
/* Check for quoted filenames */ |
/* Check for quoted filenames */ |
if (*cp == '\"' || *cp == '\'') { |
if (*cp == '\"' || *cp == '\'') { |
quot = *cp++; |
quot = *cp++; |
|
|
end = strchr(cp, quot); |
end = strchr(cp, quot); |
if (end == NULL) { |
if (end == NULL) { |
error("Unterminated quote"); |
error("Unterminated quote"); |
|
|
glob_t g; |
glob_t g; |
int err = 0; |
int err = 0; |
int i; |
int i; |
|
|
abs_src = xstrdup(src); |
abs_src = xstrdup(src); |
abs_src = make_absolute(abs_src, pwd); |
abs_src = make_absolute(abs_src, pwd); |
|
|
memset(&g, '\0', sizeof(g)); |
memset(&g, 0, sizeof(g)); |
debug3("Looking up %s", abs_src); |
debug3("Looking up %s", abs_src); |
if (remote_glob(in, out, abs_src, 0, NULL, &g)) { |
if (remote_glob(in, out, abs_src, 0, NULL, &g)) { |
error("File \"%s\" not found.", abs_src); |
error("File \"%s\" not found.", abs_src); |
|
|
|
|
/* Multiple matches, dst may be directory or unspecified */ |
/* Multiple matches, dst may be directory or unspecified */ |
if (dst && !is_dir(dst)) { |
if (dst && !is_dir(dst)) { |
error("Multiple files match, but \"%s\" is not a directory", |
error("Multiple files match, but \"%s\" is not a directory", |
dst); |
dst); |
err = -1; |
err = -1; |
goto out; |
goto out; |
} |
} |
|
|
for(i = 0; g.gl_pathv[i]; i++) { |
for(i = 0; g.gl_pathv[i]; i++) { |
if (infer_path(g.gl_pathv[i], &tmp)) { |
if (infer_path(g.gl_pathv[i], &tmp)) { |
err = -1; |
err = -1; |
|
|
tmp_dst = make_absolute(tmp_dst, pwd); |
tmp_dst = make_absolute(tmp_dst, pwd); |
} |
} |
|
|
memset(&g, '\0', sizeof(g)); |
memset(&g, 0, sizeof(g)); |
debug3("Looking up %s", src); |
debug3("Looking up %s", src); |
if (glob(src, 0, NULL, &g)) { |
if (glob(src, 0, NULL, &g)) { |
error("File \"%s\" not found.", src); |
error("File \"%s\" not found.", src); |
|
|
|
|
/* Multiple matches, dst may be directory or unspecified */ |
/* Multiple matches, dst may be directory or unspecified */ |
if (tmp_dst && !remote_is_dir(in, out, tmp_dst)) { |
if (tmp_dst && !remote_is_dir(in, out, tmp_dst)) { |
error("Multiple files match, but \"%s\" is not a directory", |
error("Multiple files match, but \"%s\" is not a directory", |
tmp_dst); |
tmp_dst); |
err = -1; |
err = -1; |
goto out; |
goto out; |
|
|
path1 = tmp; |
path1 = tmp; |
if ((aa = do_stat(in, out, path1, 0)) == NULL) |
if ((aa = do_stat(in, out, path1, 0)) == NULL) |
break; |
break; |
if ((aa->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) && |
if ((aa->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) && |
!S_ISDIR(aa->perm)) { |
!S_ISDIR(aa->perm)) { |
error("Can't ls: \"%s\" is not a directory", path1); |
error("Can't ls: \"%s\" is not a directory", path1); |
break; |
break; |