#include "common.h"
#include "file.h"
#include "misc.h"
#include "tm.h"
#include "override.h"
Functions | |
RCSID ("$Id:file.c, v 1.11 2005/09/08 21:45:58 cbiere Exp $") | |
void | file_register_fd_reclaimer (reclaim_fd_t callback) |
Register fd reclaiming callback. | |
FILE * | open_read (const gchar *what, const file_path_t *fv, gint fvcnt, gboolean renaming, gint *chosen) |
Open configuration file, renaming it as ".orig" when `renaming' is TRUE. | |
FILE * | file_config_open_read (const gchar *what, const file_path_t *fv, gint fvcnt) |
Open configuration file, renaming it as ".orig". | |
FILE * | file_config_open_read_norename (const gchar *what, const file_path_t *fv, gint fvcnt) |
Open configuration file, without renaming it. | |
FILE * | file_config_open_read_norename_chosen (const gchar *what, const file_path_t *fv, gint fvcnt, gint *chosen) |
Same as file_config_open_read_norename(), but also returns the index of the path chosen within the array, if a file was opened at all. | |
FILE * | file_config_open (const gchar *what, const file_path_t *fv) |
Open configuration file for writing. | |
FILE * | file_config_open_write (const gchar *what, const file_path_t *fv) |
Open configuration file for writing. | |
gboolean | file_config_close (FILE *out, const file_path_t *fv) |
Close configuration file opened for writing, and rename it. | |
void | file_config_preamble (FILE *out, const gchar *what) |
Emit the configuration preamble. | |
void | file_path_set (file_path_t *fp, const char *dir, const char *name) |
Initializes `fp' with directory path `dir' and filename `name'. | |
gint | do_open (const gchar *path, gint flags, gint mode, gboolean missing) |
Open file, returning file descriptor or -1 on error with errno set. | |
gint | file_open (const gchar *path, gint flags) |
Open file, returning file descriptor or -1 on error with errno set. | |
gint | file_open_missing (const gchar *path, gint flags) |
Open file, returning file descriptor or -1 on error with errno set. | |
gint | file_create (const gchar *path, gint flags, gint mode) |
Create file, returning file descriptor or -1 on error with errno set. | |
FILE * | do_fopen (const gchar *path, const gchar *mode, gboolean missing) |
Open file, returning FILE pointer if success or NULL on error. | |
FILE * | file_fopen (const gchar *path, const gchar *mode) |
Open file, returning FILE pointer if success or NULL on error. | |
FILE * | file_fopen_missing (const gchar *path, const gchar *mode) |
Open file, returning FILE pointer if success or NULL on error. | |
Variables | |
const gchar | orig_ext [] = "orig" |
const gchar | new_ext [] = "new" |
const gchar | instead_str [] = " instead" |
const gchar | empty_str [] = "" |
reclaim_fd_t | reclaim_fd = NULL |
In order to avoid having a dependency between file.c and ban.c, we have ban.c register a callback to reclaim file descriptors at init time. |
|
Open file, returning FILE pointer if success or NULL on error. Errors are logged as a warning, unless error is ENOENT and `missing' is TRUE. |
|
Open file, returning file descriptor or -1 on error with errno set. Errors are logged as a warning, unless `missing' is true, in which case no error is logged for ENOENT. |
|
Close configuration file opened for writing, and rename it.
|
|
Open configuration file for writing. We don't clobber the existing file yet and open a ".new" instead. Renaming will occur afterwards, when file_config_close() is called.
|
|
Open configuration file, renaming it as ".orig". If configuration file cannot be found, try opening the ".orig" variant if already present. If not found, try with successive alternatives, if supplied.
|
|
Open configuration file, without renaming it. If configuration file cannot be found, try opening the ".orig" variant if already present. If not found, try with successive alternatives, if supplied.
|
|
Same as file_config_open_read_norename(), but also returns the index of the path chosen within the array, if a file was opened at all.
|
|
Open configuration file for writing.
|
|
Emit the configuration preamble.
|
|
Create file, returning file descriptor or -1 on error with errno set. Errors are logged as a warning. |
|
Open file, returning FILE pointer if success or NULL on error. Errors are logged as a warning. |
|
Open file, returning FILE pointer if success or NULL on error. Errors are logged as a warning, unless the file is missing, in which case nothing is logged. |
|
Open file, returning file descriptor or -1 on error with errno set. Errors are logged as a warning. |
|
Open file, returning file descriptor or -1 on error with errno set. Errors are logged as a warning, unless the file is missing, in which case nothing is logged. |
|
Initializes `fp' with directory path `dir' and filename `name'.
|
|
Register fd reclaiming callback. Use NULL to unregister it. |
|
Open configuration file, renaming it as ".orig" when `renaming' is TRUE. If configuration file cannot be found, try opening the ".orig" variant if already present and `renaming' is TRUE. If not found, try with successive alternatives, if supplied.
|
|
|
|
|
|
|
|
|
|
|
|
In order to avoid having a dependency between file.c and ban.c, we have ban.c register a callback to reclaim file descriptors at init time. --RAM, 2004-08-18 |