Snort mailing list archives

Re: Snort183 -A unsock -- part deux


From: Fyodor <fygrave () tigerteam net>
Date: Mon, 18 Mar 2002 05:57:46 +0700

Dr. Richard W. Tibbs <ccamp () oakcitysolutions com> spoke:
On this issue, I am now inclined to see how a complete snort source 
distrib compiles on Win2k.

The bottom line is that I can get snprintf to compile cleanly with no 
errors or warnings *ONLY* by defining __STDC__, at the expense of all 
other modules failing due to includes of snort.h.  Is snort not a 
"standard" C program under win32?  

Mmm.. then how about putting following into snprintf() just before all
the includes:

#ifdef WIN32
#define __STDC__
#endif
#include ...
...


Compiling...
snprintf.c
c:\cpp_project\oak_snortprj\snprintf.c(83) : error C2061: syntax error : 
identifier 'va_dcl'

is there any docs for win32 on how va_start or VA_START is supposed to
be used? looks like related macros are not include here.

c:\cpp_project\oak_snortprj\snprintf.c(112) : error C2065: 'u_char' : 
undeclared identifier

typedef unsigned char u_char

c:\cpp_project\oak_snortprj\snprintf.c(112) : error C2143: syntax error 
: missing ')' before 'constant'
c:\cpp_project\oak_snortprj\snprintf.c(189) : warning C4013: 'va_arg' 
undefined; assuming extern returning int

va_start/va_end macro probs..

c:\cpp_project\oak_snortprj\snprintf.c(189) : error C2059: syntax error 
: 'type'

as well.

My Analysis: If I look at the logic in the snprintf.h file, it looks for 
"not" HAVE_SNPRINTF
then for __STDC__ to include stdarg.h  This file has everything except 
va_dcl, which seems only to be defined in varargs.h  


then #ifdef WIN32 hack could help :-)

If I include
#include <winsock.h> at the very top of snprintf.h, I get a clean 
compile with no errors or warnings!!

well, u_char is easy to solove.. either with 

#ifdef WIN32
#ifndef u_char
#define ....
#
#

or just replace u_char with unsigned char in the code. won't make much
difference.

So adding a define for __STDC__ and including winsock seems to solve the 
problem for snprintf.
BUT!!! all other modules fail to compile due to syntax errors in places 
like xdr.h gnuc.h etc when __STC__ is defined !!.  AAAaaaarrrrg!


can we have #define __STDC__ for sprintf() only then?


_______________________________________________
Snort-users mailing list
Snort-users () lists sourceforge net
Go to this URL to change user options or unsubscribe:
https://lists.sourceforge.net/lists/listinfo/snort-users
Snort-users list archive:
http://www.geocrawler.com/redir-sf.php3?list=snort-users


Current thread: