Re: FTP patch

From: Date: Wed, 13 Sep 2000 15:10:16 +0000
Subject: Re: FTP patch
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-33183@lists.php.net to get a copy of this message
Hello, if no one objects, I'll add it tonight. Derick Ron Chmara wrote: > An interesting patch just floating in the errata, it adds "EXEC" to the ftp > functions. > > On: > http://www.php.net/manual/ref.ftp.php > > jhennebicq@i-d.net > 16-Feb-2000 09:47 > > diff -u -r functions/ftp.c.orig functions/ftp.c > --- functions/ftp.c.orig Sun Jan 9 12:06:00 2000 > +++ functions/ftp.c Wed Feb 16 09:47:03 2000 > @@ -305,6 +305,20 @@ > return ftp->pwd; > } > +int > +ftp_exec(ftpbuf_t *ftp, const char *cmd) > +{ > + if (ftp == NULL) > + return 0; > + > + if (!ftp_putcmd(ftp, "SITE EXEC", cmd)) > + return 0; > + if (!ftp_getresp(ftp) || ftp->resp != 200) > + return 0; > + > + return 1; > +} > + > > int > ftp_chdir(ftpbuf_t *ftp, const char *dir) > diff -u -r functions/ftp.h.orig functions/ftp.h > --- functions/ftp.h.orig Sun Jan 9 12:06:00 2000 > +++ functions/ftp.h Wed Feb 16 09:48:50 2000 > @@ -108,6 +108,9 @@ > /* changes directories, return true on success, false on error */ > int ftp_chdir(ftpbuf_t *ftp, const char *dir); > +/* exec a command [special features], return true on success, false on error */ > +int ftp_exec(ftpbuf_t *ftp, const char *cmd); > + > /* changes to parent directory, return true on success, false on error */ > int ftp_cdup(ftpbuf_t *ftp); > diff -u -r functions/php_ftp.c.orig functions/php_ftp.c > --- functions/php_ftp.c.orig Sun Jan 9 12:06:00 2000 > +++ functions/php_ftp.c Wed Feb 16 09:51:01 2000 > @@ -52,6 +52,7 @@ > 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) > @@ -292,6 +293,36 @@ > /* 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; > } > diff -u -r functions/php_ftp.h.orig functions/php_ftp.h > --- functions/php_ftp.h.orig Sun Jan 9 12:06:00 2000 > +++ functions/php_ftp.h Wed Feb 16 09:49:08 2000 > @@ -55,6 +55,7 @@ > PHP_FUNCTION(ftp_pwd); > PHP_FUNCTION(ftp_cdup); > PHP_FUNCTION(ftp_chdir); > +PHP_FUNCTION(ftp_exec); > PHP_FUNCTION(ftp_mkdir); > PHP_FUNCTION(ftp_rmdir); > PHP_FUNCTION(ftp_nlist); > > -Bop > -- > Brought to you from iBop the iMac, a MacOS, Win95, Win98, LinuxPPC machine, > which is currently in MacOS land. Your bopping may vary. > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Derick Rethans JDI Media Solutions H.v.Tussenbroekstraat 1 6952 BL Dieren The Netherlands e-mail: d.rethans@jdimedia.nl http://www.jdimedia.nl/

« previous php.dev (#33183) next »