version 1.8, 2001/07/14 15:10:17 |
version 1.9, 2001/12/19 07:18:56 |
|
|
fudge_opendir(const char *path) |
fudge_opendir(const char *path) |
{ |
{ |
struct SFTP_OPENDIR *r; |
struct SFTP_OPENDIR *r; |
|
|
r = xmalloc(sizeof(*r)); |
r = xmalloc(sizeof(*r)); |
|
|
if (do_readdir(cur.fd_in, cur.fd_out, (char*)path, &r->dir)) |
if (do_readdir(cur.fd_in, cur.fd_out, (char*)path, &r->dir)) |
return(NULL); |
return(NULL); |
|
|
|
|
fudge_readdir(struct SFTP_OPENDIR *od) |
fudge_readdir(struct SFTP_OPENDIR *od) |
{ |
{ |
static struct dirent ret; |
static struct dirent ret; |
|
|
if (od->dir[od->offset] == NULL) |
if (od->dir[od->offset] == NULL) |
return(NULL); |
return(NULL); |
|
|
|
|
attrib_to_stat(Attrib *a, struct stat *st) |
attrib_to_stat(Attrib *a, struct stat *st) |
{ |
{ |
memset(st, 0, sizeof(*st)); |
memset(st, 0, sizeof(*st)); |
|
|
if (a->flags & SSH2_FILEXFER_ATTR_SIZE) |
if (a->flags & SSH2_FILEXFER_ATTR_SIZE) |
st->st_size = a->size; |
st->st_size = a->size; |
if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { |
if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { |
|
|
fudge_lstat(const char *path, struct stat *st) |
fudge_lstat(const char *path, struct stat *st) |
{ |
{ |
Attrib *a; |
Attrib *a; |
|
|
if (!(a = do_lstat(cur.fd_in, cur.fd_out, (char*)path, 0))) |
if (!(a = do_lstat(cur.fd_in, cur.fd_out, (char*)path, 0))) |
return(-1); |
return(-1); |
|
|
attrib_to_stat(a, st); |
attrib_to_stat(a, st); |
|
|
return(0); |
return(0); |
} |
} |
|
|
|
|
fudge_stat(const char *path, struct stat *st) |
fudge_stat(const char *path, struct stat *st) |
{ |
{ |
Attrib *a; |
Attrib *a; |
|
|
if (!(a = do_stat(cur.fd_in, cur.fd_out, (char*)path, 0))) |
if (!(a = do_stat(cur.fd_in, cur.fd_out, (char*)path, 0))) |
return(-1); |
return(-1); |
|
|
attrib_to_stat(a, st); |
attrib_to_stat(a, st); |
|
|
return(0); |
return(0); |
} |
} |
|
|
|
|
pglob->gl_closedir = (void (*)(void *))fudge_closedir; |
pglob->gl_closedir = (void (*)(void *))fudge_closedir; |
pglob->gl_lstat = fudge_lstat; |
pglob->gl_lstat = fudge_lstat; |
pglob->gl_stat = fudge_stat; |
pglob->gl_stat = fudge_stat; |
|
|
memset(&cur, 0, sizeof(cur)); |
memset(&cur, 0, sizeof(cur)); |
cur.fd_in = fd_in; |
cur.fd_in = fd_in; |
cur.fd_out = fd_out; |
cur.fd_out = fd_out; |