Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/mktemp PR/47155: Eitan Adler: add mktemp zero argume...



details:   https://anonhg.NetBSD.org/src/rev/1850eebebe62
branches:  trunk
changeset: 782454:1850eebebe62
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Nov 03 13:34:08 2012 +0000

description:
PR/47155: Eitan Adler: add mktemp zero arguments extension

diffstat:

 usr.bin/mktemp/mktemp.1 |  13 +++++++------
 usr.bin/mktemp/mktemp.c |   7 +++++--
 2 files changed, 12 insertions(+), 8 deletions(-)

diffs (55 lines):

diff -r 86d736190543 -r 1850eebebe62 usr.bin/mktemp/mktemp.1
--- a/usr.bin/mktemp/mktemp.1   Sat Nov 03 12:45:28 2012 +0000
+++ b/usr.bin/mktemp/mktemp.1   Sat Nov 03 13:34:08 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mktemp.1,v 1.19 2009/08/15 20:44:56 wiz Exp $
+.\" $NetBSD: mktemp.1,v 1.20 2012/11/03 13:34:08 christos Exp $
 .\" From: $FreeBSD: src/usr.bin/mktemp/mktemp.1,v 1.5 1999/08/28 01:04:13 peter Exp $
 .\" From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $
 .\"
@@ -115,11 +115,12 @@
 .Fl t
 option value as filename prefix.
 .Pp
-At least one
-.Ar template
-argument or the
-.Fl t
-option must be present.
+If no arguments are passed or if only the
+.Fl d
+flag is passed
+.Nm behaves as if
+.Fl t Li tmp
+was supplied.
 .Pp
 .Nm
 is provided to allow shell scripts to safely use temporary files.
diff -r 86d736190543 -r 1850eebebe62 usr.bin/mktemp/mktemp.c
--- a/usr.bin/mktemp/mktemp.c   Sat Nov 03 12:45:28 2012 +0000
+++ b/usr.bin/mktemp/mktemp.c   Sat Nov 03 13:34:08 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mktemp.c,v 1.11 2009/08/15 20:02:28 christos Exp $ */
+/* $NetBSD: mktemp.c,v 1.12 2012/11/03 13:34:08 christos Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1996, 1998 Peter Wemm <peter%netplex.com.au@localhost>
@@ -50,7 +50,7 @@
 #include <unistd.h>
 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: mktemp.c,v 1.11 2009/08/15 20:02:28 christos Exp $");
+__RCSID("$NetBSD: mktemp.c,v 1.12 2012/11/03 13:34:08 christos Exp $");
 #endif /* !__lint */
 
 static void usage(void) __dead;
@@ -100,6 +100,9 @@
        argc -= optind;
        argv += optind;
 
+       if (tflag == 0 && argc < 1)
+               tflag = 1;
+
        if (tflag) {
                if (tmpdir == NULL)
                        tmpdir = getenv("TMPDIR");



Home | Main Index | Thread Index | Old Index