From owner-svn-src-all@FreeBSD.ORG Tue Oct 2 00:30:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4616310657C6; Tue, 2 Oct 2012 00:30:26 +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 D7CA98FC0C; Tue, 2 Oct 2012 00:30:26 +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 q920UQ38038127; Tue, 2 Oct 2012 00:30:26 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q920UQQ0038124; Tue, 2 Oct 2012 00:30:26 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201210020030.q920UQQ0038124@svn.freebsd.org> From: Eitan Adler Date: Tue, 2 Oct 2012 00:30:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241118 - head/usr.bin/mktemp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 02 Oct 2012 00:30:29 -0000 Author: eadler Date: Tue Oct 2 00:30:26 2012 New Revision: 241118 URL: http://svn.freebsd.org/changeset/base/241118 Log: Implement the Sun/GNU extension of using a default prefix when no arguments are supplied. Reviewed by: jilles Approved by: cperciva MFC after: 1 week Modified: head/usr.bin/mktemp/mktemp.1 head/usr.bin/mktemp/mktemp.c Modified: head/usr.bin/mktemp/mktemp.1 ============================================================================== --- head/usr.bin/mktemp/mktemp.1 Tue Oct 2 00:30:20 2012 (r241117) +++ head/usr.bin/mktemp/mktemp.1 Tue Oct 2 00:30:26 2012 (r241118) @@ -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: head/usr.bin/mktemp/mktemp.c ============================================================================== --- head/usr.bin/mktemp/mktemp.c Tue Oct 2 00:30:20 2012 (r241117) +++ head/usr.bin/mktemp/mktemp.c Tue Oct 2 00:30:26 2012 (r241118) @@ -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 */