From owner-svn-src-all@FreeBSD.ORG Wed Oct 10 21:21:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 764F2324; Wed, 10 Oct 2012 21:21:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F70F8FC08; Wed, 10 Oct 2012 21:21:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9ALLsBF004086; Wed, 10 Oct 2012 21:21:54 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9ALLsmv004083; Wed, 10 Oct 2012 21:21:54 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201210102121.q9ALLsmv004083@svn.freebsd.org> From: Eitan Adler Date: Wed, 10 Oct 2012 21:21:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r241422 - stable/8/usr.bin/mktemp X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 21:21:54 -0000 Author: eadler Date: Wed Oct 10 21:21:53 2012 New Revision: 241422 URL: http://svn.freebsd.org/changeset/base/241422 Log: MFC r241118: Implement the Sun/GNU extension of using a default prefix when no arguments are supplied. Approved by: cperciva (implicit) Modified: stable/8/usr.bin/mktemp/mktemp.1 stable/8/usr.bin/mktemp/mktemp.c Directory Properties: stable/8/usr.bin/mktemp/ (props changed) Modified: stable/8/usr.bin/mktemp/mktemp.1 ============================================================================== --- stable/8/usr.bin/mktemp/mktemp.1 Wed Oct 10 21:20:34 2012 (r241421) +++ stable/8/usr.bin/mktemp/mktemp.1 Wed Oct 10 21:21:53 2012 (r241422) @@ -103,6 +103,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/8/usr.bin/mktemp/mktemp.c ============================================================================== --- stable/8/usr.bin/mktemp/mktemp.c Wed Oct 10 21:20:34 2012 (r241421) +++ stable/8/usr.bin/mktemp/mktemp.c Wed Oct 10 21:21:53 2012 (r241422) @@ -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 */