Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Oct 2012 21:21:54 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r241424 - stable/9/usr.bin/mktemp
Message-ID:  <201210102121.q9ALLsTv004114@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Wed Oct 10 21:21:54 2012
New Revision: 241424
URL: http://svn.freebsd.org/changeset/base/241424

Log:
  MFC r241118:
  	Implement the Sun/GNU extension of using a default
  	prefix when no arguments are supplied.
  
  Approved by:	cperciva (implicit)

Modified:
  stable/9/usr.bin/mktemp/mktemp.1
  stable/9/usr.bin/mktemp/mktemp.c
Directory Properties:
  stable/9/usr.bin/mktemp/   (props changed)

Modified: stable/9/usr.bin/mktemp/mktemp.1
==============================================================================
--- stable/9/usr.bin/mktemp/mktemp.1	Wed Oct 10 21:21:54 2012	(r241423)
+++ stable/9/usr.bin/mktemp/mktemp.1	Wed Oct 10 21:21:54 2012	(r241424)
@@ -99,6 +99,14 @@ Care should
 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

Modified: stable/9/usr.bin/mktemp/mktemp.c
==============================================================================
--- stable/9/usr.bin/mktemp/mktemp.c	Wed Oct 10 21:21:54 2012	(r241423)
+++ stable/9/usr.bin/mktemp/mktemp.c	Wed Oct 10 21:21:54 2012	(r241424)
@@ -87,6 +87,11 @@ main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
+	if (!tflag && argc < 1) {
+		tflag = 1;
+		prefix = "tmp";
+	}
+
 	if (tflag) {
 		tmpdir = getenv("TMPDIR");
 		if (tmpdir == NULL)
@@ -100,8 +105,6 @@ main(int argc, char **argv)
 			else
 				errx(1, "cannot generate template");
 		}
-	} else if (argc < 1) {
-		usage();
 	}
 		
 	/* generate all requested files */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210102121.q9ALLsTv004114>