[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Missing argument to ctime_r



Kurt D. Zeilenga writes:
> FreeBSD3.0: /usr/include/time.h
> 	char *ctime_r __P((const time_t *, char *));

Ouch.

I found this in time.h and some other .h files on a recent Solaris:

/*
 * Previous releases of Solaris, starting at 2.3, provided definitions of
 * various functions as specified in POSIX.1c, Draft 6.  For some of these
 * functions, the final POSIX 1003.1c standard had a different number of
 * arguments and return values.

Do POSIX draft 6 and the final 1003.1c promise to #define something
which the C source can test for?  I don't know POSIX.  Solaris does the
following, where the appication is supposed to #define _POSIX_C_SOURCE
or _POSIX_PTHREAD_SEMANTICS as needed if the Draft 6 version is desired:

#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
     extern char *ctime_r(const time_t *, char *);
#else
     extern char *ctime_r(const time_t *, char *, int);
#endif


On the other hand, SGI only has the 3-argument prototype, used if:

    (defined(_SGI_SOURCE) &&
     !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) ||
    defined(_SGI_REENTRANT_FUNCTIONS)

-- 
Hallvard