|
Packit Service |
51e54d |
/* Create a temporary file or directory.
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
This program is free software: you can redistribute it and/or modify
|
|
Packit Service |
51e54d |
it under the terms of the GNU General Public License as published by
|
|
Packit Service |
51e54d |
the Free Software Foundation; either version 3 of the License, or
|
|
Packit Service |
51e54d |
(at your option) any later version.
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
This program is distributed in the hope that it will be useful,
|
|
Packit Service |
51e54d |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
51e54d |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
51e54d |
GNU General Public License for more details.
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
You should have received a copy of the GNU General Public License
|
|
Packit Service |
51e54d |
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
/* header written by Eric Blake */
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
#ifndef GL_TEMPNAME_H
|
|
Packit Service |
51e54d |
# define GL_TEMPNAME_H
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
# include <stdio.h>
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
# ifdef __GT_FILE
|
|
Packit Service |
51e54d |
# define GT_FILE __GT_FILE
|
|
Packit Service |
51e54d |
# define GT_DIR __GT_DIR
|
|
Packit Service |
51e54d |
# define GT_NOCREATE __GT_NOCREATE
|
|
Packit Service |
51e54d |
# else
|
|
Packit Service |
51e54d |
# define GT_FILE 0
|
|
Packit Service |
51e54d |
# define GT_DIR 1
|
|
Packit Service |
51e54d |
# define GT_NOCREATE 2
|
|
Packit Service |
51e54d |
# endif
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
/* Generate a temporary file name based on TMPL. TMPL must match the
|
|
Packit Service |
51e54d |
rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
|
|
Packit Service |
51e54d |
The name constructed does not exist at the time of the call to
|
|
Packit Service |
51e54d |
gen_tempname. TMPL is overwritten with the result.
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
KIND may be one of:
|
|
Packit Service |
51e54d |
GT_NOCREATE: simply verify that the name does not exist
|
|
Packit Service |
51e54d |
at the time of the call.
|
|
Packit Service |
51e54d |
GT_FILE: create a large file using open(O_CREAT|O_EXCL)
|
|
Packit Service |
51e54d |
and return a read-write fd. The file is mode 0600.
|
|
Packit Service |
51e54d |
GT_DIR: create a directory, which will be mode 0700.
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
We use a clever algorithm to get hard-to-predict names. */
|
|
Packit Service |
51e54d |
extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
|
|
Packit Service |
51e54d |
|
|
Packit Service |
51e54d |
#endif /* GL_TEMPNAME_H */
|