[Xorp-hackers] Trivial fix

Pavlin Radoslavov pavlin at ICSI.Berkeley.EDU
Fri Mar 14 22:20:28 PDT 2008


Jonathan Day <imipak at yahoo.com> wrote:

> Hi,
> 
> I'll get the Windows patches sorted out as a single
> unit. For now, however, there's a trivial fix needed
> in strptime.c. It includes strings.h automatically,
> whether or not configure found it. This needs to be
> replaced with the following:
> 
> #ifdef HAVE_STRINGS_H
> #include <strings.h>
> #else
> #include <string.h>
> #endif

What OS (and OS version) are you using?
If it is Windows, currently XORP works on only few Windows versions,
and even then you need to install more things (see file BUILD_NOTES,
Section 3.7).

About the above patch, unfortunately it won't work the way it is,
because the story with the include files in strptime.c in particular
is slightly complicated (see the comments where _XOPEN_SOURCE is
defined.
Also, note that "config.h" is included after <strings.h> and
<string.h> therefore the "#ifdef HAVE_STRINGS_H" statement won't
matter.

The correct solution would be to try to move #include "config.h"
before <strings.h> and then use something like:

#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif

Unfortunately, given the fragile situation with the header file
inclusion in strptime.c, doing even something like this needs to be
carefully tested that it doesn't break the compilation on all
platforms supported currently by XORP.

Thanks,
Pavlin

> There seem to be some issues with POSIX vs. ISO C99
> calls vs. secure alternatives to standard functions,
> but I'm still trying to figure out the "best" solution
> to this as this would touch a lot of source. I need to
> come up with a solution, as Windows complains bitterly
> about older calls, but it would be better if any
> version submitted into the main source tree was agreed
> on as the (nominally) best solution.
> 
> Jonathan Day
> 
> Jonathan
> 
> 
>       ____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
> 
> _______________________________________________
> Xorp-hackers mailing list
> Xorp-hackers at icir.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers



More information about the Xorp-hackers mailing list