summaryrefslogtreecommitdiff
path: root/usr/src/lib/libast/common/features/tmlib
blob: 221079c339b7b9debe5c56772556aa5604c15abf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
set	prototyped

_cc_export_dynamic = note{ probe CC.EXPORT.DYNAMIC supported }end run{
	case `{ probe -l C make cc | grep '^CC.EXPORT.DYNAMIC = .'; } 2>/dev/null` in
	'')	exit 1 ;;
	esac
}end

tst	tzset_environ note{ tzset() bypasses user getenv() }end execute{
	#if _UWIN || !_cc_export_dynamic
	int main()
	{
		return 0;
	}
	#else
	#include <time.h>
	extern char**	environ;
	extern char*	tzname[2];
	#if _STD_
	extern char* getenv(char* s)
	#else
	extern char* getenv(s)
	char*	s;
	#endif
	{
		return "foo0bar";
	}
	int main()
	{
		tzset();
		return tzname[0] && !strcmp(tzname[0], "foo") &&
		       tzname[1] && !strcmp(tzname[1], "bar");
	}
	#endif
}end

if ( _tzset_environ ) {
	#define tmlocaltime(p)		_tm_localtime(p)

	extern struct tm*		_tm_localtime(const time_t*);
}
else {
	#define tmlocaltime(p)		localtime(p)
}
endif