aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb
diff options
context:
space:
mode:
Diffstat (limited to 'toys/lsb')
-rw-r--r--toys/lsb/mktemp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/toys/lsb/mktemp.c b/toys/lsb/mktemp.c
index cee62c1d..f1f9d885 100644
--- a/toys/lsb/mktemp.c
+++ b/toys/lsb/mktemp.c
@@ -4,19 +4,20 @@
*
* http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/mktemp.html
-USE_MKTEMP(NEWTOY(mktemp, ">1qd(directory)p(tmpdir):", TOYFLAG_BIN))
+USE_MKTEMP(NEWTOY(mktemp, ">1uqd(directory)p(tmpdir):", TOYFLAG_BIN))
config MKTEMP
bool "mktemp"
default y
help
- usage: mktemp [-dq] [-p DIR] [TEMPLATE]
+ usage: mktemp [-dqu] [-p DIR] [TEMPLATE]
Safely create a new file "DIR/TEMPLATE" and print its name.
-d Create directory instead of file (--directory)
-p Put new file in DIR (--tmpdir)
-q Quiet, no error messages
+ -u Don't create anything, just print what would be created
Each X in TEMPLATE is replaced with a random printable character. The
default TEMPLATE is tmp.XXXXXX, and the default DIR is $TMPDIR if set,
@@ -48,6 +49,7 @@ void mktemp_main(void)
else perror_exit("Failed to create %s %s/%s",
d_flag ? "directory" : "file", TT.tmpdir, template);
} else xputs(template);
+ if (toys.optflags & FLAG_u) unlink(template);
if (CFG_TOYBOX_FREE) free(template);
}