version 1.54, 2003/01/13 11:04:04 |
version 1.55, 2003/01/14 10:58:00 |
|
|
} |
} |
|
|
static int |
static int |
|
is_reg(char *path) |
|
{ |
|
struct stat sb; |
|
|
|
if (stat(path, &sb) == -1) |
|
fatal("stat %s: %s", path, strerror(errno)); |
|
|
|
return(S_ISREG(sb.st_mode)); |
|
} |
|
|
|
static int |
remote_is_dir(struct sftp_conn *conn, char *path) |
remote_is_dir(struct sftp_conn *conn, char *path) |
{ |
{ |
Attrib *a; |
Attrib *a; |
|
|
|
|
/* Only one match, dst may be file, directory or unspecified */ |
/* Only one match, dst may be file, directory or unspecified */ |
if (g.gl_pathv[0] && g.gl_matchc == 1) { |
if (g.gl_pathv[0] && g.gl_matchc == 1) { |
|
if (!is_reg(g.gl_pathv[i])) { |
|
error("Can't upload %s: not a regular file", |
|
g.gl_pathv[0]); |
|
err = 1; |
|
goto out; |
|
} |
if (tmp_dst) { |
if (tmp_dst) { |
/* If directory specified, append filename */ |
/* If directory specified, append filename */ |
if (remote_is_dir(conn, tmp_dst)) { |
if (remote_is_dir(conn, tmp_dst)) { |
|
|
} |
} |
|
|
for (i = 0; g.gl_pathv[i]; i++) { |
for (i = 0; g.gl_pathv[i]; i++) { |
|
if (!is_reg(g.gl_pathv[i])) { |
|
error("skipping non-regular file %s", |
|
g.gl_pathv[i]); |
|
continue; |
|
} |
if (infer_path(g.gl_pathv[i], &tmp)) { |
if (infer_path(g.gl_pathv[i], &tmp)) { |
err = -1; |
err = -1; |
goto out; |
goto out; |