/* install-log.h: Common definitions, function prototypes, and so on.
 *
 * $Id: install-log.h,v 1.8 2003/02/10 06:47:23 andy Exp $
 *
 * Copyright (C) 2002 Andy Goth <unununium@openverse.com>
 * For more information visit http://ioioio.net/devel/install-log/
 * 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA  02111-1307, USA. */

#ifndef SEEN_INSTALL_LOG_H
#define SEEN_INSTALL_LOG_H

#include <time.h>
#include <stdarg.h>
#include "version.h"
#include "configure.h"

/* A clue as to when values are binary in nature. */
typedef int bool;

/* Simple singly-linked list.  Linked lists begin with a head node containing
 * no data */
typedef struct list_t {
	void* data;
	struct list_t* next;
} list_t;

/* configure.c (generated by configure) */
extern const char* default_include[];
extern const char* default_exclude[];

/* globals.c */
extern char* program_name;
extern bool force;
extern bool edit;
extern bool quiet;
extern char* package;
extern list_t include;
extern list_t exclude;
extern char* root;
extern char* chrootvar;
extern char* logdir;
extern char* editor;
extern int verbosity;
extern list_t new_files;
extern list_t old_files;
extern list_t del_files;
extern list_t prev_files;
extern time_t timestamp;
extern void init_globals(char** argv);
extern void free_globals(void);

/* main.c */
extern int main(int argc, char** argv);

/* config.c */
extern void get_config(int argc, char** argv);

/* find.c */
extern void find_all(void);

/* timestamp.c */
extern void get_timestamp(void);
extern void touch_timestamp(void);

/* list.c */
extern void add_node(list_t** node, void* data);
extern void add_string_node(list_t** node, const char* string);
extern void insert_string_node(list_t* list, const char* string);
extern void make_string_list(list_t* list, const char** string);
extern void proc_list(list_t* list, void (*func)(list_t*));
extern void proc_list_va(list_t* list, void (*func)(list_t*, va_list), ...);
extern void clear_list(list_t* list);
extern bool list_has_string(const list_t* list, const char* string);

/* util.c */
extern char* safe_sprintf(char** to, int* to_cap, char* fmt, ...);
extern void replace(char** context, int* context_cap, char* from, char* to);
extern void collapse(char* string, char c);
extern void alert(const char* format, ...);
extern void fail(const char* format, ...);
extern void report(int level, const char* format, ...);
extern void* xmalloc(size_t size);
extern void* xrealloc(void* ptr, size_t size);

/* database.c */
extern void read_db(void);
extern void write_db(void);
extern void find_old_and_del_files(void);
extern void report_old_and_del_files(void);

/* editor.c */
extern void edit_database(void);

#endif

/* EOF */

