From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 10 21:21:55 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 051B4326; Wed, 10 Oct 2012 21:21:55 +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 E1FAF8FC0C; 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 q9ALLsVY004119; 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 q9ALLsTv004114; Wed, 10 Oct 2012 21:21:54 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201210102121.q9ALLsTv004114@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-9@freebsd.org Subject: svn commit: r241424 - stable/9/usr.bin/mktemp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 21:21:55 -0000 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 */