1
1
/* Temporary directories and temporary files with automatic cleanup.
2
Copyright (C) 2006 Free Software Foundation, Inc.
2
Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
3
3
Written by Bruno Haible <bruno@clisp.org>, 2006.
5
5
This program is free software: you can redistribute it and/or modify
60
60
Return a fresh 'struct temp_dir' on success. Upon error, an error message
61
61
is shown and NULL is returned. */
62
62
extern struct temp_dir * create_temp_dir (const char *prefix,
63
const char *parentdir,
64
bool cleanup_verbose);
63
const char *parentdir,
64
bool cleanup_verbose);
66
66
/* Register the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
67
67
needs to be removed before DIR can be removed.
68
68
Should be called before the file ABSOLUTE_FILE_NAME is created. */
69
69
extern void register_temp_file (struct temp_dir *dir,
70
const char *absolute_file_name);
70
const char *absolute_file_name);
72
72
/* Unregister the given ABSOLUTE_FILE_NAME as being a file inside DIR, that
73
73
needs to be removed before DIR can be removed.
74
74
Should be called when the file ABSOLUTE_FILE_NAME could not be created. */
75
75
extern void unregister_temp_file (struct temp_dir *dir,
76
const char *absolute_file_name);
76
const char *absolute_file_name);
78
78
/* Register the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
79
79
that needs to be removed before DIR can be removed.
80
80
Should be called before the subdirectory ABSOLUTE_DIR_NAME is created. */
81
81
extern void register_temp_subdir (struct temp_dir *dir,
82
const char *absolute_dir_name);
82
const char *absolute_dir_name);
84
84
/* Unregister the given ABSOLUTE_DIR_NAME as being a subdirectory inside DIR,
85
85
that needs to be removed before DIR can be removed.
86
86
Should be called when the subdirectory ABSOLUTE_DIR_NAME could not be
88
88
extern void unregister_temp_subdir (struct temp_dir *dir,
89
const char *absolute_dir_name);
89
const char *absolute_dir_name);
91
91
/* Remove the given ABSOLUTE_FILE_NAME and unregister it.
92
92
Return 0 upon success, or -1 if there was some problem. */
93
93
extern int cleanup_temp_file (struct temp_dir *dir,
94
const char *absolute_file_name);
94
const char *absolute_file_name);
96
96
/* Remove the given ABSOLUTE_DIR_NAME and unregister it.
97
97
Return 0 upon success, or -1 if there was some problem. */
98
98
extern int cleanup_temp_subdir (struct temp_dir *dir,
99
const char *absolute_dir_name);
99
const char *absolute_dir_name);
101
101
/* Remove all registered files and subdirectories inside DIR.
102
102
Return 0 upon success, or -1 if there was some problem. */