aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/mktemp
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
commit23090366f729c56cab62de74c7a51792357e98a9 (patch)
treec511c885796e28ec571b5267e8f11f3b103d35e9 /usr.bin/mktemp
parent7750ad47a9a7dbc83f87158464170c8640723293 (diff)
parent22ff74b2f44234d31540b1f7fd6c91489c37cad3 (diff)
downloadsrc-23090366f729c56cab62de74c7a51792357e98a9.tar.gz
src-23090366f729c56cab62de74c7a51792357e98a9.zip
Sync from head
Notes
Notes: svn path=/projects/bmake/; revision=242545
Diffstat (limited to 'usr.bin/mktemp')
-rw-r--r--usr.bin/mktemp/mktemp.18
-rw-r--r--usr.bin/mktemp/mktemp.c7
2 files changed, 13 insertions, 2 deletions
diff --git a/usr.bin/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1
index 6d6830c5bf9d..3ec7585bfdc3 100644
--- a/usr.bin/mktemp/mktemp.1
+++ b/usr.bin/mktemp/mktemp.1
@@ -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
diff --git a/usr.bin/mktemp/mktemp.c b/usr.bin/mktemp/mktemp.c
index 72b89d607889..277104f480e7 100644
--- a/usr.bin/mktemp/mktemp.c
+++ b/usr.bin/mktemp/mktemp.c
@@ -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 */