- i_read = net_Read( p_access, p_sys->fd_data, NULL, p_buffer, i_len,
- VLC_FALSE );
- if( i_read == 0 )
- p_access->info.b_eof = VLC_TRUE;
- else if( i_read > 0 )
- p_access->info.i_pos += i_read;
+ if( p_sys->directory )
+ {
+ char *psz_line = net_Gets( p_access, p_sys->fd_data, NULL );
+ if( !psz_line )
+ {
+ p_access->info.b_eof = true;
+ return 0;
+ }
+ else
+ {
+ snprintf( (char*)p_buffer, i_len, "ftp://%s:%d/%s/%s\n",
+ p_sys->url.psz_host, p_sys->url.i_port,
+ p_sys->url.psz_path, psz_line );
+ free( psz_line );
+ return strlen( (const char *)p_buffer );
+ }
+ }
+ else
+ {
+ int i_read = net_Read( p_access, p_sys->fd_data, NULL,
+ p_buffer, i_len, false );
+ if( i_read == 0 )
+ p_access->info.b_eof = true;
+ else if( i_read > 0 )
+ p_access->info.i_pos += i_read;
+
+ return i_read;
+ }
+}
+
+/*****************************************************************************
+ * Write:
+ *****************************************************************************/
+static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
+{
+ access_sys_t *p_sys = GET_OUT_SYS(p_access);
+ size_t i_write = 0;
+
+ assert( p_sys->fd_data != -1 );
+
+ while( p_buffer != NULL )
+ {
+ block_t *p_next = p_buffer->p_next;;
+
+ i_write += net_Write( p_access, p_sys->fd_data, NULL,
+ p_buffer->p_buffer, p_buffer->i_buffer );
+ block_Release( p_buffer );
+
+ p_buffer = p_next;
+ }