tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: declaration of strptime



On Wed, 09 Jan 2008 16:48:46 -0500
nathanw%MIT.EDU@localhost (Nathan J. Williams) wrote:

> "Steven M. Bellovin" <smb%cs.columbia.edu@localhost> writes:
> 
> > I don't know when the conditions are going to be true; clearly, they
> > were not for my packages.
> 
> > First -- what should be done in the base system about the
> > declaration of strptime?  Should it always be declared?  If not,
> > should the man page be fixed?  (I should probably send-pr this
> > point.)
> 
> A detail I think you might be missing is that _NETBSD_SOURCE is
> defined by default, in <sys/featuretest.h>, which <time.h> pulls in
> (the comments in that file may be helpful to understanding the
> situation). So a program compiled with no special definitions or flags
> *does* see the definition of strptime(), which agrees with the man
> page. The circumstance in which _NETBSD_SOURCE isn't defined is when
> some other feature-environment symbol, like _POSIX_C_SOURCE, is
> defined.

That is indeed very useful; thanks for the pointer.
> 
> > Second -- what should be in the packages (www/liferea and
> > mail/claws-mail-rssyl) to cope with this?
> 
> Probably (a) not defining whatever feature macro it's currently
> defining, out of a misguided sense of cleanliness, or (b) selectively
> adding _XOPEN_SOURCE to the set of feature macros it defines, to get a
> XOPEN function.
> 
The specific problem is that these packages simply followed the Linux
instructions to "#define _XOPEN_SOURCE"...  And between the autoconf
stuff and the pkgsrc stuff, I can't really tell what's in effect here
-- all I'm certain of is that strptime() was not being declared
properly until I patched the #define.

Is there a standard -- from anyone -- that specifies those values?
(Aside: several NetBSD .h files compare _XOPEN_SOURCE against 4.  The
rationale for that, given the comments in featuretest, is unclear to
me.  Should that be 400?  The files I found are stdlib.h, unistd.h,
time.h, and wordexp.h.)


                --Steve Bellovin, http://www.cs.columbia.edu/~smb



Home | Main Index | Thread Index | Old Index