|
Isn't your mud the one that made I3? If so:
great stuff!
Just one tiny problem thats bugging
me:
This is the problem code
____________________________________________
/*
* Gets the next I3 field, that is when the amount of {[("'s and * ")]}'s match each other when a , is read. It's not foolproof, it * should honestly be some kind of statemachine, which does error- * checking. Right now I trust the I3-router to send proper packets * only. How naive :-) [Indeed Edwin, but I suppose we have little choice :P - Samson] * * ps will point to the beginning of the next field. * */ char *I3_get_field( char *packet, char **ps ) { int count[256]; char has_apostrophe = 0, has_backslash = 0; char foundit = 0; bzero( count,
sizeof(count) );
<<<_I_think_this_is_where_the_problem_is!!
*ps =
packet;
while( 1 ) { switch( *ps[0] ) { case '{': if( !has_apostrophe ) count['{']++; break; case '}': if( !has_apostrophe ) count['}']++; break; case '[': if( !has_apostrophe ) count['[']++; break; case ']': if( !has_apostrophe ) count[']']++; break; case '(': if( !has_apostrophe ) count['(']++; break; case ')': if( !has_apostrophe ) count[')']++; break; case '\\': if( has_backslash ) has_backslash = 0; else has_backslash = 1; break; case '"': if( has_backslash ) { has_backslash = 0; } else { if( has_apostrophe ) has_apostrophe = 0; else has_apostrophe = 1; } break; case ',': case ':': if( has_apostrophe ) break; if( has_backslash ) break; if( count['{'] != count['}'] ) break; if( count['['] != count[']'] ) break; if( count['('] != count[')'] ) break; foundit = 1; break; } if( foundit ) break; (*ps)++; } *ps[0] = 0; (*ps)++; return *ps; } END of problem
code_____________________________________
And when I compile it says:
BEGIN compile msg__________ i3.c: In function
`I3_get_field':
i3.c:1093: warning: passing arg 1 of `bzero' from incompatible pointer type END compile msg____________ Any ideas?
|
- By the way Edwin... the_sage2000
- Re: By the way Edwin... Edwin Groothuis
- Re: By the way Edwin... the_sage2000
- Re: By the way Edwin... Chad Simmons

