Ethereal-dev: [Ethereal-dev] Question about strptime

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jörg Mayer <jmayer@xxxxxxxxx>
Date: Sun, 17 Jun 2001 15:08:17 +0200
Hello,

I felt like looking at some of the warnings and found the following:

ftype-time.c:165: warning: implicit declaration of function `strptime'
ftype-time.c:165: warning: assignment makes pointer from integer without a cast

"man strptime" contains the following paragraph:

       This function is only available in  libraries  newer  than
       version  4.6.5.  Linux libc4 and libc5 includes define the
       prototype unconditionally; glibc2 includes provide a  pro�
       totype only when _XOPEN_SOURCE or _GNU_SOURCE are defined.

But we define neither _XOPEN_SOURCE nor _GNU_SOURCE, nor would that help
because the actual include <time.h> wants __USE_XOPEN.

The attached patch solves this by defining __USE_XOPEN

 Ciao
         J�rg

-- 
J�rg Mayer <jmayer@xxxxxxxxx>
Signature fault, brain dumped
Changelog: <jmayer@xxxxxxxxx>
	- glibc needs __USE_XOPEN to be defined in order to add
	  a prototype for strptime

Index: ethereal/epan/ftypes/ftype-time.c
===================================================================
RCS file: /cvsroot/ethereal/epan/ftypes/ftype-time.c,v
retrieving revision 1.7
diff -u -u -r1.7 ftype-time.c
--- ftype-time.c	2001/06/02 06:21:14	1.7
+++ ftype-time.c	2001/06/17 13:04:00
@@ -27,6 +27,14 @@
 
 #include <ctype.h>
 
+/*
+ * Just make sure we include the prototype for strptime as well
+ * (needed for gblic 2.2)
+ */
+#ifndef __USE_XOPEN
+#define __USE_XOPEN
+#endif
+
 #include <time.h>
 
 #include <ftypes-int.h>