[PHP-DEV] cvs: /php3/functions ftp.c ftp.h php_ftp.c php_ftp.h From: Andrew Skalski (askalski <email protected>)
Date: 09/22/99

askalski Wed Sep 22 12:08:12 1999 EDT

  Modified files:
    /php3/functions ftp.c ftp.h php_ftp.c php_ftp.h
  Log:
  Added optional port parameter to ftp_connect()
  
  
Index: php3/functions/ftp.c
diff -u php3/functions/ftp.c:1.6 php3/functions/ftp.c:1.7
--- php3/functions/ftp.c:1.6 Tue Sep 21 19:35:01 1999
+++ php3/functions/ftp.c Wed Sep 22 12:08:11 1999
@@ -28,6 +28,8 @@
    +----------------------------------------------------------------------+
  */
 
+/* $Id: ftp.c,v 1.7 1999/09/22 16:08:11 askalski Exp $ */
+
 #include "php.h"
 
 #if HAVE_FTP
Index: php3/functions/ftp.h
diff -u php3/functions/ftp.h:1.3 php3/functions/ftp.h:1.4
--- php3/functions/ftp.h:1.3 Mon Sep 20 11:39:06 1999
+++ php3/functions/ftp.h Wed Sep 22 12:08:11 1999
@@ -28,6 +28,8 @@
    +----------------------------------------------------------------------+
  */
 
+/* $Id: ftp.h,v 1.4 1999/09/22 16:08:11 askalski Exp $ */
+
 #ifndef _FTP_H
 #define _FTP_H
 
Index: php3/functions/php_ftp.c
diff -u php3/functions/php_ftp.c:1.2 php3/functions/php_ftp.c:1.3
--- php3/functions/php_ftp.c:1.2 Tue Sep 21 19:37:51 1999
+++ php3/functions/php_ftp.c Wed Sep 22 12:08:11 1999
@@ -28,6 +28,8 @@
    +----------------------------------------------------------------------+
  */
 
+/* $Id: php_ftp.c,v 1.3 1999/09/22 16:08:11 askalski Exp $ */
+
 #include "php.h"
 
 #if HAVE_FTP
@@ -99,24 +101,39 @@
         return SUCCESS;
 }
 
-/* {{{ proto int ftp_connect(string host)
+/* {{{ proto int ftp_connect(string host [, int port])
    Open a FTP stream */
 PHP_FUNCTION(ftp_connect)
 {
- pval *arg1;
+ pval *arg1, *arg2;
         int id;
         ftpbuf_t *ftp;
+ short port = 0;
 
         /* arg1 - hostname
+ * arg2 - [port]
          */
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
+ switch (ARG_COUNT(ht)) {
+ case 1:
+ if (getParameters(ht, 1, &arg1) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ break;
+ case 2:
+ if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_long(arg2);
+ port = arg2->value.lval;
+ break;
+ default:
                 WRONG_PARAM_COUNT;
         }
 
         convert_to_string(arg1);
 
         /* connect */
- ftp = ftp_open(arg1->value.str.val, 0);
+ ftp = ftp_open(arg1->value.str.val, htons(port));
         if (ftp == NULL)
                 RETURN_FALSE;
 
Index: php3/functions/php_ftp.h
diff -u php3/functions/php_ftp.h:1.1 php3/functions/php_ftp.h:1.2
--- php3/functions/php_ftp.h:1.1 Mon Sep 20 11:39:06 1999
+++ php3/functions/php_ftp.h Wed Sep 22 12:08:11 1999
@@ -1,4 +1,34 @@
-/* $Id: php_ftp.h,v 1.1 1999/09/20 15:39:06 askalski Exp $ */
+/*
+ +----------------------------------------------------------------------+
+ | PHP HTML Embedded Scripting Language Version 3.0 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-1999 PHP Development Team (See Credits file) |
+ +----------------------------------------------------------------------+
+ | This program is free software; you can redistribute it and/or modify |
+ | it under the terms of one of the following licenses: |
+ | |
+ | A) the GNU General Public License as published by the Free Software |
+ | Foundation; either version 2 of the License, or (at your option) |
+ | any later version. |
+ | |
+ | B) the PHP License as published by the PHP Development Team and |
+ | included in the distribution in the file: LICENSE |
+ | |
+ | This program is distributed in the hope that it will be useful, |
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ | GNU General Public License for more details. |
+ | |
+ | You should have received a copy of both licenses referred to here. |
+ | If you did not, or have any questions about PHP licensing, please |
+ | contact core <email protected> |
+ +----------------------------------------------------------------------+
+ | Authors: |
+ | Andrew Skalski <askalski <email protected>> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id: php_ftp.h,v 1.2 1999/09/22 16:08:11 askalski Exp $ */
 
 #ifndef _INCLUDED_FTP_H
 #define _INCLUDED_FTP_H

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>