Return NULL if fgets returns NULL (dump_log): If both first_old and

2001-08-03  Bradford Hovinen  <hovinen@ximian.com>

	* config-log.c (load_log_entry): Return NULL if fgets returns NULL
	(dump_log): If both first_old and log_data are NULL, go ahead and
	dump the file, since nothing has been loaded yet
	(config_log_garbage_collect): Don't bother dumping the log file or
	reloading

2001-08-02  Bradford Hovinen  <hovinen@ximian.com>

	* config-log.c (config_log_garbage_collect): Implement
	(dump_log): Don't dump the old file if first_old is NULL

	* main.c (main): Support --garbage_collect

	* location.c (location_garbage_collect):
	(garbage_collect_cb): Implement
This commit is contained in:
Bradford Hovinen 2001-08-03 14:38:09 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent 2989b795b3
commit a1c5aa388f
6 changed files with 185 additions and 36 deletions

View file

@ -44,6 +44,7 @@ static gboolean rollback;
static gboolean change_location;
static gboolean rename_location;
static gboolean push_config;
static gboolean garbage_collect;
static gboolean add_location;
static gboolean remove_location;
@ -91,6 +92,8 @@ static struct poptOption archiver_operations[] = {
N_("Add a given backend to the given location")},
{"remove-backend", '\0', POPT_ARG_NONE, &remove_backend, 0,
N_("Remove the given backend from the given location")},
{"garbage-collect", '\0', POPT_ARG_NONE, &garbage_collect, 0,
N_("Perform garbage collection on the given location")},
{NULL, '\0', 0, NULL, 0}
};
@ -297,6 +300,12 @@ do_remove_backend (Location *location)
location_remove_backend (location, backend_id);
}
static void
do_garbage_collect (Location *location)
{
location_garbage_collect (location);
}
int
main (int argc, char **argv)
{
@ -365,6 +374,8 @@ main (int argc, char **argv)
do_add_backend (location);
else if (remove_backend)
do_remove_backend (location);
else if (garbage_collect)
do_garbage_collect (location);
archive_close (archive);