Back to index

tetex-bin  3.0
mkstemp.c
Go to the documentation of this file.
00001 /* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
00002    This file is derived from the one in the GNU C Library.
00003 
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License along
00015    with this program; if not, write to the Free Software Foundation,
00016    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00017 
00018 #include <config.h>
00019 
00020 /* Disable the definition of mkstemp to rpl_mkstemp (from config.h) in this
00021    file.  Otherwise, we'd get conflicting prototypes for rpl_mkstemp on
00022    most systems.  */
00023 #undef mkstemp
00024 
00025 #include <stdio.h>
00026 #include <stdlib.h>
00027 
00028 #ifndef __GT_FILE
00029 # define __GT_FILE 0
00030 #endif
00031 
00032 int __gen_tempname ();
00033 
00034 /* Generate a unique temporary file name from TEMPLATE.
00035    The last six characters of TEMPLATE must be "XXXXXX";
00036    they are replaced with a string that makes the filename unique.
00037    Then open the file and return a fd. */
00038 int
00039 rpl_mkstemp (char *template)
00040 {
00041   return __gen_tempname (template, __GT_FILE);
00042 }