[Midnightbsd-cvs] src [7054] trunk/usr.bin/mktemp/mktemp.c: allow the -d option to work without additional arguments for OpenBSD/ FreeBSD compatibility with mktemp

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 20 15:15:34 EDT 2015


Revision: 7054
          http://svnweb.midnightbsd.org/src/?rev=7054
Author:   laffer1
Date:     2015-06-20 15:15:33 -0400 (Sat, 20 Jun 2015)
Log Message:
-----------
allow the -d option to work without additional arguments for OpenBSD/FreeBSD compatibility with mktemp

Modified Paths:
--------------
    trunk/usr.bin/mktemp/Makefile
    trunk/usr.bin/mktemp/mktemp.1
    trunk/usr.bin/mktemp/mktemp.c

Property Changed:
----------------
    trunk/usr.bin/mktemp/mktemp.1

Modified: trunk/usr.bin/mktemp/Makefile
===================================================================
--- trunk/usr.bin/mktemp/Makefile	2015-06-20 00:08:35 UTC (rev 7053)
+++ trunk/usr.bin/mktemp/Makefile	2015-06-20 19:15:33 UTC (rev 7054)
@@ -1,4 +1,5 @@
-# $FreeBSD: src/usr.bin/mktemp/Makefile,v 1.3 2002/02/08 22:31:42 markm Exp $
+# $MidnightBSD$
+# $FreeBSD: release/9.2.0/usr.bin/mktemp/Makefile 90415 2002-02-08 22:31:43Z markm $
 
 PROG=	mktemp
 

Modified: trunk/usr.bin/mktemp/mktemp.1
===================================================================
--- trunk/usr.bin/mktemp/mktemp.1	2015-06-20 00:08:35 UTC (rev 7053)
+++ trunk/usr.bin/mktemp/mktemp.1	2015-06-20 19:15:33 UTC (rev 7054)
@@ -26,7 +26,8 @@
 .\" SUCH DAMAGE.
 .\"
 .\" From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $
-.\" $FreeBSD: src/usr.bin/mktemp/mktemp.1,v 1.21 2006/09/29 15:20:46 ru Exp $
+.\" $FreeBSD: release/9.2.0/usr.bin/mktemp/mktemp.1 243350 2012-11-21 00:31:56Z eadler $
+.\" $MidnightBSD$
 .\"
 .Dd December 30, 2005
 .Dt MKTEMP 1
@@ -99,6 +100,14 @@
 be taken to ensure that it is appropriate to use an environment variable
 potentially supplied by the user.
 .Pp
+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
 Any number of temporary files may be created in a single invocation,
 including one based on the internal template resulting from the
 .Fl t
@@ -150,10 +159,7 @@
 option is not encouraged.
 .El
 .Sh EXIT STATUS
-The
-.Nm
-utility
-exits 0 on success, and 1 if an error occurs.
+.Ex -std
 .Sh EXAMPLES
 The following
 .Xr sh 1


Property changes on: trunk/usr.bin/mktemp/mktemp.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/mktemp/mktemp.c
===================================================================
--- trunk/usr.bin/mktemp/mktemp.c	2015-06-20 00:08:35 UTC (rev 7053)
+++ trunk/usr.bin/mktemp/mktemp.c	2015-06-20 19:15:33 UTC (rev 7054)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-	"$FreeBSD: src/usr.bin/mktemp/mktemp.c,v 1.5 2002/03/22 01:33:17 imp Exp $";
+	"$MidnightBSD$";
 #endif /* not lint */
 
 static void usage(void);
@@ -87,6 +87,11 @@
 	argc -= optind;
 	argv += optind;
 
+	if (!tflag && argc < 1) {
+		tflag = 1;
+		prefix = "tmp";
+	}
+
 	if (tflag) {
 		tmpdir = getenv("TMPDIR");
 		if (tmpdir == NULL)
@@ -100,8 +105,6 @@
 			else
 				errx(1, "cannot generate template");
 		}
-	} else if (argc < 1) {
-		usage();
 	}
 		
 	/* generate all requested files */



More information about the Midnightbsd-cvs mailing list