summaryrefslogtreecommitdiff
path: root/ext/ftp/ftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ftp/ftp.c')
-rw-r--r--ext/ftp/ftp.c149
1 files changed, 114 insertions, 35 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index c6deea8c77..80fa322d8f 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -23,8 +23,7 @@
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
- | Authors: |
- | Andrew Skalski <askalski@chek.com> |
+ | Authors: Andrew Skalski <askalski@chek.com> |
+----------------------------------------------------------------------+
*/
@@ -108,7 +107,8 @@ union ipbox {
unsigned char c[8];
};
-
+/* {{{ ftp_open
+ */
ftpbuf_t*
ftp_open(const char *host, short port)
{
@@ -172,8 +172,10 @@ bail:
free(ftp);
return NULL;
}
+/* }}} */
-
+/* {{{ ftp_close
+ */
ftpbuf_t*
ftp_close(ftpbuf_t *ftp)
{
@@ -185,8 +187,10 @@ ftp_close(ftpbuf_t *ftp)
free(ftp);
return NULL;
}
+/* }}} */
-
+/* {{{ ftp_gc
+ */
void
ftp_gc(ftpbuf_t *ftp)
{
@@ -198,8 +202,10 @@ ftp_gc(ftpbuf_t *ftp)
free(ftp->syst);
ftp->syst = NULL;
}
+/* }}} */
-
+/* {{{ ftp_quit
+ */
int
ftp_quit(ftpbuf_t *ftp)
{
@@ -216,8 +222,10 @@ ftp_quit(ftpbuf_t *ftp)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_login
+ */
int
ftp_login(ftpbuf_t *ftp, const char *user, const char *pass)
{
@@ -238,8 +246,10 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass)
return 0;
return (ftp->resp == 230);
}
+/* }}} */
-
+/* {{{ ftp_reinit
+ */
int
ftp_reinit(ftpbuf_t *ftp)
{
@@ -255,8 +265,10 @@ ftp_reinit(ftpbuf_t *ftp)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_syst
+ */
const char*
ftp_syst(ftpbuf_t *ftp)
{
@@ -283,8 +295,10 @@ ftp_syst(ftpbuf_t *ftp)
return ftp->syst;
}
+/* }}} */
-
+/* {{{ ftp_pwd
+ */
const char*
ftp_pwd(ftpbuf_t *ftp)
{
@@ -312,8 +326,10 @@ ftp_pwd(ftpbuf_t *ftp)
return ftp->pwd;
}
+/* }}} */
-
+/* {{{ ftp_exec
+ */
int
ftp_exec(ftpbuf_t *ftp, const char *cmd)
{
@@ -326,8 +342,10 @@ ftp_exec(ftpbuf_t *ftp, const char *cmd)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_chdir
+ */
int
ftp_chdir(ftpbuf_t *ftp, const char *dir)
{
@@ -344,8 +362,10 @@ ftp_chdir(ftpbuf_t *ftp, const char *dir)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_cdup
+ */
int
ftp_cdup(ftpbuf_t *ftp)
{
@@ -362,8 +382,10 @@ ftp_cdup(ftpbuf_t *ftp)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_mkdir
+ */
char*
ftp_mkdir(ftpbuf_t *ftp, const char *dir)
{
@@ -390,8 +412,10 @@ ftp_mkdir(ftpbuf_t *ftp, const char *dir)
return mkd;
}
+/* }}} */
-
+/* {{{ ftp_rmdir
+ */
int
ftp_rmdir(ftpbuf_t *ftp, const char *dir)
{
@@ -405,22 +429,28 @@ ftp_rmdir(ftpbuf_t *ftp, const char *dir)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_nlist
+ */
char**
ftp_nlist(ftpbuf_t *ftp, const char *path)
{
return ftp_genlist(ftp, "NLST", path);
}
+/* }}} */
-
+/* {{{ ftp_list
+ */
char**
ftp_list(ftpbuf_t *ftp, const char *path)
{
return ftp_genlist(ftp, "LIST", path);
}
+/* }}} */
-
+/* {{{ ftp_type
+ */
int
ftp_type(ftpbuf_t *ftp, ftptype_t type)
{
@@ -448,8 +478,10 @@ ftp_type(ftpbuf_t *ftp, ftptype_t type)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_pasv
+ */
int
ftp_pasv(ftpbuf_t *ftp, int pasv)
{
@@ -492,8 +524,10 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_get
+ */
int
ftp_get(ftpbuf_t *ftp, FILE *outfp, const char *path, ftptype_t type)
{
@@ -554,8 +588,10 @@ bail:
data_close(data);
return 0;
}
+/* }}} */
-
+/* {{{ ftp_put
+ */
int
ftp_put(ftpbuf_t *ftp, const char *path, FILE *infp, ftptype_t type)
{
@@ -617,8 +653,10 @@ bail:
data_close(data);
return 0;
}
+/* }}} */
-
+/* {{{ ftp_size
+ */
int
ftp_size(ftpbuf_t *ftp, const char *path)
{
@@ -632,8 +670,10 @@ ftp_size(ftpbuf_t *ftp, const char *path)
return atoi(ftp->inbuf);
}
+/* }}} */
-
+/* {{{ ftp_mdtm
+ */
time_t
ftp_mdtm(ftpbuf_t *ftp, const char *path)
{
@@ -675,8 +715,10 @@ ftp_mdtm(ftpbuf_t *ftp, const char *path)
return stamp;
}
+/* }}} */
-
+/* {{{ ftp_delete
+ */
int
ftp_delete(ftpbuf_t *ftp, const char *path)
{
@@ -690,8 +732,10 @@ ftp_delete(ftpbuf_t *ftp, const char *path)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_rename
+ */
int
ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest)
{
@@ -710,8 +754,10 @@ ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_site
+ */
int
ftp_site(ftpbuf_t *ftp, const char *cmd)
{
@@ -725,9 +771,12 @@ ftp_site(ftpbuf_t *ftp, const char *cmd)
return 1;
}
+/* }}} */
/* static functions */
+/* {{{ ftp_putcmd
+ */
int
ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
{
@@ -754,8 +803,10 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
return 1;
}
+/* }}} */
-
+/* {{{ ftp_readline
+ */
int
ftp_readline(ftpbuf_t *ftp)
{
@@ -802,8 +853,10 @@ ftp_readline(ftpbuf_t *ftp)
return 0;
}
+/* }}} */
-
+/* {{{ ftp_getresp
+ */
int
ftp_getresp(ftpbuf_t *ftp)
{
@@ -844,8 +897,10 @@ ftp_getresp(ftpbuf_t *ftp)
return 1;
}
+/* }}} */
-
+/* {{{ my_send
+ */
int
my_send(int s, void *buf, size_t len)
{
@@ -879,8 +934,10 @@ my_send(int s, void *buf, size_t len)
return len;
}
+/* }}} */
-
+/* {{{ my_recv
+ */
int
my_recv(int s, void *buf, size_t len)
{
@@ -904,8 +961,10 @@ my_recv(int s, void *buf, size_t len)
return recv(s, buf, len, 0);
}
+/* }}} */
-
+/* {{{ my_connect
+ */
int
my_connect(int s, const struct sockaddr *addr, int addrlen)
#ifndef PHP_WIN32
@@ -957,7 +1016,10 @@ my_connect(int s, const struct sockaddr *addr, int addrlen)
return connect(s, addr, addrlen);
}
#endif
+/* }}} */
+/* {{{ my_accept
+ */
int
my_accept(int s, struct sockaddr *addr, int *addrlen)
{
@@ -981,8 +1043,10 @@ my_accept(int s, struct sockaddr *addr, int *addrlen)
return accept(s, addr, addrlen);
}
+/* }}} */
-
+/* {{{ ftp_getdata
+ */
databuf_t*
ftp_getdata(ftpbuf_t *ftp)
{
@@ -1081,8 +1145,10 @@ bail:
free(data);
return NULL;
}
+/* }}} */
-
+/* {{{ data_accept
+ */
databuf_t*
data_accept(databuf_t *data)
{
@@ -1104,8 +1170,10 @@ data_accept(databuf_t *data)
return data;
}
+/* }}} */
-
+/* {{{ data_close
+ */
databuf_t*
data_close(databuf_t *data)
{
@@ -1118,8 +1186,10 @@ data_close(databuf_t *data)
free(data);
return NULL;
}
+/* }}} */
-
+/* {{{ ftp_genlist
+ */
char**
ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path)
{
@@ -1219,5 +1289,14 @@ bail:
free(ret);
return NULL;
}
+/* }}} */
#endif /* HAVE_FTP */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim: sw=4 ts=4 tw=78 fdm=marker
+ */