Allow mktemp to be built as a host tool.

This commit is contained in:
thorpej 2002-09-14 04:26:23 +00:00
parent 076280c9ac
commit 922525072e
5 changed files with 60 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: gettemp.c,v 1.7 2002/04/01 13:59:34 bjh21 Exp $ */
/* $NetBSD: gettemp.c,v 1.8 2002/09/14 04:27:21 thorpej Exp $ */
/*
* Copyright (c) 1987, 1993
@ -33,12 +33,18 @@
* SUCH DAMAGE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#if !HAVE_CONFIG_H || !HAVE_MKSTEMP || !HAVE_MKDTEMP
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: gettemp.c,v 1.7 2002/04/01 13:59:34 bjh21 Exp $");
__RCSID("$NetBSD: gettemp.c,v 1.8 2002/09/14 04:27:21 thorpej Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -53,10 +59,15 @@ __RCSID("$NetBSD: gettemp.c,v 1.7 2002/04/01 13:59:34 bjh21 Exp $");
#include <stdlib.h>
#include <unistd.h>
#if HAVE_CONFIG_H
#define GETTEMP gettemp
#else
#include "local.h"
#define GETTEMP __gettemp
#endif
int
__gettemp(path, doopen, domkdir)
GETTEMP(path, doopen, domkdir)
char *path;
int *doopen;
int domkdir;
@ -158,3 +169,5 @@ __gettemp(path, doopen, domkdir)
}
/*NOTREACHED*/
}
#endif /* !HAVE_CONFIG_H || !HAVE_MKSTEMP || !HAVE_MKDTEMP */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkdtemp.c,v 1.5 2002/04/01 13:59:34 bjh21 Exp $ */
/* $NetBSD: mkdtemp.c,v 1.6 2002/09/14 04:27:21 thorpej Exp $ */
/*
* Copyright (c) 1987, 1993
@ -33,21 +33,32 @@
* SUCH DAMAGE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#if !HAVE_CONFIG_H || !HAVE_MKDTEMP
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: mkdtemp.c,v 1.5 2002/04/01 13:59:34 bjh21 Exp $");
__RCSID("$NetBSD: mkdtemp.c,v 1.6 2002/09/14 04:27:21 thorpej Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#if HAVE_CONFIG_H
#define GETTEMP gettemp
#else
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "local.h"
#define GETTEMP __gettemp
#endif
char *
mkdtemp(path)
@ -55,5 +66,7 @@ mkdtemp(path)
{
_DIAGASSERT(path != NULL);
return (__gettemp(path, (int *)NULL, 1) ? path : (char *)NULL);
return (GETTEMP(path, (int *)NULL, 1) ? path : (char *)NULL);
}
#endif /* !HAVE_CONFIG_H || !HAVE_MKDTEMP */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkstemp.c,v 1.4 1999/09/20 04:39:31 lukem Exp $ */
/* $NetBSD: mkstemp.c,v 1.5 2002/09/14 04:27:21 thorpej Exp $ */
/*
* Copyright (c) 1987, 1993
@ -33,21 +33,32 @@
* SUCH DAMAGE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#if !HAVE_CONFIG_H || !HAVE_MKSTEMP
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: mkstemp.c,v 1.4 1999/09/20 04:39:31 lukem Exp $");
__RCSID("$NetBSD: mkstemp.c,v 1.5 2002/09/14 04:27:21 thorpej Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#if HAVE_CONFIG_H
#define GETTEMP gettemp
#else
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "local.h"
#define GETTEMP __gettemp
#endif
int
mkstemp(path)
@ -57,5 +68,7 @@ mkstemp(path)
_DIAGASSERT(path != NULL);
return (__gettemp(path, &fd, 0) ? fd : -1);
return (GETTEMP(path, &fd, 0) ? fd : -1);
}
#endif /* !HAVE_CONFIG_H || !HAVE_MKSTEMP */

View File

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.4 2002/04/01 13:54:01 bjh21 Exp $
# From: $FreeBSD: src/usr.bin/mktemp/Makefile,v 1.1 1998/04/14 07:39:56 peter Exp $
# $NetBSD: Makefile,v 1.5 2002/09/14 04:26:23 thorpej Exp $
PROG= mktemp
.ifndef HOSTPROG
.include <bsd.prog.mk>
.endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: mktemp.c,v 1.4 2002/04/01 13:54:01 bjh21 Exp $ */
/* $NetBSD: mktemp.c,v 1.5 2002/09/14 04:26:23 thorpej Exp $ */
/*-
* Copyright (c) 1994, 1995, 1996, 1998 Peter Wemm <peter@netplex.com.au>
@ -36,7 +36,11 @@
* more like the OpenBSD version - which was first to publish the interface.
*/
#include <sys/cdefs.h>
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#include <err.h>
#include <paths.h>
#include <stdio.h>
@ -44,14 +48,9 @@
#include <string.h>
#include <unistd.h>
#ifndef lint
#if 0
static const char rcsid[] =
"$FreeBSD: src/usr.bin/mktemp/mktemp.c,v 1.2 1998/05/05 06:13:47 charnier Exp $";
#else
__RCSID("$NetBSD: mktemp.c,v 1.4 2002/04/01 13:54:01 bjh21 Exp $");
#endif
#endif /* not lint */
#if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: mktemp.c,v 1.5 2002/09/14 04:26:23 thorpej Exp $");
#endif /* !__lint */
static void usage __P((void));