This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
ppp chat scripts fix
- From: Øyvind Harboe <oyvind dot harboe at zylin dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: Thu, 15 Apr 2004 15:53:23 +0200
- Subject: ppp chat scripts fix
- Organization: Zylin AS
A ppp chat script did not return success when it ran to completion.
I also changed cyg_ppp_chat_success to be a local variable as I could
see no reason why it should be a static variable.
static char *windows_serial_connection_script[] =
{
"" , "CLIENTCLIENT\\c" ,
"CLIENTSERVER" , "\\c" ,
0
};
--
Øyvind Harboe
http://www.zylin.com
Index: ecos/packages/net/ppp/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/ppp/current/ChangeLog,v
retrieving revision 1.1
diff -a -w -u -r1.1 ChangeLog
--- ecos/packages/net/ppp/current/ChangeLog 14 Apr 2004 15:08:58 -0000 1.1
+++ ecos/packages/net/ppp/current/ChangeLog 15 Apr 2004 13:37:15 -0000
@@ -1,3 +1,7 @@
+2004-04-15 Oyvind Harboe <oyvind.harboe@zylin.com>
+
+ * src/chat.c: Script now returns success when it runs to completion
+
2004-03-31 John Dallaway <jld@ecoscentric.com>
* cdl/ppp.cdl: Correct capitalisation in display strings.
Index: ecos/packages/net/ppp/current/src/chat.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/ppp/current/src/chat.c,v
retrieving revision 1.1
diff -a -w -u -r1.1 chat.c
--- ecos/packages/net/ppp/current/src/chat.c 14 Apr 2004 15:09:00 -0000 1.1
+++ ecos/packages/net/ppp/current/src/chat.c 15 Apr 2004 13:37:20 -0000
@@ -114,8 +114,6 @@
static char cyg_ppp_chat_buffer[CHAT_STRING_LENGTH];
static char cyg_ppp_chat_expect_buffer[CHAT_STRING_LENGTH];
-// success indicator
-static int cyg_ppp_chat_success;
//=====================================================================
// Timeout alarm function
@@ -368,6 +366,9 @@
const char *s;
Cyg_ErrNo err;
+ // success indicator
+ int cyg_ppp_chat_success;
+
cyg_ppp_chat_success = 0;
cyg_ppp_chat_thread = cyg_thread_self();
cyg_ppp_chat_abort_count = 0;
@@ -387,7 +388,7 @@
// Now loop over script handling the elements in turn
- while( (s = *script++) != NULL && cyg_ppp_chat_success == 0 )
+ while( (s = *script++) != NULL )
{
int what = cyg_ppp_chat_expect( s );
@@ -395,7 +396,6 @@
if( what == CHAT_FAIL )
{
- cyg_ppp_chat_success = 1;
break;
}
@@ -428,6 +428,13 @@
}
}
}
+
+
+ if (s==NULL)
+ {
+ // the script ran to completion
+ cyg_ppp_chat_success = 1;
+ }
// Finally, wait for the serial device to drain
{