xref: /onnv-gate/usr/src/lib/libast/common/features/map.c (revision 12068:08a39a083754)
14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*12068SRoger.Faulkner@Oracle.COM *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
78462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                 Glenn Fowler <gsf@research.att.com>                  *
184887Schin *                  David Korn <dgk@research.att.com>                   *
194887Schin *                   Phong Vo <kpv@research.att.com>                    *
204887Schin *                                                                      *
214887Schin ***********************************************************************/
224887Schin #pragma prototyped
234887Schin 
244887Schin /*
254887Schin  * some systems may pull in <ast_common.h> and its <ast_map.h>
264887Schin  * which we are in the process of generating ... this prevents it
274887Schin  */
284887Schin 
294887Schin #define _def_map_ast	1
304887Schin 
314887Schin #include "FEATURE/lib"
324887Schin #include "FEATURE/mmap"
33*12068SRoger.Faulkner@Oracle.COM #include "FEATURE/options"
344887Schin #include "FEATURE/vmalloc"
35*12068SRoger.Faulkner@Oracle.COM #include "FEATURE/eaccess"
36*12068SRoger.Faulkner@Oracle.COM 
37*12068SRoger.Faulkner@Oracle.COM #if _opt_map_libc && !defined(_map_libc)
38*12068SRoger.Faulkner@Oracle.COM #define _map_libc	1
39*12068SRoger.Faulkner@Oracle.COM #endif
404887Schin 
414887Schin int
main()424887Schin main()
434887Schin {
444887Schin 	printf("#pragma prototyped\n");
454887Schin 	printf("\n");
464887Schin 	printf("/*\n");
474887Schin 	printf(" * prototypes provided for standard interfaces hijacked\n");
484887Schin 	printf(" * by ast and mapped to _ast_* but already prototyped\n");
494887Schin 	printf(" * unmapped in native headers included by <ast_std.h>\n");
504887Schin 	printf(" */\n");
514887Schin 	printf("\n");
524887Schin 	printf("#if _BLD_ast && defined(__EXPORT__)\n");
534887Schin 	printf("#define extern		__EXPORT__\n");
544887Schin 	printf("#endif\n");
554887Schin 	printf("\n");
564887Schin #if __MVS__
574887Schin #undef	_map_libc
584887Schin #define _map_libc	1
594887Schin 	printf("\n");
604887Schin 	printf("/* mvs.390 libc.dll routines can't be intercepted by user dlls */\n");
614887Schin 	printf("#undef	_mem_dd_fd_DIR\n");
624887Schin 	printf("#undef	_typ_long_double\n");
634887Schin #endif
644887Schin #if _map_libc
654887Schin #undef	_map_malloc
664887Schin #define _map_malloc	1
674887Schin 	printf("\n");
684887Schin 	printf("#define	_map_libc	1\n");
694887Schin 	printf("#undef	basename\n");
704887Schin 	printf("#define basename	_ast_basename\n");
714887Schin 	printf("#undef	dirname\n");
724887Schin 	printf("#define dirname		_ast_dirname\n");
73*12068SRoger.Faulkner@Oracle.COM #if !_lib_eaccess
744887Schin 	printf("#undef	eaccess\n");
754887Schin 	printf("#define eaccess		_ast_eaccess\n");
76*12068SRoger.Faulkner@Oracle.COM #endif
774887Schin #if !_lib_execvpe
784887Schin 	printf("#undef	execvpe\n");
794887Schin 	printf("#define execvpe		_ast_execvpe\n");
804887Schin 	printf("extern int		execvpe(const char*, char* const[], char* const[]);\n");
814887Schin #endif
824887Schin 	printf("#undef	fnmatch\n");
834887Schin 	printf("#define fnmatch		_ast_fnmatch\n");
844887Schin 	printf("#undef	fts_children\n");
854887Schin 	printf("#define fts_children    _ast_fts_children\n");
864887Schin 	printf("#undef	fts_close\n");
874887Schin 	printf("#define fts_close       _ast_fts_close\n");
884887Schin 	printf("#undef	fts_flags\n");
894887Schin 	printf("#define fts_flags       _ast_fts_flags\n");
904887Schin 	printf("#undef	fts_notify\n");
914887Schin 	printf("#define fts_notify      _ast_fts_notify\n");
924887Schin 	printf("#undef	fts_open\n");
934887Schin 	printf("#define fts_open	_ast_fts_open\n");
944887Schin 	printf("#undef	fts_read\n");
954887Schin 	printf("#define fts_read	_ast_fts_read\n");
964887Schin 	printf("#undef	fts_set\n");
974887Schin 	printf("#define fts_set		_ast_fts_set\n");
984887Schin 	printf("#undef	ftw\n");
994887Schin 	printf("#define ftw		_ast_ftw\n");
1004887Schin 	printf("#undef	ftwalk\n");
1014887Schin 	printf("#define ftwalk		_ast_ftwalk\n");
1024887Schin 	printf("#undef	ftwflags\n");
1034887Schin 	printf("#define ftwflags	_ast_ftwflags\n");
1044887Schin #if !_WINIX
1054887Schin 	printf("#undef	getcwd\n");
1064887Schin 	printf("#define getcwd		_ast_getcwd\n");
1074887Schin 	printf("extern char*		getcwd(char*, size_t);\n");
1084887Schin #endif
1094887Schin 	printf("#undef	getdate\n");
1104887Schin 	printf("#define getdate		_ast_getdate\n");
1114887Schin #if _lib_getopt || _lib_getsubopt || _lib_getopt_long || _lib_getopt_long_only
1124887Schin 	printf("#undef	getopt\n");
1134887Schin 	printf("#define getopt		_ast_getopt\n");
1144887Schin 	printf("#undef	getsubopt\n");
1154887Schin 	printf("#define getsubopt       _ast_getsubopt\n");
1164887Schin 	printf("#undef	getopt_long\n");
1174887Schin 	printf("#define getopt_long	_ast_getopt_long\n");
1184887Schin 	printf("#undef	getopt_long_only\n");
1194887Schin 	printf("#define getopt_long_only _ast_getopt_long_only\n");
1208462SApril.Chin@Sun.COM 	printf("#undef	optopt\n");
1218462SApril.Chin@Sun.COM 	printf("#define optopt		_ast_optopt\n");
1228462SApril.Chin@Sun.COM 	printf("#undef	optarg\n");
1238462SApril.Chin@Sun.COM 	printf("#define optarg		_ast_optarg\n");
1248462SApril.Chin@Sun.COM 	printf("#undef	optind\n");
1258462SApril.Chin@Sun.COM 	printf("#define optind		_ast_optind\n");
1268462SApril.Chin@Sun.COM 	printf("#undef	opterr\n");
1278462SApril.Chin@Sun.COM 	printf("#define opterr		_ast_opterr\n");
1284887Schin #endif
1294887Schin 	printf("#undef	getwd\n");
1304887Schin 	printf("#define getwd		_ast_getwd\n");
1314887Schin 	printf("extern char*		getwd(char*);\n");
1324887Schin 	printf("#undef	glob\n");
1334887Schin 	printf("#define glob		_ast_glob\n");
1344887Schin 	printf("#undef	globfree\n");
1354887Schin 	printf("#define globfree	_ast_globfree\n");
1364887Schin 	printf("#undef	memdup\n");
1374887Schin 	printf("#define memdup		_ast_memdup\n");
1384887Schin 	printf("#undef	memfatal\n");
1394887Schin 	printf("#define memfatal	_ast_memfatal\n");
1404887Schin 	printf("#undef	memhash\n");
1414887Schin 	printf("#define memhash		_ast_memhash\n");
1424887Schin 	printf("#undef	memsum\n");
1434887Schin 	printf("#define memsum		_ast_memsum\n");
1444887Schin 	printf("#undef	mkstemp\n");
1454887Schin 	printf("#define mkstemp		_ast_mkstemp\n");
1464887Schin 	printf("extern int		mkstemp(char*);\n");
1474887Schin 	printf("#undef	mktemp\n");
1484887Schin 	printf("#define mktemp		_ast_mktemp\n");
1494887Schin 	printf("extern char*		mktemp(char*);\n");
1504887Schin 	printf("#undef	mktime\n");
1514887Schin 	printf("#define mktime		_ast_mktime\n");
1524887Schin 	printf("#undef	nftw\n");
1534887Schin 	printf("#define nftw		_ast_nftw\n");
1548462SApril.Chin@Sun.COM 	printf("#undef	optctx\n");
1558462SApril.Chin@Sun.COM 	printf("#define optctx		_ast_optctx\n");
1564887Schin 	printf("#undef	optesc\n");
1574887Schin 	printf("#define optesc		_ast_optesc\n");
1584887Schin 	printf("#undef	optget\n");
1594887Schin 	printf("#define optget		_ast_optget\n");
1604887Schin 	printf("#undef	opthelp\n");
1614887Schin 	printf("#define opthelp		_ast_opthelp\n");
1624887Schin 	printf("#undef	optjoin\n");
1634887Schin 	printf("#define optjoin		_ast_optjoin\n");
1644887Schin 	printf("#undef	optstr\n");
1654887Schin 	printf("#define optstr		_ast_optstr\n");
1664887Schin 	printf("#undef	optusage\n");
1674887Schin 	printf("#define optusage	_ast_optusage\n");
1684887Schin 	printf("#undef	pathaccess\n");
1694887Schin 	printf("#define pathaccess	_ast_pathaccess\n");
1704887Schin 	printf("#undef	pathbin\n");
1714887Schin 	printf("#define pathbin		_ast_pathbin\n");
1724887Schin 	printf("#undef	pathcanon\n");
1734887Schin 	printf("#define pathcanon	_ast_pathcanon\n");
1744887Schin 	printf("#undef	pathcat\n");
1754887Schin 	printf("#define pathcat		_ast_pathcat\n");
1764887Schin 	printf("#undef	pathcd\n");
1774887Schin 	printf("#define pathcd		_ast_pathcd\n");
1784887Schin 	printf("#undef	pathcheck\n");
1794887Schin 	printf("#define pathcheck	_ast_pathcheck\n");
1804887Schin 	printf("#undef	pathexists\n");
1814887Schin 	printf("#define pathexists	_ast_pathexists\n");
1824887Schin 	printf("#undef	pathfind\n");
1834887Schin 	printf("#define pathfind	_ast_pathfind\n");
1844887Schin 	printf("#undef	pathgetlink\n");
1854887Schin 	printf("#define pathgetlink	_ast_pathgetlink\n");
1864887Schin 	printf("#undef	pathinclude\n");
1874887Schin 	printf("#define pathinclude	_ast_pathinclude\n");
1884887Schin 	printf("#undef	pathkey\n");
1894887Schin 	printf("#define pathkey		_ast_pathkey\n");
1904887Schin 	printf("#undef	pathnative\n");
1914887Schin 	printf("#define pathnative	_ast_pathnative\n");
1924887Schin 	printf("#undef	pathpath\n");
1934887Schin 	printf("#define pathpath	_ast_pathpath\n");
1944887Schin 	printf("#undef	pathposix\n");
1954887Schin 	printf("#define pathposix	_ast_pathposix\n");
1964887Schin 	printf("#undef	pathprobe\n");
1974887Schin 	printf("#define pathprobe	_ast_pathprobe\n");
19810898Sroland.mainz@nrubsig.org 	printf("#undef	pathprog\n");
19910898Sroland.mainz@nrubsig.org 	printf("#define pathprog	_ast_pathprog\n");
2004887Schin 	printf("#undef	pathrepl\n");
2014887Schin 	printf("#define pathrepl	_ast_pathrepl\n");
2024887Schin 	printf("#undef	pathsetlink\n");
2034887Schin 	printf("#define pathsetlink	_ast_pathsetlink\n");
2044887Schin 	printf("#undef	pathshell\n");
2054887Schin 	printf("#define pathshell	_ast_pathshell\n");
2064887Schin 	printf("#undef	pathstat\n");
2074887Schin 	printf("#define pathstat	_ast_pathstat\n");
2084887Schin 	printf("#undef	pathtemp\n");
2094887Schin 	printf("#define pathtemp	_ast_pathtemp\n");
2104887Schin 	printf("#undef	pathtmp\n");
2114887Schin 	printf("#define pathtmp		_ast_pathtmp\n");
2124887Schin 	printf("#undef	procclose\n");
2134887Schin 	printf("#define procclose	_ast_procclose\n");
2144887Schin 	printf("#undef	procfree\n");
2154887Schin 	printf("#define procfree	_ast_procfree\n");
2164887Schin 	printf("#undef	procopen\n");
2174887Schin 	printf("#define procopen	_ast_procopen\n");
2184887Schin 	printf("#undef	procrun\n");
2194887Schin 	printf("#define procrun		_ast_procrun\n");
2204887Schin 	printf("#undef	putenv\n");
2214887Schin 	printf("#define putenv		_ast_putenv\n");
2224887Schin 	printf("#undef	re_comp\n");
2234887Schin 	printf("#define re_comp		_ast_re_comp\n");
2244887Schin 	printf("#undef	re_exec\n");
2254887Schin 	printf("#define re_exec		_ast_re_exec\n");
2264887Schin 	printf("#undef	realpath\n");
2274887Schin 	printf("#define realpath	_ast_realpath\n");
2284887Schin 	printf("extern char*		realpath(const char*, char*);\n");
2294887Schin 	printf("#undef	regaddclass\n");
2304887Schin 	printf("#define regaddclass	_ast_regaddclass\n");
2314887Schin 	printf("#undef	regalloc\n");
2324887Schin 	printf("#define regalloc	_ast_regalloc\n");
2334887Schin 	printf("#undef	regcache\n");
2344887Schin 	printf("#define regcache	_ast_regcache\n");
2354887Schin 	printf("#undef	regclass\n");
2364887Schin 	printf("#define regclass	_ast_regclass\n");
2374887Schin 	printf("#undef	regcmp\n");
2384887Schin 	printf("#define regcmp		_ast_regcmp\n");
2394887Schin 	printf("#undef	regcollate\n");
2404887Schin 	printf("#define regcollate      _ast_regcollate\n");
2414887Schin 	printf("#undef	regcomb\n");
2424887Schin 	printf("#define regcomb		_ast_regcomb\n");
2434887Schin 	printf("#undef	regcomp\n");
2444887Schin 	printf("#define regcomp		_ast_regcomp\n");
2454887Schin 	printf("#undef	regdecomp\n");
2464887Schin 	printf("#define regdecomp	_ast_regdecomp\n");
2474887Schin 	printf("#undef	regdup\n");
2484887Schin 	printf("#define regdup		_ast_regdup\n");
2494887Schin 	printf("#undef	regerror\n");
2504887Schin 	printf("#define regerror	_ast_regerror\n");
2514887Schin 	printf("#undef	regex\n");
2524887Schin 	printf("#define regex		_ast_regex\n");
2534887Schin 	printf("#undef	regexec\n");
2544887Schin 	printf("#define regexec		_ast_regexec\n");
2554887Schin 	printf("#undef	regfatal\n");
2564887Schin 	printf("#define regfatal	_ast_regfatal\n");
2574887Schin 	printf("#undef	regfatalpat\n");
2584887Schin 	printf("#define regfatalpat     _ast_regfatalpat\n");
2594887Schin 	printf("#undef	regfree\n");
2604887Schin 	printf("#define regfree		_ast_regfree\n");
2614887Schin 	printf("#undef	regncomp\n");
2624887Schin 	printf("#define regncomp	_ast_regncomp\n");
2634887Schin 	printf("#undef	regnexec\n");
2644887Schin 	printf("#define regnexec	_ast_regnexec\n");
2654887Schin 	printf("#undef	regrecord\n");
2664887Schin 	printf("#define regrecord       _ast_regrecord\n");
2674887Schin 	printf("#undef	regrexec\n");
2684887Schin 	printf("#define regrexec	_ast_regrexec\n");
2694887Schin 	printf("#undef	regstat\n");
2704887Schin 	printf("#define regstat		_ast_regstat\n");
2714887Schin 	printf("#undef	regsub\n");
2724887Schin 	printf("#define regsub		_ast_regsub\n");
2734887Schin 	printf("#undef	regsubcomp\n");
2744887Schin 	printf("#define regsubcomp	_ast_regsubcomp\n");
2754887Schin 	printf("#undef	regsubexec\n");
2764887Schin 	printf("#define regsubexec	_ast_regsubexec\n");
2774887Schin 	printf("#undef	regsubflags\n");
2784887Schin 	printf("#define regsubflags	_ast_regsubflags\n");
2794887Schin 	printf("#undef	regsubfree\n");
2804887Schin 	printf("#define regsubfree	_ast_regsubfree\n");
2814887Schin 	printf("#undef	remove\n");
2824887Schin 	printf("#define remove		_ast_remove\n");
2834887Schin 	printf("extern int		remove(const char*);\n");
2844887Schin 	printf("#undef	resolvepath\n");
2854887Schin 	printf("#define resolvepath	_ast_resolvepath\n");
2868462SApril.Chin@Sun.COM 	printf("extern int		resolvepath(const char*, char*, size_t);\n");
2874887Schin 	printf("#undef	setenv\n");
2884887Schin 	printf("#define setenv		_ast_setenv\n");
2894887Schin 	printf("extern int		setenv(const char*, const char*, int);\n");
2904887Schin 	printf("#undef	setenviron\n");
2914887Schin 	printf("#define setenviron      _ast_setenviron\n");
2924887Schin 	printf("#undef	sigcritical\n");
2934887Schin 	printf("#define sigcritical      _ast_sigcritical\n");
2944887Schin 	printf("#undef	signal\n");
2954887Schin 	printf("#define signal      	_ast_signal\n");
2964887Schin 	printf("#undef	sigunblock\n");
2974887Schin 	printf("#define sigunblock      _ast_sigunblock\n");
2984887Schin 	printf("#undef	stracmp\n");
2994887Schin 	printf("#define stracmp		_ast_stracmp\n");
3004887Schin 	printf("#undef	strcopy\n");
3014887Schin 	printf("#define strcopy		_ast_strcopy\n");
3024887Schin 	printf("#undef	strelapsed\n");
3034887Schin 	printf("#define strelapsed	_ast_strelapsed\n");
3044887Schin 	printf("#undef	stresc\n");
3054887Schin 	printf("#define stresc		_ast_stresc\n");
3064887Schin 	printf("#undef	streval\n");
3074887Schin 	printf("#define streval		_ast_streval\n");
3084887Schin 	printf("#undef	strexpr\n");
3094887Schin 	printf("#define strexpr		_ast_strexpr\n");
3104887Schin 	printf("#undef	strftime\n");
3114887Schin 	printf("#define strftime	_ast_strftime\n");
3124887Schin 	printf("#undef	strgid\n");
3134887Schin 	printf("#define strgid		_ast_strgid\n");
3144887Schin 	printf("#undef	strgrpmatch\n");
3154887Schin 	printf("#define strgrpmatch	_ast_strgrpmatch\n");
3164887Schin 	printf("#undef	strhash\n");
3174887Schin 	printf("#define strhash		_ast_strhash\n");
3184887Schin 	printf("#undef	strkey\n");
3194887Schin 	printf("#define strkey		_ast_strkey\n");
3204887Schin 	printf("#undef	strlcat\n");
3214887Schin 	printf("#define strlcat		_ast_strlcat\n");
3224887Schin 	printf("extern size_t		strlcat(char*, const char*, size_t);\n");
3234887Schin 	printf("#undef	strlcpy\n");
3244887Schin 	printf("#define strlcpy		_ast_strlcpy\n");
3254887Schin 	printf("extern size_t		strlcpy(char*, const char*, size_t);\n");
3264887Schin 	printf("#undef	strlook\n");
3274887Schin 	printf("#define strlook		_ast_strlook\n");
3284887Schin 	printf("#undef	strmatch\n");
3294887Schin 	printf("#define strmatch	_ast_strmatch\n");
3304887Schin #endif
3314887Schin #if _map_libc || _lib_strmode
3324887Schin 	printf("#undef	strmode\n");
3334887Schin 	printf("#define strmode		_ast_strmode\n");
3344887Schin #endif
3354887Schin #if _map_libc
3364887Schin 	printf("#undef	strnacmp\n");
3374887Schin 	printf("#define strnacmp	_ast_strnacmp\n");
3384887Schin 	printf("#undef	strncopy\n");
3394887Schin 	printf("#define strncopy	_ast_strncopy\n");
3404887Schin 	printf("#undef	strntod\n");
3414887Schin 	printf("#define strntod		_ast_strntod\n");
3424887Schin 	printf("#undef	strntol\n");
3434887Schin 	printf("#define strntol		_ast_strntol\n");
3444887Schin 	printf("#undef	strntold\n");
3454887Schin 	printf("#define strntold	_ast_strntold\n");
3464887Schin 	printf("#undef	strntoll\n");
3474887Schin 	printf("#define strntoll	_ast_strntoll\n");
3484887Schin 	printf("#undef	strntoul\n");
3494887Schin 	printf("#define strntoul	_ast_strntoul\n");
3504887Schin 	printf("#undef	strntoull\n");
3514887Schin 	printf("#define strntoull	_ast_strntoull\n");
3524887Schin 	printf("#undef	stropt\n");
3534887Schin 	printf("#define stropt		_ast_stropt\n");
3544887Schin 	printf("#undef	strperm\n");
3554887Schin 	printf("#define strperm		_ast_strperm\n");
3564887Schin 	printf("#undef	strpsearch\n");
3574887Schin 	printf("#define strpsearch	_ast_strpsearch\n");
3584887Schin #if !_lib_strptime
3594887Schin 	printf("#undef	strptime\n");
3604887Schin 	printf("#define strptime	_ast_strptime\n");
3614887Schin #endif
3624887Schin 	printf("#undef	strsearch\n");
3634887Schin 	printf("#define strsearch	_ast_strsearch\n");
3644887Schin 	printf("#undef	strsort\n");
3654887Schin 	printf("#define strsort		_ast_strsort\n");
3664887Schin 	printf("#undef	strsubmatch\n");
3674887Schin 	printf("#define strsubmatch	_ast_strsubmatch\n");
3684887Schin 	printf("#undef	strsum\n");
3694887Schin 	printf("#define strsum		_ast_strsum\n");
3704887Schin 	printf("#undef	strtape\n");
3714887Schin 	printf("#define strtape		_ast_strtape\n");
3724887Schin 	printf("#undef	strtoip4\n");
3734887Schin 	printf("#define strtoip4	_ast_strtoip4\n");
3744887Schin 	printf("#undef	strton\n");
3754887Schin 	printf("#define strton		_ast_strton\n");
3764887Schin 	printf("#undef	strtonll\n");
3774887Schin 	printf("#define strtonll	_ast_strtonll\n");
3784887Schin 	printf("#undef	struid\n");
3794887Schin 	printf("#define struid		_ast_struid\n");
3804887Schin 	printf("#undef	struniq\n");
3814887Schin 	printf("#define struniq		_ast_struniq\n");
3824887Schin 	printf("#undef	system\n");
3834887Schin 	printf("#define system		_ast_system\n");
3844887Schin 	printf("extern int		system(const char*);\n");
3854887Schin 	printf("#undef	tempnam\n");
3864887Schin 	printf("#define tempnam		_ast_tempnam\n");
3874887Schin 	printf("extern char*		tempnam(const char*, const char*);\n");
3884887Schin 	printf("#undef	tmpnam\n");
3894887Schin 	printf("#define tmpnam		_ast_tmpnam\n");
3904887Schin 	printf("extern char*		tmpnam(char*);\n");
3914887Schin 	printf("#undef	touch\n");
3924887Schin 	printf("#define touch		_ast_touch\n");
3934887Schin 	printf("#undef	wordexp\n");
3944887Schin 	printf("#define wordexp		_ast_wordexp\n");
3954887Schin 	printf("#undef	wordfree\n");
3964887Schin 	printf("#define wordfree	_ast_wordfree\n");
3974887Schin 	printf("#undef	unsetenv\n");
3984887Schin 	printf("#define unsetenv	_ast_unsetenv\n");
3994887Schin #endif
4004887Schin #if _std_malloc
4014887Schin 	printf("\n");
4024887Schin 	printf("/* no local malloc override */\n");
4034887Schin 	printf("#define	_std_malloc	1\n");
4044887Schin #else
4054887Schin #if _map_malloc
4064887Schin 	printf("\n");
4074887Schin 	printf("/* cannot override local malloc */\n");
4084887Schin 	printf("#define	_map_malloc	1\n");
4094887Schin 	printf("#undef	calloc\n");
4104887Schin 	printf("#define calloc		_ast_calloc\n");
4114887Schin 	printf("extern void*		calloc(size_t, size_t);\n");
4124887Schin 	printf("#undef	cfree\n");
4134887Schin 	printf("#define cfree		_ast_cfree\n");
4144887Schin 	printf("extern void		cfree(void*);\n");
4154887Schin 	printf("#undef	free\n");
4164887Schin 	printf("#define free		_ast_free\n");
4174887Schin 	printf("extern void		free(void*);\n");
4184887Schin #if _lib_mallinfo
4194887Schin 	printf("#undef	mallinfo\n");
4204887Schin 	printf("#define mallinfo	_ast_mallinfo\n");
4214887Schin #endif
4224887Schin 	printf("#undef	malloc\n");
4234887Schin 	printf("#define malloc		_ast_malloc\n");
4244887Schin 	printf("extern void*		malloc(size_t);\n");
4254887Schin #if _lib_mallopt
4264887Schin 	printf("#undef	mallopt\n");
4274887Schin 	printf("#define mallopt		_ast_mallopt\n");
4284887Schin #endif
4294887Schin #if _lib_memalign
4304887Schin 	printf("#undef	memalign\n");
4314887Schin 	printf("#define memalign	_ast_memalign\n");
4324887Schin 	printf("extern void*		memalign(size_t, size_t);\n");
4334887Schin #endif
4344887Schin #if _lib_mstats
4354887Schin 	printf("#undef	mstats\n");
4364887Schin 	printf("#define mstats		_ast_mstats\n");
4374887Schin #endif
4384887Schin #if _lib_pvalloc
4394887Schin 	printf("#undef	pvalloc\n");
4404887Schin 	printf("#define pvalloc		_ast_pvalloc\n");
4414887Schin #endif
4424887Schin 	printf("#undef	realloc\n");
4434887Schin 	printf("#define realloc		_ast_realloc\n");
4444887Schin 	printf("extern void*		realloc(void*, size_t);\n");
4454887Schin 	printf("#undef	strdup\n");
4464887Schin 	printf("#define strdup		_ast_strdup\n");
4474887Schin 	printf("extern char*		strdup(const char*);\n");
4484887Schin #if _lib_valloc
4494887Schin 	printf("#undef	valloc\n");
4504887Schin 	printf("#define valloc		_ast_valloc\n");
4514887Schin 	printf("extern void*		valloc(size_t);\n");
4524887Schin #endif
4534887Schin #endif
4544887Schin #endif
4554887Schin 
4564887Schin 	/*
4574887Schin 	 * overriding <stdlib.h> strto*() is problematic to say the least
4584887Schin 	 */
4594887Schin 
4604887Schin #if _map_libc || _std_strtol
4614887Schin #if !__CYGWIN__
4624887Schin 	printf("#undef	strtol\n");
4634887Schin 	printf("#define strtol		_ast_strtol\n");
4644887Schin 	printf("#undef	strtoul\n");
4654887Schin 	printf("#define strtoul		_ast_strtoul\n");
4664887Schin #endif
4674887Schin 	printf("#undef	strtoll\n");
4684887Schin 	printf("#define strtoll		_ast_strtoll\n");
4694887Schin 	printf("#undef	strtoull\n");
4704887Schin 	printf("#define strtoull	_ast_strtoull\n");
4714887Schin #endif
4724887Schin #if _map_libc || _std_strtod
4734887Schin 	printf("#undef	strtod\n");
4744887Schin 	printf("#define strtod		_ast_strtod\n");
4754887Schin #endif
4764887Schin #if _map_libc || _std_strtold
4774887Schin 	printf("#undef	strtold\n");
4784887Schin 	printf("#define strtold		_ast_strtold\n");
4794887Schin #endif
4804887Schin #if !__CYGWIN__
4814887Schin #if _npt_strtol || _map_libc || _std_strtol
4824887Schin #if _npt_strtol && !_map_libc && !_std_strtol
4834887Schin 	printf("#ifndef _ISOC99_SOURCE\n");
4844887Schin #endif
4854887Schin 	printf("extern long		strtol(const char*, char**, int);\n");
4864887Schin #if _npt_strtol && !_map_libc && !_std_strtol
4874887Schin 	printf("#endif\n");
4884887Schin #endif
4894887Schin #endif
4904887Schin #if _npt_strtoul || _map_libc || _std_strtol
4914887Schin #if _npt_strtoul && !_map_libc && !_std_strtol
4924887Schin 	printf("#ifndef _ISOC99_SOURCE\n");
4934887Schin #endif
4944887Schin 	printf("extern unsigned long	strtoul(const char*, char**, int);\n");
4954887Schin #if _npt_strtoul && !_map_libc && !_std_strtol
4964887Schin 	printf("#endif\n");
4974887Schin #endif
4984887Schin #endif
4994887Schin #endif
5004887Schin #if _npt_strtod || _map_libc || _std_strtod
5014887Schin #if _npt_strtod && !_map_libc && !_std_strtod
5024887Schin 	printf("#ifndef _ISOC99_SOURCE\n");
5034887Schin #endif
5044887Schin 	printf("extern double		strtod(const char*, char**);\n");
5054887Schin #if _npt_strtod && !_map_libc && !_std_strtod
5064887Schin 	printf("#endif\n");
5074887Schin #endif
5084887Schin #endif
5094887Schin 	printf("#if !_UWIN\n");
5104887Schin 	printf("#undef	extern\n");
5114887Schin 	printf("#endif\n");
5124887Schin #if _npt_strtold || _map_libc || _std_strtold
5134887Schin #if _npt_strtold && !_map_libc && !_std_strtold
5144887Schin 	printf("#ifndef _ISOC99_SOURCE\n");
5154887Schin #endif
5164887Schin 	printf("extern _ast_fltmax_t	strtold(const char*, char**);\n");
5174887Schin #if _npt_strtold && !_map_libc && !_std_strtold
5184887Schin 	printf("#endif\n");
5194887Schin #endif
5204887Schin #endif
5214887Schin 	printf("#undef	extern\n");
5224887Schin #if _npt_strtoll || _map_libc || _std_strtol
5234887Schin #if _npt_strtoll && !_map_libc && !_std_strtol
5244887Schin 	printf("#ifndef _ISOC99_SOURCE\n");
5254887Schin #endif
5264887Schin 	printf("extern _ast_intmax_t		strtoll(const char*, char**, int);\n");
5274887Schin #if _npt_strtoll && !_map_libc && !_std_strtol
5284887Schin 	printf("#endif\n");
5294887Schin #endif
5304887Schin #endif
5314887Schin #if _npt_strtoull || _map_libc || _std_strtol
5324887Schin #if _npt_strtoull && !_map_libc && !_std_strtol
5334887Schin 	printf("#ifndef _ISOC99_SOURCE\n");
5344887Schin #endif
5354887Schin 	printf("extern unsigned _ast_intmax_t	strtoull(const char*, char**, int);\n");
5364887Schin #if _npt_strtoull && !_map_libc && !_std_strtoul
5374887Schin 	printf("#endif\n");
5384887Schin #endif
5394887Schin #endif
5404887Schin 	printf("\n");
5414887Schin 	printf("#undef	extern\n");
5424887Schin 	return 0;
5434887Schin }
544