.\" SUCH DAMAGE.
.\"
.\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/mktemp.3,v 1.17 2001/10/01 16:08:59 ru Exp $
+.\" $FreeBSD: src/lib/libc/stdio/mktemp.3,v 1.20 2004/02/20 04:08:28 green Exp $
.\"
.Dd February 11, 1998
.Dt MKTEMP 3
.Os
.Sh NAME
-.Nm mktemp
+.Nm mkdtemp ,
+.Nm mkstemp ,
+.Nm mktemp ,
+.Nm mktemps
.Nd make temporary file name (unique)
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In unistd.h
.Ft char *
-.Fn mktemp "char *template"
+.Fo mkdtemp
+.Fa "char *template"
+.Fc
.Ft int
-.Fn mkstemp "char *template"
+.Fo mkstemps
+.Fa "char *template"
+.Fa "int suffixlen"
+.Fc
+.In stdlib.h
.Ft int
-.Fn mkstemps "char *template" "int suffixlen"
+.Fo mkstemp
+.Fa "char *template"
+.Fc
.Ft char *
-.Fn mkdtemp "char *template"
+.Fo mktemp
+.Fa "char *template"
+.Fc
.Sh DESCRIPTION
The
.Fn mktemp
except it permits a suffix to exist in the template.
The template should be of the form
.Pa /tmp/tmpXXXXXXsuffix .
+The
.Fn mkstemps
+function
is told the length of the suffix string.
.Pp
The
.Fn mkdtemp
function makes the same replacement to the template as in
-.Xr mktemp 3
+.Fn mktemp
and creates the template directory, mode 0700.
.Sh RETURN VALUES
The
.Pp
The
.Fn mkstemp ,
-.Fn mkstemps
+.Fn mkstemps ,
and
.Fn mkdtemp
functions
passes in a read-only string to
.Fn mktemp ,
.Fn mkstemp ,
-.Fn mkstemps
+.Fn mkstemps ,
or
.Fn mkdtemp .
This is common with programs that were developed before
This will ensure that the program does not continue blindly
in the event that an attacker has already created the file
with the intention of manipulating or reading its contents.
+.Sh LEGACY SYNOPSIS
+.Fd #include <unistd.h>
+.Pp
+The include file
+.In unistd.h
+is necessary and sufficient for all functions.
.Sh SEE ALSO
.Xr chmod 2 ,
.Xr getpid 2 ,
.Xr mkdir 2 ,
.Xr open 2 ,
-.Xr stat 2
+.Xr stat 2 ,
+.Xr compat 5
.Sh HISTORY
A
.Fn mktemp