xref: /illumos-gate/usr/src/contrib/ast/src/lib/libast/comp/tempnam.c (revision b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f)
1*b30d1939SAndy Fiddaman /***********************************************************************
2*b30d1939SAndy Fiddaman *                                                                      *
3*b30d1939SAndy Fiddaman *               This software is part of the ast package               *
4*b30d1939SAndy Fiddaman *          Copyright (c) 1985-2011 AT&T Intellectual Property          *
5*b30d1939SAndy Fiddaman *                      and is licensed under the                       *
6*b30d1939SAndy Fiddaman *                 Eclipse Public License, Version 1.0                  *
7*b30d1939SAndy Fiddaman *                    by AT&T Intellectual Property                     *
8*b30d1939SAndy Fiddaman *                                                                      *
9*b30d1939SAndy Fiddaman *                A copy of the License is available at                 *
10*b30d1939SAndy Fiddaman *          http://www.eclipse.org/org/documents/epl-v10.html           *
11*b30d1939SAndy Fiddaman *         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
12*b30d1939SAndy Fiddaman *                                                                      *
13*b30d1939SAndy Fiddaman *              Information and Software Systems Research               *
14*b30d1939SAndy Fiddaman *                            AT&T Research                             *
15*b30d1939SAndy Fiddaman *                           Florham Park NJ                            *
16*b30d1939SAndy Fiddaman *                                                                      *
17*b30d1939SAndy Fiddaman *                 Glenn Fowler <gsf@research.att.com>                  *
18*b30d1939SAndy Fiddaman *                  David Korn <dgk@research.att.com>                   *
19*b30d1939SAndy Fiddaman *                   Phong Vo <kpv@research.att.com>                    *
20*b30d1939SAndy Fiddaman *                                                                      *
21*b30d1939SAndy Fiddaman ***********************************************************************/
22*b30d1939SAndy Fiddaman #pragma prototyped
23*b30d1939SAndy Fiddaman /*
24*b30d1939SAndy Fiddaman  * tempnam implementation
25*b30d1939SAndy Fiddaman  */
26*b30d1939SAndy Fiddaman 
27*b30d1939SAndy Fiddaman #include <ast_std.h>
28*b30d1939SAndy Fiddaman 
29*b30d1939SAndy Fiddaman #ifdef tempnam
30*b30d1939SAndy Fiddaman #define _def_tempnam	1
31*b30d1939SAndy Fiddaman #else
32*b30d1939SAndy Fiddaman #if defined(__STDPP__directive) && defined(__STDPP__hide)
33*b30d1939SAndy Fiddaman __STDPP__directive pragma pp:hide tempnam
34*b30d1939SAndy Fiddaman #else
35*b30d1939SAndy Fiddaman #define tempnam		______tempnam
36*b30d1939SAndy Fiddaman #endif
37*b30d1939SAndy Fiddaman #endif
38*b30d1939SAndy Fiddaman 
39*b30d1939SAndy Fiddaman #include <ast.h>
40*b30d1939SAndy Fiddaman #include <stdio.h>
41*b30d1939SAndy Fiddaman 
42*b30d1939SAndy Fiddaman #if !_def_tempnam
43*b30d1939SAndy Fiddaman #if defined(__STDPP__directive) && defined(__STDPP__hide)
44*b30d1939SAndy Fiddaman __STDPP__directive pragma pp:nohide tempnam
45*b30d1939SAndy Fiddaman #else
46*b30d1939SAndy Fiddaman #undef	tempnam
47*b30d1939SAndy Fiddaman #endif
48*b30d1939SAndy Fiddaman #endif
49*b30d1939SAndy Fiddaman 
50*b30d1939SAndy Fiddaman #if defined(__EXPORT__)
51*b30d1939SAndy Fiddaman #define extern	__EXPORT__
52*b30d1939SAndy Fiddaman #endif
53*b30d1939SAndy Fiddaman 
54*b30d1939SAndy Fiddaman extern char*
tempnam(const char * dir,const char * pfx)55*b30d1939SAndy Fiddaman tempnam(const char* dir, const char* pfx)
56*b30d1939SAndy Fiddaman {
57*b30d1939SAndy Fiddaman 	return pathtmp(NiL, dir, pfx, NiL);
58*b30d1939SAndy Fiddaman }
59