Module Name:    src
Committed By:   christos
Date:           Sat Nov  3 13:34:08 UTC 2012

Modified Files:
        src/usr.bin/mktemp: mktemp.1 mktemp.c

Log Message:
PR/47155: Eitan Adler: add mktemp zero arguments extension


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/mktemp/mktemp.1
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mktemp/mktemp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mktemp/mktemp.1
diff -u src/usr.bin/mktemp/mktemp.1:1.19 src/usr.bin/mktemp/mktemp.1:1.20
--- src/usr.bin/mktemp/mktemp.1:1.19	Sat Aug 15 16:44:56 2009
+++ src/usr.bin/mktemp/mktemp.1	Sat Nov  3 09:34:08 2012
@@ -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 @@ arguments, also a single one based on th
 .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.

Index: src/usr.bin/mktemp/mktemp.c
diff -u src/usr.bin/mktemp/mktemp.c:1.11 src/usr.bin/mktemp/mktemp.c:1.12
--- src/usr.bin/mktemp/mktemp.c:1.11	Sat Aug 15 16:02:28 2009
+++ src/usr.bin/mktemp/mktemp.c	Sat Nov  3 09:34:08 2012
@@ -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 <pe...@netplex.com.au>
@@ -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 @@ main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
+	if (tflag == 0 && argc < 1)
+		tflag = 1;
+
 	if (tflag) {
 		if (tmpdir == NULL)
 			tmpdir = getenv("TMPDIR");

Reply via email to