NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/47155: add mktemp zero arguments extension
>Number: 47155
>Category: bin
>Synopsis: add mktemp zero arguments extension
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Nov 03 04:45:00 +0000 2012
>Originator: Eitan Adler
>Release: trunk
>Organization:
FreeBSD
>Environment:
N/A
>Description:
FreeBSD and OpenBSD have already implemented the Sun/GNU extension of mktemp
returning a path to a file in /tmp if mktemp is called without arguments.
>How-To-Repeat:
>Fix:
! Bring in a GNU/Sun/FreeBSD extension:
! If mktemp is called without an argument
! Return with a file in TMPDIR.
!
! Submitted by: Eitan Adler
!
Index: mktemp.1
===================================================================
RCS file: /cvsroot/src/usr.bin/mktemp/mktemp.1,v
retrieving revision 1.19
diff -u -r1.19 mktemp.1
--- mktemp.1 15 Aug 2009 20:44:56 -0000 1.19
+++ mktemp.1 3 Nov 2012 04:41:57 -0000
@@ -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.
Index: mktemp.c
===================================================================
RCS file: /cvsroot/src/usr.bin/mktemp/mktemp.c,v
retrieving revision 1.11
diff -u -r1.11 mktemp.c
--- mktemp.c 15 Aug 2009 20:02:28 -0000 1.11
+++ mktemp.c 3 Nov 2012 04:41:57 -0000
@@ -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