diff options
author | Andrew Skalski <askalski@php.net> | 1999-10-04 18:30:37 +0000 |
---|---|---|
committer | Andrew Skalski <askalski@php.net> | 1999-10-04 18:30:37 +0000 |
commit | f1f8b8a9a2d907c8c4a9020b4fa766ed467cb096 (patch) | |
tree | 623878ff3402c8ace23f637fd7d37176ff0b883f /ext/ftp/ftp.c | |
parent | 7aed3d51fc6377b82fa0b01c2ed14ab37c83b8b9 (diff) | |
download | php-git-f1f8b8a9a2d907c8c4a9020b4fa766ed467cb096.tar.gz |
Added delete and rename functions.
Diffstat (limited to 'ext/ftp/ftp.c')
-rw-r--r-- | ext/ftp/ftp.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index b83f34b8a6..ecacee627c 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -632,6 +632,38 @@ ftp_mdtm(ftpbuf_t *ftp, const char *path) } +int +ftp_delete(ftpbuf_t *ftp, const char *path) +{ + if (ftp == NULL) + return 0; + + fprintf(ftp->fp, "DELE %s\r\n", path); + if (!ftp_getresp(ftp) || ftp->resp != 250) + return 0; + + return 1; +} + + +int +ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest) +{ + if (ftp == NULL) + return 0; + + fprintf(ftp->fp, "RNFR %s\r\n", src); + if (!ftp_getresp(ftp) || ftp->resp != 350) + return 0; + + fprintf(ftp->fp, "RNTO %s\r\n", dest); + if (!ftp_getresp(ftp) || ftp->resp != 250) + return 0; + + return 1; +} + + /* static functions */ databuf_t* |