summaryrefslogtreecommitdiff
path: root/usr.bin/mktemp
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-02-07 01:38:12 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-02-07 01:38:12 +0000
commita8a59842ce70c012d2f07cf8a27eb5d37ac6cb3d (patch)
tree9f47b1c58cdb635392fcba7410b7c5d22dfc4ab1 /usr.bin/mktemp
parent083c5f7aa6318b1231fe301d971189ce12b47207 (diff)
My copyright, not Berkeley's and some minor working tweaks.
Diffstat (limited to 'usr.bin/mktemp')
-rw-r--r--usr.bin/mktemp/mktemp.157
1 files changed, 26 insertions, 31 deletions
diff --git a/usr.bin/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1
index eff6e92988d..7b452362828 100644
--- a/usr.bin/mktemp/mktemp.1
+++ b/usr.bin/mktemp/mktemp.1
@@ -1,7 +1,7 @@
-.\" $OpenBSD: mktemp.1,v 1.12 1999/08/05 09:19:35 millert Exp $
+.\" $OpenBSD: mktemp.1,v 1.13 2000/02/07 01:38:11 millert Exp $
.\"
-.\" Copyright (c) 1989, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
+.\" Copyright (c) 1996, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
+.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -11,25 +11,19 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 20, 1996
.Dt MKTEMP 1
@@ -47,8 +41,7 @@
The
.Nm mktemp
utility takes the given file name template and overwrites a
-portion of it to create a file name. This file name is unique
-and suitable for use by the application. The template may be
+portion of it to create a unique file name. The template may be
any file name with some number of
.Ql X Ns s
appended
@@ -56,26 +49,28 @@ to it, for example
.Pa /tmp/temp.XXXXXXXXXX .
The trailing
.Ql X Ns s
-are replaced with the current process number and/or a
-unique letter combination.
+are replaced with a combination of the the current process number and
+random letters. The name chosen depends both on the number of
+.Ql X Ns s
+in the template and the number of collisions with pre-existing files.
The number of unique file names
.Nm
can return depends on the number of
.Ql X Ns s
-provided; six
+provided; ten
.Ql X Ns s
will
result in
.Nm
-testing roughly 26 ** 6 combinations.
+testing roughly 26 ** 10 combinations.
.Pp
If
.Nm
-can successfully generate a unique file name, the file
-is created with mode 0600 (unless the
+can successfully generate a unique file name, the file (or directory)
+is created with file permissions such that it is only readable and writable
+by its owner (unless the
.Fl u
-flag is given) and the filename is printed
-to standard output.
+flag is given) and the filename is printed to standard output.
.Pp
.Nm mktemp
is provided to allow shell scripts to safely use temporary files.