summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-11-04 11:13:39 -0700
committerEric Blake <ebb9@byu.net>2009-11-05 07:10:40 -0700
commit31a9937081dc41a5f8d28d71709204e413e09972 (patch)
treec8d994de7a8a903ec10a0b427059e6c4acebe615 /doc
parentd431c61873753673ad9fcbac90db6db04185e307 (diff)
downloadcoreutils-31a9937081dc41a5f8d28d71709204e413e09972.tar.xz
mktemp: add suffix handling
Now that mkstemps is supported, we might as well use it. * src/mktemp.c (TMPDIR_OPTION): New enum value. (longopts): Add new option. (usage): Document it. (count_trailing_X_s): Rename... (count_consecutive_X_s): ...to this, and add parameter. (mkstemp_len, mkdtemp_len): Add parameter. (main): Implement new option. (AUTHORS): Add myself. * AUTHORS (mktemp): Likewise. * tests/misc/mktemp: Test new option. * doc/coreutils.texi (mktemp invocation): Document it. * NEWS: Likewise. Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548316.
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi27
1 files changed, 23 insertions, 4 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 6126cf8cd..227014cd4 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -12068,12 +12068,12 @@ mktemp [@var{option}]@dots{} [@var{template}]
@end example
Safely create a temporary file or directory based on @var{template},
-and print its name. If given, @var{template} must end in at least
-three consecutive @samp{X}s. If omitted, the template
+and print its name. If given, @var{template} must include at least
+three consecutive @samp{X}s in the last component. If omitted, the template
@samp{tmp.XXXXXXXXXX} is used, and option @option{--tmpdir} is
-implied. The trailing @samp{X}s in the @var{template} will be replaced
+implied. The final run of @samp{X}s in the @var{template} will be replaced
by alpha-numeric characters; thus, on a case-sensitive file system,
-and with a @var{template} ending in @var{n} instances of @samp{X},
+and with a @var{template} including a run of @var{n} instances of @samp{X},
there are @samp{62**@var{n}} potential file names.
Older scripts used to create temporary files by simply joining the
@@ -12108,6 +12108,15 @@ file.H47c
@end example
@item
+Create a temporary file with a known suffix.
+@example
+$ mktemp --suffix=.txt file-XXXX
+file-H08W.txt
+$ mktemp file-XXXX-XXXX.txt
+file-XXXX-eI9L.txt
+@end example
+
+@item
Create a secure fifo relative to the user's choice of @env{TMPDIR},
but falling back to the current directory rather than @file{/tmp}.
Note that @command{mktemp} does not create fifos, but can create a
@@ -12186,6 +12195,16 @@ specified, @var{template} must not be absolute. However,
@var{template} can still contain slashes, although intermediate
directories must already exist.
+@item --suffix=@var{suffix}
+@opindex --suffix
+Append @var{suffix} to the @var{template}. @var{suffix} must not
+contain slash. If @option{--suffix} is specified, @var{template} must
+end in @samp{X}; if it is not specified, then an appropriate
+@option{--suffix} is inferred by finding the last @samp{X} in
+@var{template}. This option exists for use with the default
+@var{template} and for the creation of a @var{suffix} that starts with
+@samp{X}.
+
@item -t
@opindex -t
Treat @var{template} as a single file relative to the value of