version 1.58, 2003/04/14 21:31:27 |
version 1.59, 2003/05/15 03:39:07 |
|
|
goto out; |
goto out; |
} |
} |
|
|
/* Only one match, dst may be file, directory or unspecified */ |
/* If multiple matches, dst must be a directory or unspecified */ |
if (g.gl_pathv[0] && g.gl_matchc == 1) { |
if (g.gl_matchc > 1 && dst && !is_dir(dst)) { |
if (dst) { |
|
/* If directory specified, append filename */ |
|
if (is_dir(dst)) { |
|
if (infer_path(g.gl_pathv[0], &tmp)) { |
|
err = 1; |
|
goto out; |
|
} |
|
abs_dst = path_append(dst, tmp); |
|
xfree(tmp); |
|
} else |
|
abs_dst = xstrdup(dst); |
|
} else if (infer_path(g.gl_pathv[0], &abs_dst)) { |
|
err = -1; |
|
goto out; |
|
} |
|
err = do_download(conn, g.gl_pathv[0], abs_dst, pflag); |
|
goto out; |
|
} |
|
|
|
/* Multiple matches, dst may be directory or unspecified */ |
|
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; |
|
|
err = -1; |
err = -1; |
goto out; |
goto out; |
} |
} |
if (dst) { |
|
|
if (g.gl_matchc == 1 && dst) { |
|
/* If directory specified, append filename */ |
|
if (is_dir(dst)) { |
|
if (infer_path(g.gl_pathv[0], &tmp)) { |
|
err = 1; |
|
goto out; |
|
} |
|
abs_dst = path_append(dst, tmp); |
|
xfree(tmp); |
|
} else |
|
abs_dst = xstrdup(dst); |
|
} else if (dst) { |
abs_dst = path_append(dst, tmp); |
abs_dst = path_append(dst, tmp); |
xfree(tmp); |
xfree(tmp); |
} else |
} else |
|
|
goto out; |
goto out; |
} |
} |
|
|
/* Only one match, dst may be file, directory or unspecified */ |
/* If multiple matches, dst may be directory or unspecified */ |
if (g.gl_pathv[0] && g.gl_matchc == 1) { |
if (g.gl_matchc > 1 && tmp_dst && !remote_is_dir(conn, tmp_dst)) { |
if (!is_reg(g.gl_pathv[0])) { |
|
error("Can't upload %s: not a regular file", |
|
g.gl_pathv[0]); |
|
err = 1; |
|
goto out; |
|
} |
|
if (tmp_dst) { |
|
/* If directory specified, append filename */ |
|
if (remote_is_dir(conn, tmp_dst)) { |
|
if (infer_path(g.gl_pathv[0], &tmp)) { |
|
err = 1; |
|
goto out; |
|
} |
|
abs_dst = path_append(tmp_dst, tmp); |
|
xfree(tmp); |
|
} else |
|
abs_dst = xstrdup(tmp_dst); |
|
} else { |
|
if (infer_path(g.gl_pathv[0], &abs_dst)) { |
|
err = -1; |
|
goto out; |
|
} |
|
abs_dst = make_absolute(abs_dst, pwd); |
|
} |
|
err = do_upload(conn, g.gl_pathv[0], abs_dst, pflag); |
|
goto out; |
|
} |
|
|
|
/* Multiple matches, dst may be directory or unspecified */ |
|
if (tmp_dst && !remote_is_dir(conn, 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; |
|
|
err = -1; |
err = -1; |
goto out; |
goto out; |
} |
} |
if (tmp_dst) { |
|
|
if (g.gl_matchc == 1 && tmp_dst) { |
|
/* If directory specified, append filename */ |
|
if (remote_is_dir(conn, tmp_dst)) { |
|
if (infer_path(g.gl_pathv[0], &tmp)) { |
|
err = 1; |
|
goto out; |
|
} |
|
abs_dst = path_append(tmp_dst, tmp); |
|
xfree(tmp); |
|
} else |
|
abs_dst = xstrdup(tmp_dst); |
|
|
|
} else if (tmp_dst) { |
abs_dst = path_append(tmp_dst, tmp); |
abs_dst = path_append(tmp_dst, tmp); |
xfree(tmp); |
xfree(tmp); |
} else |
} else |