On Thu, Aug 11, 2005 at 08:10:05PM +0000, ENi wrote:
> "/home/bla/somet" or something like that. it cuts of some part
> of the line if it reads larger command-files. i did a few
> checks and found out it only happens if i'm using the -f option
> (at least i hope so, just found out some mins ago). so if i do
> "lftp < somebatch" it works fine while "lftp -f somefile" is
> doing those errors.
> it seems that it only happens if batchfile is bigger than x kb.
> and then every x kbyte. i guess its some buffer overrun/cutoff.
Here is a patch to fix it.
--
Alexander. | http://www.yars.free.net/~lav/
Index: CmdExec.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/CmdExec.cc,v
retrieving revision 1.114
diff -u -p -r1.114 CmdExec.cc
--- CmdExec.cc 4 Aug 2005 13:10:39 -0000 1.114
+++ CmdExec.cc 12 Aug 2005 06:56:54 -0000
@@ -95,7 +95,7 @@ int CmdExec::RestoreCWD()
void CmdExec::FeedCmd(const char *c)
{
partial_cmd=false;
- time(&start_time);
+ start_time=now;
if(cmd_buf==0)
{
cmd_buf=next_cmd=xstrdup(c);
@@ -109,7 +109,7 @@ void CmdExec::FeedCmd(const char *c)
void CmdExec::PrependCmd(const char *c)
{
- time(&start_time);
+ start_time=now;
int len=strlen(c);
int nl=(len>0 && c[len-1]!='\n');
@@ -929,7 +929,7 @@ char *CmdExec::MakePrompt()
void CmdExec::beep_if_long()
{
if(start_time!=0 && long_running!=0
- && time(0)-start_time>long_running
+ && now-start_time>long_running
&& interactive && Idle() && isatty(1))
write(1,"\007",1);
}
Index: StatusLine.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/StatusLine.cc,v
retrieving revision 1.32
diff -u -p -r1.32 StatusLine.cc
--- StatusLine.cc 12 Jun 2004 07:55:43 -0000 1.32
+++ StatusLine.cc 12 Aug 2005 06:54:54 -0000
@@ -78,7 +78,9 @@ StatusLine::~StatusLine()
void StatusLine::Clear(bool title_also)
{
- update("");
+ const char *empty="";
+ update_timer.Stop();
+ ShowN(&empty,1);
update_delayed=false;
update_timer.SetMilliSeconds(20);
Index: parsecmd.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/parsecmd.cc,v
retrieving revision 1.9
diff -u -p -r1.9 parsecmd.cc
--- parsecmd.cc 18 Oct 2004 07:10:49 -0000 1.9
+++ parsecmd.cc 12 Aug 2005 06:43:21 -0000
@@ -104,7 +104,10 @@ CmdExec::parse_result CmdExec::parse_one
if(line[0]=='\r' && line[1]=='\n')
line++;
- if(*line==0 || *line=='\n'
+ if(*line==0)
+ return PARSE_AGAIN;
+
+ if(*line=='\n'
|| *line=='|' || *line=='>' || *line==';' || *line=='&')
break;
@@ -220,7 +223,9 @@ CmdExec::parse_result CmdExec::parse_one
}
else
{
- if(*line==0 || *line=='\n'
+ if(*line==0)
+ return PARSE_AGAIN;
+ if(*line=='\n'
|| (!in_quotes && (is_space(*line)
|| *line=='>' || *line=='|' || *line==';' || *line=='&')))
break;
@@ -309,7 +314,10 @@ CmdExec::parse_result CmdExec::parse_one
while(is_space(*line))
line++;
- if(*line==0 || *line=='\n' || *line==';' || *line=='&')
+ if(*line==0)
+ return PARSE_AGAIN;
+
+ if(*line=='\n' || *line==';' || *line=='&')
{
if(redir_type=='|')
eprintf(_("parse: missing filter command\n"));
@@ -338,8 +346,10 @@ CmdExec::parse_result CmdExec::parse_one
line++;
else
{
+ if(*line==0)
+ return PARSE_AGAIN;
// filename can end with a space, filter command can't.
- if(*line==0 || *line=='\n' || (!in_quotes
+ if(*line=='\n' || (!in_quotes
&& ((redir_type!='|' && is_space(*line))
|| *line==';' || *line=='&')))
break;