strtoumax: fix another typo in previous commit
[gnulib.git] / lib / clean-temp.h
index 65c427c..24aeca8 100644 (file)
@@ -1,5 +1,5 @@
 /* Temporary directories and temporary files with automatic cleanup.
 /* Temporary directories and temporary files with automatic cleanup.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2011-2013 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
@@ -39,7 +39,16 @@ extern "C" {
 
    This module provides support for temporary directories and temporary files
    inside these temporary directories.  Temporary files without temporary
 
    This module provides support for temporary directories and temporary files
    inside these temporary directories.  Temporary files without temporary
-   directories are not supported here.  */
+   directories are not supported here.  The temporary directories and files
+   are automatically cleaned up (at the latest) when the program exits or
+   dies from a fatal signal such as SIGINT, SIGTERM, SIGHUP, but not if it
+   dies from a fatal signal such as SIGQUIT, SIGKILL, or SIGABRT, SIGSEGV,
+   SIGBUS, SIGILL, SIGFPE.
+
+   For the cleanup in the normal case, programs that use this module need to
+   call 'cleanup_temp_dir' for each successful return of 'create_temp_dir'.
+   The cleanup in the case of a fatal signal such as SIGINT, SIGTERM, SIGHUP,
+   is done entirely automatically by the functions of this module.  */
 
 struct temp_dir
 {
 
 struct temp_dir
 {
@@ -60,43 +69,43 @@ struct temp_dir
    Return a fresh 'struct temp_dir' on success.  Upon error, an error message
    is shown and NULL is returned.  */
 extern struct temp_dir * create_temp_dir (const char *prefix,
    Return a fresh 'struct temp_dir' on success.  Upon error, an error message
    is shown and NULL is returned.  */
 extern struct temp_dir * create_temp_dir (const char *prefix,
-                                         const char *parentdir,
-                                         bool cleanup_verbose);
+                                          const char *parentdir,
+                                          bool cleanup_verbose);
 
 /* Register the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
    needs to be removed before DIR can be removed.
    Should be called before the file ABSOLUTE_FILE_NAME is created.  */
 extern void register_temp_file (struct temp_dir *dir,
 
 /* Register the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
    needs to be removed before DIR can be removed.
    Should be called before the file ABSOLUTE_FILE_NAME is created.  */
 extern void register_temp_file (struct temp_dir *dir,
-                               const char *absolute_file_name);
+                                const char *absolute_file_name);
 
 /* Unregister the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
    needs to be removed before DIR can be removed.
    Should be called when the file ABSOLUTE_FILE_NAME could not be created.  */
 extern void unregister_temp_file (struct temp_dir *dir,
 
 /* Unregister the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
    needs to be removed before DIR can be removed.
    Should be called when the file ABSOLUTE_FILE_NAME could not be created.  */
 extern void unregister_temp_file (struct temp_dir *dir,
-                                 const char *absolute_file_name);
+                                  const char *absolute_file_name);
 
 /* Register the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
    that needs to be removed before DIR can be removed.
    Should be called before the subdirectory ABSOLUTE_DIR_NAME is created.  */
 extern void register_temp_subdir (struct temp_dir *dir,
 
 /* Register the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
    that needs to be removed before DIR can be removed.
    Should be called before the subdirectory ABSOLUTE_DIR_NAME is created.  */
 extern void register_temp_subdir (struct temp_dir *dir,
-                                 const char *absolute_dir_name);
+                                  const char *absolute_dir_name);
 
 /* Unregister the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
    that needs to be removed before DIR can be removed.
    Should be called when the subdirectory ABSOLUTE_DIR_NAME could not be
    created.  */
 extern void unregister_temp_subdir (struct temp_dir *dir,
 
 /* Unregister the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
    that needs to be removed before DIR can be removed.
    Should be called when the subdirectory ABSOLUTE_DIR_NAME could not be
    created.  */
 extern void unregister_temp_subdir (struct temp_dir *dir,
-                                   const char *absolute_dir_name);
+                                    const char *absolute_dir_name);
 
 /* Remove the given ABSOLUTE_FILE_NAME and unregister it.
    Return 0 upon success, or -1 if there was some problem.  */
 extern int cleanup_temp_file (struct temp_dir *dir,
 
 /* Remove the given ABSOLUTE_FILE_NAME and unregister it.
    Return 0 upon success, or -1 if there was some problem.  */
 extern int cleanup_temp_file (struct temp_dir *dir,
-                             const char *absolute_file_name);
+                              const char *absolute_file_name);
 
 /* Remove the given ABSOLUTE_DIR_NAME and unregister it.
    Return 0 upon success, or -1 if there was some problem.  */
 extern int cleanup_temp_subdir (struct temp_dir *dir,
 
 /* Remove the given ABSOLUTE_DIR_NAME and unregister it.
    Return 0 upon success, or -1 if there was some problem.  */
 extern int cleanup_temp_subdir (struct temp_dir *dir,
-                               const char *absolute_dir_name);
+                                const char *absolute_dir_name);
 
 /* Remove all registered files and subdirectories inside DIR.
    Return 0 upon success, or -1 if there was some problem.  */
 
 /* Remove all registered files and subdirectories inside DIR.
    Return 0 upon success, or -1 if there was some problem.  */