summaryrefslogtreecommitdiff
path: root/libftpconn/unix.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-08-07 19:27:08 +0000
committerMiles Bader <miles@gnu.org>1997-08-07 19:27:08 +0000
commit07faf792aef56fb4f34b7feaf8f79d4fb5ff21dc (patch)
treef59c96abbc37bf4c24878a97c14ecddd74cb409c /libftpconn/unix.c
parent4166f60743727a95263936134fe7494b25694571 (diff)
(ftp_conn_unix_syshooks):
Add ftp_conn_unix_fix_nlist_name. (ftp_conn_unix_fix_nlist_name): New function.
Diffstat (limited to 'libftpconn/unix.c')
-rw-r--r--libftpconn/unix.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libftpconn/unix.c b/libftpconn/unix.c
index 5b6e3125..37152e8e 100644
--- a/libftpconn/unix.c
+++ b/libftpconn/unix.c
@@ -39,7 +39,8 @@
struct ftp_conn_syshooks ftp_conn_unix_syshooks = {
ftp_conn_unix_pasv_addr, ftp_conn_unix_interp_err,
- ftp_conn_unix_start_get_stats, ftp_conn_unix_cont_get_stats
+ ftp_conn_unix_start_get_stats, ftp_conn_unix_cont_get_stats,
+ ftp_conn_unix_fix_nlist_name
};
/* Try to get an internet address out of the reply to a PASV command.
@@ -656,3 +657,20 @@ finished:
return err;
}
+
+/* Some ftp servers return output from the nlist command that contains more
+ than just the simple names. This functions looks at *NAME and rewrites it
+ to compensate, changing *NAME to point to the rewritten name. DIR is the
+ name of the directory passed to the nlist command. */
+error_t
+ftp_conn_unix_fix_nlist_name (struct ftp_conn *conn, char *dir, char **name)
+{
+ size_t dir_len = strlen (dir);
+ if (strncmp (*name, dir, dir_len) == 0)
+ {
+ *name += dir_len;
+ if (**name == '/')
+ *name += 1;
+ }
+ return 0;
+}