summaryrefslogtreecommitdiff
path: root/ext/ftp/ftp.c
diff options
context:
space:
mode:
authorAndrew Skalski <askalski@php.net>2000-02-22 20:50:00 +0000
committerAndrew Skalski <askalski@php.net>2000-02-22 20:50:00 +0000
commitceebb2db615960d17f751011cfe955d668b591ea (patch)
tree4a5a9cd0e80c2840f0e8ae8020274e7393e872b0 /ext/ftp/ftp.c
parent5283b0b821ab14b738471246bb7377bbfcf95480 (diff)
downloadphp-git-ceebb2db615960d17f751011cfe955d668b591ea.tar.gz
added the ftp_site() function
Diffstat (limited to 'ext/ftp/ftp.c')
-rw-r--r--ext/ftp/ftp.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 916e706c72..1a5e807e8b 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -167,7 +167,7 @@ ftp_close(ftpbuf_t *ftp)
{
if (ftp == NULL)
return NULL;
- if (ftp->fd)
+ if (ftp->fd != -1)
close(ftp->fd);
ftp_gc(ftp);
free(ftp);
@@ -682,6 +682,21 @@ ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest)
return 1;
}
+
+int
+ftp_site(ftpbuf_t *ftp, const char *cmd)
+{
+ if (ftp == NULL)
+ return 0;
+
+ if (!ftp_putcmd(ftp, "SITE", cmd))
+ return 0;
+ if (!ftp_getresp(ftp) || ftp->resp < 200 || ftp->resp >= 300)
+ return 0;
+
+ return 1;
+}
+
/* static functions */
int