1*017500beSchristos /* $NetBSD: mkdtemp.c,v 1.12 2014/06/18 17:47:58 christos Exp $ */
2cbb3325eSmycroft
3cbb3325eSmycroft /*
4cbb3325eSmycroft * Copyright (c) 1987, 1993
5cbb3325eSmycroft * The Regents of the University of California. All rights reserved.
6cbb3325eSmycroft *
7cbb3325eSmycroft * Redistribution and use in source and binary forms, with or without
8cbb3325eSmycroft * modification, are permitted provided that the following conditions
9cbb3325eSmycroft * are met:
10cbb3325eSmycroft * 1. Redistributions of source code must retain the above copyright
11cbb3325eSmycroft * notice, this list of conditions and the following disclaimer.
12cbb3325eSmycroft * 2. Redistributions in binary form must reproduce the above copyright
13cbb3325eSmycroft * notice, this list of conditions and the following disclaimer in the
14cbb3325eSmycroft * documentation and/or other materials provided with the distribution.
15eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
16cbb3325eSmycroft * may be used to endorse or promote products derived from this software
17cbb3325eSmycroft * without specific prior written permission.
18cbb3325eSmycroft *
19cbb3325eSmycroft * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20cbb3325eSmycroft * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21cbb3325eSmycroft * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22cbb3325eSmycroft * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23cbb3325eSmycroft * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24cbb3325eSmycroft * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25cbb3325eSmycroft * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26cbb3325eSmycroft * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27cbb3325eSmycroft * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28cbb3325eSmycroft * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29cbb3325eSmycroft * SUCH DAMAGE.
30cbb3325eSmycroft */
31cbb3325eSmycroft
32*017500beSchristos #include "gettemp.h"
3392252507Sthorpej
34171d6532Slukem #if !HAVE_NBTOOL_CONFIG_H || !HAVE_MKDTEMP
3592252507Sthorpej
36cbb3325eSmycroft #include <sys/cdefs.h>
37cbb3325eSmycroft #if defined(LIBC_SCCS) && !defined(lint)
38cbb3325eSmycroft #if 0
39cbb3325eSmycroft static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
40cbb3325eSmycroft #else
41*017500beSchristos __RCSID("$NetBSD: mkdtemp.c,v 1.12 2014/06/18 17:47:58 christos Exp $");
42cbb3325eSmycroft #endif
43cbb3325eSmycroft #endif /* LIBC_SCCS and not lint */
44cbb3325eSmycroft
45cbb3325eSmycroft char *
mkdtemp(char * path)46526d9427Schristos mkdtemp(char *path)
47cbb3325eSmycroft {
48b48252f3Slukem _DIAGASSERT(path != NULL);
49b48252f3Slukem
50*017500beSchristos return GETTEMP(path, NULL, 1, 0, 0) ? path : NULL;
51cbb3325eSmycroft }
5292252507Sthorpej
53171d6532Slukem #endif /* !HAVE_NBTOOL_CONFIG_H || !HAVE_MKDTEMP */
54