Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Allow mktemp to be built as a host tool.



details:   https://anonhg.NetBSD.org/src/rev/4783aebb38ab
branches:  trunk
changeset: 536376:4783aebb38ab
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Sep 14 04:26:23 2002 +0000

description:
Allow mktemp to be built as a host tool.

diffstat:

 lib/libc/stdio/gettemp.c |  19 ++++++++++++++++---
 lib/libc/stdio/mkdtemp.c |  19 ++++++++++++++++---
 lib/libc/stdio/mkstemp.c |  19 ++++++++++++++++---
 usr.bin/mktemp/Makefile  |   5 +++--
 usr.bin/mktemp/mktemp.c  |  19 +++++++++----------
 5 files changed, 60 insertions(+), 21 deletions(-)

diffs (209 lines):

diff -r 9db214418fbb -r 4783aebb38ab lib/libc/stdio/gettemp.c
--- a/lib/libc/stdio/gettemp.c  Sat Sep 14 04:26:03 2002 +0000
+++ b/lib/libc/stdio/gettemp.c  Sat Sep 14 04:26:23 2002 +0000
@@ -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 @@
 #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 @@
        }
        /*NOTREACHED*/
 }
+
+#endif /* !HAVE_CONFIG_H || !HAVE_MKSTEMP || !HAVE_MKDTEMP */
diff -r 9db214418fbb -r 4783aebb38ab lib/libc/stdio/mkdtemp.c
--- a/lib/libc/stdio/mkdtemp.c  Sat Sep 14 04:26:03 2002 +0000
+++ b/lib/libc/stdio/mkdtemp.c  Sat Sep 14 04:26:23 2002 +0000
@@ -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 @@
 {
        _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 */
diff -r 9db214418fbb -r 4783aebb38ab lib/libc/stdio/mkstemp.c
--- a/lib/libc/stdio/mkstemp.c  Sat Sep 14 04:26:03 2002 +0000
+++ b/lib/libc/stdio/mkstemp.c  Sat Sep 14 04:26:23 2002 +0000
@@ -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 @@
 
        _DIAGASSERT(path != NULL);
 
-       return (__gettemp(path, &fd, 0) ? fd : -1);
+       return (GETTEMP(path, &fd, 0) ? fd : -1);
 }
+
+#endif /* !HAVE_CONFIG_H || !HAVE_MKSTEMP */
diff -r 9db214418fbb -r 4783aebb38ab usr.bin/mktemp/Makefile
--- a/usr.bin/mktemp/Makefile   Sat Sep 14 04:26:03 2002 +0000
+++ b/usr.bin/mktemp/Makefile   Sat Sep 14 04:26:23 2002 +0000
@@ -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
diff -r 9db214418fbb -r 4783aebb38ab usr.bin/mktemp/mktemp.c
--- a/usr.bin/mktemp/mktemp.c   Sat Sep 14 04:26:03 2002 +0000
+++ b/usr.bin/mktemp/mktemp.c   Sat Sep 14 04:26:23 2002 +0000
@@ -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@localhost>
@@ -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));
 



Home | Main Index | Thread Index | Old Index