diff options
author | fcolin | 2007-02-01 12:59:55 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 12:59:55 +0000 |
commit | ee291d6e06ccec9ac89c3228a94a2ba63a52f596 (patch) | |
tree | eab8a390788cc26d64d9b61584169a6714f06109 /Bus/Ivy/IvyApplication.cxx | |
parent | cf7deffd409caacafb23751e128313befb1674ea (diff) | |
download | ivy-cplusplus-ee291d6e06ccec9ac89c3228a94a2ba63a52f596.zip ivy-cplusplus-ee291d6e06ccec9ac89c3228a94a2ba63a52f596.tar.gz ivy-cplusplus-ee291d6e06ccec9ac89c3228a94a2ba63a52f596.tar.bz2 ivy-cplusplus-ee291d6e06ccec9ac89c3228a94a2ba63a52f596.tar.xz |
Utilisateur : Fcolin Date : 8/10/01 Heure : 14:15 Archivé dans $/Ivy Commentaire: bug strtok si argument vide !!! (vss 14)
Diffstat (limited to 'Bus/Ivy/IvyApplication.cxx')
-rw-r--r-- | Bus/Ivy/IvyApplication.cxx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Bus/Ivy/IvyApplication.cxx b/Bus/Ivy/IvyApplication.cxx index b27b77b..7f798c2 100644 --- a/Bus/Ivy/IvyApplication.cxx +++ b/Bus/Ivy/IvyApplication.cxx @@ -11,7 +11,25 @@ #define ARG_START "\002"
#define ARG_END "\003"
-
+/*
+function like strok but do not eat consecutive separator
+*/
+static char * nextArg( char *s, const char *separator )
+{
+ static char *start = NULL;
+ static char *end = NULL;
+ if ( s )
+ {
+ end = s;
+ }
+ start = end;
+
+ while ( *end && *end != *separator )
+ end++;
+ if ( *end == *separator ) *end++ = '\0';
+ if ( end == start ) return NULL;
+ return start;
+}
/////////////////////////////////////////////////////////////////////////////
// IvyApplication
@@ -183,11 +201,11 @@ void IvyApplication::OnReceive(char * line) TRACE("Message id=%d msg='%s'\n", id, arg);
#endif //IVY_DEBUG
- arg = strtok( arg, ARG_END);
+ arg = nextArg( arg, ARG_END);
while ( arg )
{
argv[argc++] = arg;
- arg = strtok( NULL, ARG_END );
+ arg = nextArg( NULL, ARG_END );
}
bus->CallMessageCallback( this, id, argc, argv );
break;
|