1 /*********************************************************************** 2 * * 3 * This software is part of the ast package * 4 * Copyright (c) 1985-2008 AT&T Intellectual Property * 5 * and is licensed under the * 6 * Common Public License, Version 1.0 * 7 * by AT&T Intellectual Property * 8 * * 9 * A copy of the License is available at * 10 * http://www.opensource.org/licenses/cpl1.0.txt * 11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 12 * * 13 * Information and Software Systems Research * 14 * AT&T Research * 15 * Florham Park NJ * 16 * * 17 * Glenn Fowler <gsf@research.att.com> * 18 * David Korn <dgk@research.att.com> * 19 * Phong Vo <kpv@research.att.com> * 20 * * 21 ***********************************************************************/ 22 #pragma prototyped 23 24 /* 25 * some systems may pull in <ast_common.h> and its <ast_map.h> 26 * which we are in the process of generating ... this prevents it 27 */ 28 29 #define _def_map_ast 1 30 31 #include "FEATURE/lib" 32 #include "FEATURE/mmap" 33 #include "FEATURE/vmalloc" 34 35 int 36 main() 37 { 38 printf("#pragma prototyped\n"); 39 printf("\n"); 40 printf("/*\n"); 41 printf(" * prototypes provided for standard interfaces hijacked\n"); 42 printf(" * by ast and mapped to _ast_* but already prototyped\n"); 43 printf(" * unmapped in native headers included by <ast_std.h>\n"); 44 printf(" */\n"); 45 printf("\n"); 46 printf("#if _BLD_ast && defined(__EXPORT__)\n"); 47 printf("#define extern __EXPORT__\n"); 48 printf("#endif\n"); 49 printf("\n"); 50 #if __MVS__ 51 #undef _map_libc 52 #define _map_libc 1 53 printf("\n"); 54 printf("/* mvs.390 libc.dll routines can't be intercepted by user dlls */\n"); 55 printf("#undef _mem_dd_fd_DIR\n"); 56 printf("#undef _typ_long_double\n"); 57 #endif 58 #if _map_libc 59 #undef _map_malloc 60 #define _map_malloc 1 61 printf("\n"); 62 printf("#define _map_libc 1\n"); 63 printf("#undef basename\n"); 64 printf("#define basename _ast_basename\n"); 65 printf("#undef dirname\n"); 66 printf("#define dirname _ast_dirname\n"); 67 printf("#undef eaccess\n"); 68 printf("#define eaccess _ast_eaccess\n"); 69 #if !_lib_execvpe 70 printf("#undef execvpe\n"); 71 printf("#define execvpe _ast_execvpe\n"); 72 printf("extern int execvpe(const char*, char* const[], char* const[]);\n"); 73 #endif 74 printf("#undef fnmatch\n"); 75 printf("#define fnmatch _ast_fnmatch\n"); 76 printf("#undef fts_children\n"); 77 printf("#define fts_children _ast_fts_children\n"); 78 printf("#undef fts_close\n"); 79 printf("#define fts_close _ast_fts_close\n"); 80 printf("#undef fts_flags\n"); 81 printf("#define fts_flags _ast_fts_flags\n"); 82 printf("#undef fts_notify\n"); 83 printf("#define fts_notify _ast_fts_notify\n"); 84 printf("#undef fts_open\n"); 85 printf("#define fts_open _ast_fts_open\n"); 86 printf("#undef fts_read\n"); 87 printf("#define fts_read _ast_fts_read\n"); 88 printf("#undef fts_set\n"); 89 printf("#define fts_set _ast_fts_set\n"); 90 printf("#undef ftw\n"); 91 printf("#define ftw _ast_ftw\n"); 92 printf("#undef ftwalk\n"); 93 printf("#define ftwalk _ast_ftwalk\n"); 94 printf("#undef ftwflags\n"); 95 printf("#define ftwflags _ast_ftwflags\n"); 96 #if !_WINIX 97 printf("#undef getcwd\n"); 98 printf("#define getcwd _ast_getcwd\n"); 99 printf("extern char* getcwd(char*, size_t);\n"); 100 #endif 101 printf("#undef getdate\n"); 102 printf("#define getdate _ast_getdate\n"); 103 #if _lib_getopt || _lib_getsubopt || _lib_getopt_long || _lib_getopt_long_only 104 printf("#undef getopt\n"); 105 printf("#define getopt _ast_getopt\n"); 106 printf("#undef getsubopt\n"); 107 printf("#define getsubopt _ast_getsubopt\n"); 108 printf("#undef getopt_long\n"); 109 printf("#define getopt_long _ast_getopt_long\n"); 110 printf("#undef getopt_long_only\n"); 111 printf("#define getopt_long_only _ast_getopt_long_only\n"); 112 printf("#undef optopt\n"); 113 printf("#define optopt _ast_optopt\n"); 114 printf("#undef optarg\n"); 115 printf("#define optarg _ast_optarg\n"); 116 printf("#undef optind\n"); 117 printf("#define optind _ast_optind\n"); 118 printf("#undef opterr\n"); 119 printf("#define opterr _ast_opterr\n"); 120 #endif 121 printf("#undef getwd\n"); 122 printf("#define getwd _ast_getwd\n"); 123 printf("extern char* getwd(char*);\n"); 124 printf("#undef glob\n"); 125 printf("#define glob _ast_glob\n"); 126 printf("#undef globfree\n"); 127 printf("#define globfree _ast_globfree\n"); 128 printf("#undef memdup\n"); 129 printf("#define memdup _ast_memdup\n"); 130 printf("#undef memfatal\n"); 131 printf("#define memfatal _ast_memfatal\n"); 132 printf("#undef memhash\n"); 133 printf("#define memhash _ast_memhash\n"); 134 printf("#undef memsum\n"); 135 printf("#define memsum _ast_memsum\n"); 136 printf("#undef mkstemp\n"); 137 printf("#define mkstemp _ast_mkstemp\n"); 138 printf("extern int mkstemp(char*);\n"); 139 printf("#undef mktemp\n"); 140 printf("#define mktemp _ast_mktemp\n"); 141 printf("extern char* mktemp(char*);\n"); 142 printf("#undef mktime\n"); 143 printf("#define mktime _ast_mktime\n"); 144 printf("#undef nftw\n"); 145 printf("#define nftw _ast_nftw\n"); 146 printf("#undef optctx\n"); 147 printf("#define optctx _ast_optctx\n"); 148 printf("#undef optesc\n"); 149 printf("#define optesc _ast_optesc\n"); 150 printf("#undef optget\n"); 151 printf("#define optget _ast_optget\n"); 152 printf("#undef opthelp\n"); 153 printf("#define opthelp _ast_opthelp\n"); 154 printf("#undef optjoin\n"); 155 printf("#define optjoin _ast_optjoin\n"); 156 printf("#undef optstr\n"); 157 printf("#define optstr _ast_optstr\n"); 158 printf("#undef optusage\n"); 159 printf("#define optusage _ast_optusage\n"); 160 printf("#undef pathaccess\n"); 161 printf("#define pathaccess _ast_pathaccess\n"); 162 printf("#undef pathbin\n"); 163 printf("#define pathbin _ast_pathbin\n"); 164 printf("#undef pathcanon\n"); 165 printf("#define pathcanon _ast_pathcanon\n"); 166 printf("#undef pathcat\n"); 167 printf("#define pathcat _ast_pathcat\n"); 168 printf("#undef pathcd\n"); 169 printf("#define pathcd _ast_pathcd\n"); 170 printf("#undef pathcheck\n"); 171 printf("#define pathcheck _ast_pathcheck\n"); 172 printf("#undef pathexists\n"); 173 printf("#define pathexists _ast_pathexists\n"); 174 printf("#undef pathfind\n"); 175 printf("#define pathfind _ast_pathfind\n"); 176 printf("#undef pathgetlink\n"); 177 printf("#define pathgetlink _ast_pathgetlink\n"); 178 printf("#undef pathinclude\n"); 179 printf("#define pathinclude _ast_pathinclude\n"); 180 printf("#undef pathkey\n"); 181 printf("#define pathkey _ast_pathkey\n"); 182 printf("#undef pathnative\n"); 183 printf("#define pathnative _ast_pathnative\n"); 184 printf("#undef pathpath\n"); 185 printf("#define pathpath _ast_pathpath\n"); 186 printf("#undef pathposix\n"); 187 printf("#define pathposix _ast_pathposix\n"); 188 printf("#undef pathprobe\n"); 189 printf("#define pathprobe _ast_pathprobe\n"); 190 printf("#undef pathrepl\n"); 191 printf("#define pathrepl _ast_pathrepl\n"); 192 printf("#undef pathsetlink\n"); 193 printf("#define pathsetlink _ast_pathsetlink\n"); 194 printf("#undef pathshell\n"); 195 printf("#define pathshell _ast_pathshell\n"); 196 printf("#undef pathstat\n"); 197 printf("#define pathstat _ast_pathstat\n"); 198 printf("#undef pathtemp\n"); 199 printf("#define pathtemp _ast_pathtemp\n"); 200 printf("#undef pathtmp\n"); 201 printf("#define pathtmp _ast_pathtmp\n"); 202 printf("#undef procclose\n"); 203 printf("#define procclose _ast_procclose\n"); 204 printf("#undef procfree\n"); 205 printf("#define procfree _ast_procfree\n"); 206 printf("#undef procopen\n"); 207 printf("#define procopen _ast_procopen\n"); 208 printf("#undef procrun\n"); 209 printf("#define procrun _ast_procrun\n"); 210 printf("#undef putenv\n"); 211 printf("#define putenv _ast_putenv\n"); 212 printf("#undef re_comp\n"); 213 printf("#define re_comp _ast_re_comp\n"); 214 printf("#undef re_exec\n"); 215 printf("#define re_exec _ast_re_exec\n"); 216 printf("#undef realpath\n"); 217 printf("#define realpath _ast_realpath\n"); 218 printf("extern char* realpath(const char*, char*);\n"); 219 printf("#undef regaddclass\n"); 220 printf("#define regaddclass _ast_regaddclass\n"); 221 printf("#undef regalloc\n"); 222 printf("#define regalloc _ast_regalloc\n"); 223 printf("#undef regcache\n"); 224 printf("#define regcache _ast_regcache\n"); 225 printf("#undef regclass\n"); 226 printf("#define regclass _ast_regclass\n"); 227 printf("#undef regcmp\n"); 228 printf("#define regcmp _ast_regcmp\n"); 229 printf("#undef regcollate\n"); 230 printf("#define regcollate _ast_regcollate\n"); 231 printf("#undef regcomb\n"); 232 printf("#define regcomb _ast_regcomb\n"); 233 printf("#undef regcomp\n"); 234 printf("#define regcomp _ast_regcomp\n"); 235 printf("#undef regdecomp\n"); 236 printf("#define regdecomp _ast_regdecomp\n"); 237 printf("#undef regdup\n"); 238 printf("#define regdup _ast_regdup\n"); 239 printf("#undef regerror\n"); 240 printf("#define regerror _ast_regerror\n"); 241 printf("#undef regex\n"); 242 printf("#define regex _ast_regex\n"); 243 printf("#undef regexec\n"); 244 printf("#define regexec _ast_regexec\n"); 245 printf("#undef regfatal\n"); 246 printf("#define regfatal _ast_regfatal\n"); 247 printf("#undef regfatalpat\n"); 248 printf("#define regfatalpat _ast_regfatalpat\n"); 249 printf("#undef regfree\n"); 250 printf("#define regfree _ast_regfree\n"); 251 printf("#undef regncomp\n"); 252 printf("#define regncomp _ast_regncomp\n"); 253 printf("#undef regnexec\n"); 254 printf("#define regnexec _ast_regnexec\n"); 255 printf("#undef regrecord\n"); 256 printf("#define regrecord _ast_regrecord\n"); 257 printf("#undef regrexec\n"); 258 printf("#define regrexec _ast_regrexec\n"); 259 printf("#undef regstat\n"); 260 printf("#define regstat _ast_regstat\n"); 261 printf("#undef regsub\n"); 262 printf("#define regsub _ast_regsub\n"); 263 printf("#undef regsubcomp\n"); 264 printf("#define regsubcomp _ast_regsubcomp\n"); 265 printf("#undef regsubexec\n"); 266 printf("#define regsubexec _ast_regsubexec\n"); 267 printf("#undef regsubflags\n"); 268 printf("#define regsubflags _ast_regsubflags\n"); 269 printf("#undef regsubfree\n"); 270 printf("#define regsubfree _ast_regsubfree\n"); 271 printf("#undef remove\n"); 272 printf("#define remove _ast_remove\n"); 273 printf("extern int remove(const char*);\n"); 274 printf("#undef resolvepath\n"); 275 printf("#define resolvepath _ast_resolvepath\n"); 276 printf("extern int resolvepath(const char*, char*, size_t);\n"); 277 printf("#undef setenv\n"); 278 printf("#define setenv _ast_setenv\n"); 279 printf("extern int setenv(const char*, const char*, int);\n"); 280 printf("#undef setenviron\n"); 281 printf("#define setenviron _ast_setenviron\n"); 282 printf("#undef sigcritical\n"); 283 printf("#define sigcritical _ast_sigcritical\n"); 284 printf("#undef signal\n"); 285 printf("#define signal _ast_signal\n"); 286 printf("#undef sigunblock\n"); 287 printf("#define sigunblock _ast_sigunblock\n"); 288 printf("#undef stracmp\n"); 289 printf("#define stracmp _ast_stracmp\n"); 290 printf("#undef strcopy\n"); 291 printf("#define strcopy _ast_strcopy\n"); 292 printf("#undef strelapsed\n"); 293 printf("#define strelapsed _ast_strelapsed\n"); 294 printf("#undef stresc\n"); 295 printf("#define stresc _ast_stresc\n"); 296 printf("#undef streval\n"); 297 printf("#define streval _ast_streval\n"); 298 printf("#undef strexpr\n"); 299 printf("#define strexpr _ast_strexpr\n"); 300 printf("#undef strftime\n"); 301 printf("#define strftime _ast_strftime\n"); 302 printf("#undef strgid\n"); 303 printf("#define strgid _ast_strgid\n"); 304 printf("#undef strgrpmatch\n"); 305 printf("#define strgrpmatch _ast_strgrpmatch\n"); 306 printf("#undef strhash\n"); 307 printf("#define strhash _ast_strhash\n"); 308 printf("#undef strkey\n"); 309 printf("#define strkey _ast_strkey\n"); 310 printf("#undef strlcat\n"); 311 printf("#define strlcat _ast_strlcat\n"); 312 printf("extern size_t strlcat(char*, const char*, size_t);\n"); 313 printf("#undef strlcpy\n"); 314 printf("#define strlcpy _ast_strlcpy\n"); 315 printf("extern size_t strlcpy(char*, const char*, size_t);\n"); 316 printf("#undef strlook\n"); 317 printf("#define strlook _ast_strlook\n"); 318 printf("#undef strmatch\n"); 319 printf("#define strmatch _ast_strmatch\n"); 320 #endif 321 #if _map_libc || _lib_strmode 322 printf("#undef strmode\n"); 323 printf("#define strmode _ast_strmode\n"); 324 #endif 325 #if _map_libc 326 printf("#undef strnacmp\n"); 327 printf("#define strnacmp _ast_strnacmp\n"); 328 printf("#undef strncopy\n"); 329 printf("#define strncopy _ast_strncopy\n"); 330 printf("#undef strntod\n"); 331 printf("#define strntod _ast_strntod\n"); 332 printf("#undef strntol\n"); 333 printf("#define strntol _ast_strntol\n"); 334 printf("#undef strntold\n"); 335 printf("#define strntold _ast_strntold\n"); 336 printf("#undef strntoll\n"); 337 printf("#define strntoll _ast_strntoll\n"); 338 printf("#undef strntoul\n"); 339 printf("#define strntoul _ast_strntoul\n"); 340 printf("#undef strntoull\n"); 341 printf("#define strntoull _ast_strntoull\n"); 342 printf("#undef stropt\n"); 343 printf("#define stropt _ast_stropt\n"); 344 printf("#undef strperm\n"); 345 printf("#define strperm _ast_strperm\n"); 346 printf("#undef strpsearch\n"); 347 printf("#define strpsearch _ast_strpsearch\n"); 348 #if !_lib_strptime 349 printf("#undef strptime\n"); 350 printf("#define strptime _ast_strptime\n"); 351 #endif 352 printf("#undef strsearch\n"); 353 printf("#define strsearch _ast_strsearch\n"); 354 printf("#undef strsort\n"); 355 printf("#define strsort _ast_strsort\n"); 356 printf("#undef strsubmatch\n"); 357 printf("#define strsubmatch _ast_strsubmatch\n"); 358 printf("#undef strsum\n"); 359 printf("#define strsum _ast_strsum\n"); 360 printf("#undef strtape\n"); 361 printf("#define strtape _ast_strtape\n"); 362 printf("#undef strtoip4\n"); 363 printf("#define strtoip4 _ast_strtoip4\n"); 364 printf("#undef strton\n"); 365 printf("#define strton _ast_strton\n"); 366 printf("#undef strtonll\n"); 367 printf("#define strtonll _ast_strtonll\n"); 368 printf("#undef struid\n"); 369 printf("#define struid _ast_struid\n"); 370 printf("#undef struniq\n"); 371 printf("#define struniq _ast_struniq\n"); 372 printf("#undef system\n"); 373 printf("#define system _ast_system\n"); 374 printf("extern int system(const char*);\n"); 375 printf("#undef tempnam\n"); 376 printf("#define tempnam _ast_tempnam\n"); 377 printf("extern char* tempnam(const char*, const char*);\n"); 378 printf("#undef tmpnam\n"); 379 printf("#define tmpnam _ast_tmpnam\n"); 380 printf("extern char* tmpnam(char*);\n"); 381 printf("#undef touch\n"); 382 printf("#define touch _ast_touch\n"); 383 printf("#undef wordexp\n"); 384 printf("#define wordexp _ast_wordexp\n"); 385 printf("#undef wordfree\n"); 386 printf("#define wordfree _ast_wordfree\n"); 387 printf("#undef unsetenv\n"); 388 printf("#define unsetenv _ast_unsetenv\n"); 389 #endif 390 #if _std_malloc 391 printf("\n"); 392 printf("/* no local malloc override */\n"); 393 printf("#define _std_malloc 1\n"); 394 #else 395 #if _map_malloc 396 printf("\n"); 397 printf("/* cannot override local malloc */\n"); 398 printf("#define _map_malloc 1\n"); 399 printf("#undef calloc\n"); 400 printf("#define calloc _ast_calloc\n"); 401 printf("extern void* calloc(size_t, size_t);\n"); 402 printf("#undef cfree\n"); 403 printf("#define cfree _ast_cfree\n"); 404 printf("extern void cfree(void*);\n"); 405 printf("#undef free\n"); 406 printf("#define free _ast_free\n"); 407 printf("extern void free(void*);\n"); 408 #if _lib_mallinfo 409 printf("#undef mallinfo\n"); 410 printf("#define mallinfo _ast_mallinfo\n"); 411 #endif 412 printf("#undef malloc\n"); 413 printf("#define malloc _ast_malloc\n"); 414 printf("extern void* malloc(size_t);\n"); 415 #if _lib_mallopt 416 printf("#undef mallopt\n"); 417 printf("#define mallopt _ast_mallopt\n"); 418 #endif 419 #if _lib_memalign 420 printf("#undef memalign\n"); 421 printf("#define memalign _ast_memalign\n"); 422 printf("extern void* memalign(size_t, size_t);\n"); 423 #endif 424 #if _lib_mstats 425 printf("#undef mstats\n"); 426 printf("#define mstats _ast_mstats\n"); 427 #endif 428 #if _lib_pvalloc 429 printf("#undef pvalloc\n"); 430 printf("#define pvalloc _ast_pvalloc\n"); 431 #endif 432 printf("#undef realloc\n"); 433 printf("#define realloc _ast_realloc\n"); 434 printf("extern void* realloc(void*, size_t);\n"); 435 printf("#undef strdup\n"); 436 printf("#define strdup _ast_strdup\n"); 437 printf("extern char* strdup(const char*);\n"); 438 #if _lib_valloc 439 printf("#undef valloc\n"); 440 printf("#define valloc _ast_valloc\n"); 441 printf("extern void* valloc(size_t);\n"); 442 #endif 443 #endif 444 #endif 445 446 /* 447 * overriding <stdlib.h> strto*() is problematic to say the least 448 */ 449 450 #if _map_libc || _std_strtol 451 #if !__CYGWIN__ 452 printf("#undef strtol\n"); 453 printf("#define strtol _ast_strtol\n"); 454 printf("#undef strtoul\n"); 455 printf("#define strtoul _ast_strtoul\n"); 456 #endif 457 printf("#undef strtoll\n"); 458 printf("#define strtoll _ast_strtoll\n"); 459 printf("#undef strtoull\n"); 460 printf("#define strtoull _ast_strtoull\n"); 461 #endif 462 #if _map_libc || _std_strtod 463 printf("#undef strtod\n"); 464 printf("#define strtod _ast_strtod\n"); 465 #endif 466 #if _map_libc || _std_strtold 467 printf("#undef strtold\n"); 468 printf("#define strtold _ast_strtold\n"); 469 #endif 470 #if !__CYGWIN__ 471 #if _npt_strtol || _map_libc || _std_strtol 472 #if _npt_strtol && !_map_libc && !_std_strtol 473 printf("#ifndef _ISOC99_SOURCE\n"); 474 #endif 475 printf("extern long strtol(const char*, char**, int);\n"); 476 #if _npt_strtol && !_map_libc && !_std_strtol 477 printf("#endif\n"); 478 #endif 479 #endif 480 #if _npt_strtoul || _map_libc || _std_strtol 481 #if _npt_strtoul && !_map_libc && !_std_strtol 482 printf("#ifndef _ISOC99_SOURCE\n"); 483 #endif 484 printf("extern unsigned long strtoul(const char*, char**, int);\n"); 485 #if _npt_strtoul && !_map_libc && !_std_strtol 486 printf("#endif\n"); 487 #endif 488 #endif 489 #endif 490 #if _npt_strtod || _map_libc || _std_strtod 491 #if _npt_strtod && !_map_libc && !_std_strtod 492 printf("#ifndef _ISOC99_SOURCE\n"); 493 #endif 494 printf("extern double strtod(const char*, char**);\n"); 495 #if _npt_strtod && !_map_libc && !_std_strtod 496 printf("#endif\n"); 497 #endif 498 #endif 499 printf("#if !_UWIN\n"); 500 printf("#undef extern\n"); 501 printf("#endif\n"); 502 #if _npt_strtold || _map_libc || _std_strtold 503 #if _npt_strtold && !_map_libc && !_std_strtold 504 printf("#ifndef _ISOC99_SOURCE\n"); 505 #endif 506 printf("extern _ast_fltmax_t strtold(const char*, char**);\n"); 507 #if _npt_strtold && !_map_libc && !_std_strtold 508 printf("#endif\n"); 509 #endif 510 #endif 511 printf("#undef extern\n"); 512 #if _npt_strtoll || _map_libc || _std_strtol 513 #if _npt_strtoll && !_map_libc && !_std_strtol 514 printf("#ifndef _ISOC99_SOURCE\n"); 515 #endif 516 printf("extern _ast_intmax_t strtoll(const char*, char**, int);\n"); 517 #if _npt_strtoll && !_map_libc && !_std_strtol 518 printf("#endif\n"); 519 #endif 520 #endif 521 #if _npt_strtoull || _map_libc || _std_strtol 522 #if _npt_strtoull && !_map_libc && !_std_strtol 523 printf("#ifndef _ISOC99_SOURCE\n"); 524 #endif 525 printf("extern unsigned _ast_intmax_t strtoull(const char*, char**, int);\n"); 526 #if _npt_strtoull && !_map_libc && !_std_strtoul 527 printf("#endif\n"); 528 #endif 529 #endif 530 printf("\n"); 531 printf("#undef extern\n"); 532 return 0; 533 } 534