Select Git revision
Per Cederqvist authored
dbck.c 24.38 KiB
/*
* dbck.c - A simple database checker and corrector.
*
* Author: Per Cederqvist.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <kom-types.h>
#include <config.h>
#include "cache.h"
#include "log.h"
#include "lyskomd.h"
#include "misc-parser.h"
#include "smalloc.h"
#include <debug.h>
#include "dbck-cache.h"
char datafilename[1024]; /* Full pathname to the database file */
char backupfilename[1024]; /* Full pathname to the backup file */
char textfilename[1024];
char textbackupfilename[1024]; /* unshrinked text-file. */
static const char *dbase_dir = NULL; /* Directory where database resides */
#define TEXTBACKUPFILE_NAME "db/backup-texts"
int vflag=0; /* Verbose - list statistics also. */
int iflag=0; /* Interactive - prompt user and repair. */
int rflag=0; /* Repair simple error without confirmation. */
int gflag=0; /* Garbage collect text-file. */
int modifications = 0;
typedef struct {
int created_confs;
} Person_scratchpad;
static const Person_scratchpad EMPTY_PERSON_SCRATCHPAD = { 0 };
#include "limits.h"
static Person_scratchpad *person_scratchpad[MAX_CONF];
#ifdef DEBUG
int buglevel = 0;
#endif
extern void
log (const char * format, ...)
{
va_list AP;
va_start(AP, format);
vfprintf(stdout, format, AP);
va_end(AP);
}
extern void
restart_kom (const char * format, ...)
{
va_list AP;
va_start(AP, format);
vfprintf(stdout, format, AP);