xref: /titanic_41/usr/src/lib/libast/common/features/tmlib (revision 5203bc321053fb87d7073c7640548fab73634793)
1set	prototyped
2
3_cc_export_dynamic = note{ probe CC.EXPORT.DYNAMIC supported }end run{
4	case `{ probe -l C make cc | grep '^CC.EXPORT.DYNAMIC = .'; } 2>/dev/null` in
5	'')	exit 1 ;;
6	esac
7}end
8
9tst	tzset_environ note{ tzset() bypasses user getenv() }end execute{
10	#if _UWIN || !_cc_export_dynamic
11	int main()
12	{
13		return 0;
14	}
15	#else
16	#include <time.h>
17	extern char**	environ;
18	extern char*	tzname[2];
19	#if _STD_
20	extern char* getenv(char* s)
21	#else
22	extern char* getenv(s)
23	char*	s;
24	#endif
25	{
26		return "foo0bar";
27	}
28	int main()
29	{
30		tzset();
31		return tzname[0] && !strcmp(tzname[0], "foo") &&
32		       tzname[1] && !strcmp(tzname[1], "bar");
33	}
34	#endif
35}end
36
37if ( _tzset_environ ) {
38	#define tmlocaltime(p)		_tm_localtime(p)
39
40	extern struct tm*		_tm_localtime(const time_t*);
41}
42else {
43	#define tmlocaltime(p)		localtime(p)
44}
45endif
46