summaryrefslogtreecommitdiff
path: root/ext/ftp/php_ftp.c
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2000-09-13 22:00:31 +0000
committerDerick Rethans <derick@php.net>2000-09-13 22:00:31 +0000
commitc7d31495bf968e6709a47bc765256e11670e390d (patch)
treeb1c964010fac2068451ef7db45141ada310dd5a7 /ext/ftp/php_ftp.c
parenta6bb6f5df3909915eb4f88a8a6d1af5d657d17d5 (diff)
downloadphp-git-c7d31495bf968e6709a47bc765256e11670e390d.tar.gz
- Added ftp_exec to the ftp functions (thanks to <jhennebicq@i-d.net>)
@ Added ftp_exec to the ftp functions (thanks to <jhennebicq@i-d.net>) @ (Derick)
Diffstat (limited to 'ext/ftp/php_ftp.c')
-rw-r--r--ext/ftp/php_ftp.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index 233d707972..061b2aac6c 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -48,6 +48,7 @@ function_entry php_ftp_functions[] = {
PHP_FE(ftp_pwd, NULL)
PHP_FE(ftp_cdup, NULL)
PHP_FE(ftp_chdir, NULL)
+ PHP_FE(ftp_exec, NULL)
PHP_FE(ftp_mkdir, NULL)
PHP_FE(ftp_rmdir, NULL)
PHP_FE(ftp_nlist, NULL)
@@ -272,6 +273,36 @@ PHP_FUNCTION(ftp_chdir)
/* change directories */
if (!ftp_chdir(ftp, arg2->value.str.val)) {
php_error(E_WARNING, "ftp_chdir: %s", ftp->inbuf);
+ RETURN_FALSE;
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto int ftp_exec(int stream, string command)
+ Changes directories */
+PHP_FUNCTION(ftp_exec)
+{
+ pval *arg1, *arg2;
+ ftpbuf_t *ftp;
+
+ /* arg1 - ftp
+ * arg2 - command
+ */
+ if (ARG_COUNT(ht) != 2 ||
+ getParameters(ht, 2, &arg1, &arg2) == FAILURE)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_string(arg2);
+
+ FTPBUF(ftp, arg1);
+
+ /* change directories */
+ if (!ftp_exec(ftp, arg2->value.str.val)) {
+ php_error(E_WARNING, "ftp_exec: %s", ftp->inbuf);
RETURN_FALSE;
}