Thanks guys. Of course your solution is so obvious! cheers Chris Morley ---------------------------------------- > Date: Sat, 9 Feb 2008 11:59:03 +0000 > From: [EMAIL PROTECTED] > To: emc-developers@lists.sourceforge.net > Subject: Re: [Emc-developers] help with fix for compile warning > > On Sat, 9 Feb 2008, Chris Morley wrote: >> In the file.c source there is a warning: ISO C90 forbids mixed >> declarations and code. > > it's typical bondage & discipline crap. the idea is to have all the > variables initialized at the top. try this: > > char *cl_fgets(char *s, int size, FILE *stream) > { > char * res; > s[0] = '\0'; > res = fgets( s, size, stream ); > >> // While last character in string is either CR or LF, remove. >> while (strlen(s)>=1 && ((s[strlen(s)-1]=='\r') || >> (s[strlen(s)-1]=='\n'))) >> s[strlen(s)-1] = '\0'; >> >> if ( strlen( S_LINE )>0 && strlen(s)>strlen( S_LINE )+strlen( E_LINE >> ) ) >> { >> strcpy( s, s+strlen( S_LINE ) ); >> s[ strlen(s)-strlen(E_LINE) ] = '\0'; >> } >> return res; >> } > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Emc-developers mailing list > Emc-developers@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-developers
_________________________________________________________________ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers