Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/man Try $TMPDIR first, then fall back to _PATH_TMP.
details: https://anonhg.NetBSD.org/src/rev/61d3958a6c54
branches: trunk
changeset: 474836:61d3958a6c54
user: kleink <kleink%NetBSD.org@localhost>
date: Thu Jul 22 15:09:45 1999 +0000
description:
Try $TMPDIR first, then fall back to _PATH_TMP.
diffstat:
usr.bin/man/man.c | 11 +++++++----
usr.bin/man/pathnames.h | 6 ++++--
2 files changed, 11 insertions(+), 6 deletions(-)
diffs (59 lines):
diff -r d876aee0a0bb -r 61d3958a6c54 usr.bin/man/man.c
--- a/usr.bin/man/man.c Thu Jul 22 12:56:56 1999 +0000
+++ b/usr.bin/man/man.c Thu Jul 22 15:09:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: man.c,v 1.18 1999/07/22 03:02:36 itohy Exp $ */
+/* $NetBSD: man.c,v 1.19 1999/07/22 15:09:45 kleink Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-__RCSID("$NetBSD: man.c,v 1.18 1999/07/22 03:02:36 itohy Exp $");
+__RCSID("$NetBSD: man.c,v 1.19 1999/07/22 15:09:45 kleink Exp $");
#endif
#endif /* not lint */
@@ -505,7 +505,8 @@
TAG *intmpp;
int fd, n;
char *p, *b;
- char buf[MAXPATHLEN], cmd[MAXPATHLEN], tpath[sizeof(_PATH_TMP)];
+ char buf[MAXPATHLEN], cmd[MAXPATHLEN], tpath[MAXPATHLEN];
+ const char *tmpdir;
/* Let the user know this may take awhile. */
if (!warned) {
@@ -550,7 +551,9 @@
* Get a temporary file and build a version of the file
* to display. Replace the old file name with the new one.
*/
- (void)strcpy(tpath, _PATH_TMP);
+ if ((tmpdir = getenv("TMPDIR")) == NULL)
+ tmpdir = _PATH_TMP;
+ (void)snprintf(tpath, sizeof (tpath), "%s/%s", tmpdir, TMPFILE);
if ((fd = mkstemp(tpath)) == -1) {
warn("%s", tpath);
(void)cleanup();
diff -r d876aee0a0bb -r 61d3958a6c54 usr.bin/man/pathnames.h
--- a/usr.bin/man/pathnames.h Thu Jul 22 12:56:56 1999 +0000
+++ b/usr.bin/man/pathnames.h Thu Jul 22 15:09:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pathnames.h,v 1.3 1995/09/28 06:05:40 tls Exp $ */
+/* $NetBSD: pathnames.h,v 1.4 1999/07/22 15:09:45 kleink Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -35,7 +35,9 @@
* @(#)pathnames.h 8.3 (Berkeley) 1/2/94
*/
+#include <paths.h>
+
#define _PATH_MANCONF "/etc/man.conf"
#define _PATH_PAGER "/usr/bin/more -s"
-#define _PATH_TMP "/tmp/man.XXXXXX"
#define _PATH_WHATIS "whatis.db"
+#define TMPFILE "man.XXXXXX"
Home |
Main Index |
Thread Index |
Old Index