+ /* check binary mode support */
+ if( ftp_SendCommand( p_access, p_sys, "TYPE I" ) < 0 ||
+ ftp_ReadCommand( p_access, p_sys, NULL, NULL ) != 2 )
+ {
+ msg_Err( p_access, "cannot set binary transfer mode" );
+ net_Close( p_sys->fd_cmd );
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int parseURL( vlc_url_t *url, const char *path )
+{
+ if( path == NULL )
+ return -1;
+
+ /* *** Parse URL and get server addr/port and path *** */
+ while( *path == '/' )
+ path++;
+
+ vlc_UrlParse( url, path, 0 );
+
+ if( url->psz_host == NULL || *url->psz_host == '\0' )
+ return -1;
+
+ if( url->i_port <= 0 )
+ url->i_port = IPPORT_FTP; /* default port */
+
+ /* FTP URLs are relative to user's default directory (RFC1738)
+ For absolute path use ftp://foo.bar//usr/local/etc/filename */
+
+ if( *url->psz_path == '/' )
+ url->psz_path++;
+
+ return 0;
+}
+
+
+/****************************************************************************
+ * Open: connect to ftp server and ask for file
+ ****************************************************************************/
+static int InOpen( vlc_object_t *p_this )
+{
+ access_t *p_access = (access_t*)p_this;
+ access_sys_t *p_sys;
+ char *psz_arg;
+
+ /* Init p_access */
+ STANDARD_READ_ACCESS_INIT
+ p_sys->fd_data = -1;
+
+ if( parseURL( &p_sys->url, p_access->psz_path ) )
+ goto exit_error;
+
+ if( Connect( p_this, p_sys ) )
+ goto exit_error;
+