Re: Continue mode in fish protocol - change ibs?

Nicolas Noble <[email protected]>
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>
Alexander V. Lukyanov wrote:

>On Wed, Nov 10, 2004 at 02:11:58PM +0100, Nicolas Noble wrote:
>  
>
>>I may sound stupid but, why can't the fish protocol send some tests to
>>see if perl or python is available, and then, send commands in the
>>selected language (using the -e command line option) ? Since these
>>languages have binary wise file handling, seeking files and block
>>reading them shouldn't be too difficult...
>>    
>>
>
>Rather good idea about perl. I think it's worth implementing. Of course, it
>should be an option (probably turned on by default).
>
>--
>   Alexander.
>  
>
Well, in that case, you may want to do this:

sprintf(perl_cmd, "perl -e '$offset = %i; $blocksize = %i; open(INFILE, 
\"<%s\"); binmode(INFILE); sysseek INFILE, 0, 2; $size = tell(INFILE) - 
$offset; sysseek INFILE, $offset, 0; while ($size >= $blocksize) { 
sysread INFILE, $bytes, $blocksize; syswrite STDOUT, $bytes, $blocksize; 
$size -= $blocksize } if ($size != 0) { sysread INFILE, $bytes, $size; 
syswrite STDOUT, $bytes, $size; } '", inputfile_offset, 
perl_copy_blocksize, inputfile_name_escaped);

with:

inputfile_offset beeing the needed seeking point
perl_copy_blocksize an option to tell how much block you want to copy at 
once
inputfile_name_escaped the file to read, with special characters beeing 
escaped (only " and ' should be escaped I think... well, you sure have 
better ideas about that)

At least, that is some dev testing starting point ;) I am sorry I can't 
help you any further about that, I am quite busy right now...

  -- Nicolas Noble
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.