.ig Copyright (C) 1993,1994 by the author(s). This software is published in the hope that it will be useful, but WITHOUT ANY WARRANTY for any part of this software to work correctly or as described in the manuals. See the ShapeTools Public License for details. Permission is granted to use, copy, modify, or distribute any part of this software but only under the conditions described in the ShapeTools Public License. A copy of this license is supposed to have been given to you along with ShapeTools in a file named LICENSE. Among other things, this copyright notice and the Public License must be preserved on all copies. Author: Andreas Lampen (Andreas.Lampen@cs.tu-berlin.de) $Header: sttmpfiles.3[4.0] Thu Jun 24 17:43:36 1993 andy@cs.tu-berlin.de frozen $ .. .TH sttmpfiles 3 "Thu Jun 24 17:43:36 1993" "sttk-1.7" "ShapeTools Toolkit Library" .SH NAME stTmpFile, stRegisterFile, stUnRegisterFile, stRmRegisteredFiles \- temporary files handling .SH SYNOPSIS #include .br #include .sp .ta 1c char* stTmpFile (char *path); .sp void stRegisterFile (char *fileName); .sp void stUnRegisterFile (char *fileName); .sp void stRmRegisteredFiles (void); .sp .SH DESCRIPTION \fIstTmpFile\fP creates a unique filename for a temporary file, registers it (see stRegisterFile below), and returns it. The return value resides in static memory and will be overwritten on the next call of stTmpFile. The temporary file is located in the \fI/tmp\fP directory. .LP \fIstRegisterFile\fP adds the given \fIfileName\fP to an internal static list of file names. This list helps to keep track of the names of all temporary files to be deleted until the end of the program execution. On abnormal program termination (signal), the termination handler may call \fIstRmRegisteredFiles\fP to delete all registered files. This avoids bogus temporary files to survive abnormal program termination. .LP \fIstUnRegisterFile\fP removes \fIfileName\fP from the internal list of file names. It should be called when the corresponding file was removed due to the regular control flow. .LP \fIstRmRegisteredFiles\fP removes all files named in the internal list set up by stTmpFile and stRegisterFile and clears the list. Bogus entries in the list (names without a correponding file) are ignored. Invoking stCatchSigs(3) causes stRmRegisteredFiles to be called on occurence of the signals SIGQUIT, SIGFPE, SIGBUS, SIGSEGV, and SIGTERM. stCleanup(3) also calls stRmRegisteredFiles. .SH SEE ALSO stCatchSigs(3), stCleanup(3) .SH LIMITS The maximum number of temporary files to be registered is 16.