3 * Moira database consistency checker
5 * (c) Copyright 1988 by the Massachusetts Institute of Technology.
6 * For copying and distribution information, please see the file
10 #include <mit-copyright.h>
17 static char dbck_qc_rcsid[] = "$Header$";
25 struct hash *users, *machines, *clusters, *lists, *filesys, *nfsphys;
26 struct hash *strings, *members;
28 struct save_queue *modtables, *sq_create();
43 while (++arg - argv < argc) {
47 debug = atoi((*arg)[2] ? *arg+2 : *++arg);
71 printf("Usage: %s [-d level] [-n] [-y] [-p] [-a] [-c] [-f] [-w] [database]\n",
79 printf("Only doing counts\n");
81 printf("Doing fast version (skipping some checks)\n");
83 printf("Will NOT modify the database\n");
84 else if (mode == MODE_PREEN)
85 printf("Will fix simple things without asking\n");
86 else if (mode == MODE_YES)
87 printf("Will fix everything without asking\n");
89 printf("Debug level is %d\n", debug);
93 signal(SIGHUP, interrupt);
94 signal(SIGQUIT, interrupt);
95 signal(SIGINT, interrupt);
96 modtables = sq_create();
99 printf("Opening database %s...", database);
103 ## retrieve (dcmenable = values.value) where values.name = "dcm_enable"
104 dprintf("DCM disabled (was %d)\n", dcmenable);
105 ## replace values (value = 0) where values.name = "dcm_enable"
127 printf("An ingres error occuurred, code %d\n", *num);
128 printf("Aborting...\n");
139 printf("Signal caught\n");
140 if (prompt("Save database changes")) {
141 /* break out of a retrieve loop */
147 printf("Aborting transaction\n");
150 /* break out of a retrieve loop */
154 ## replace values (value = dcmenable) where values.name = "dcm_enable"
163 sq_save_unique_string(modtables, table);
170 while (sq_get_data(modtables, &tab)) {
171 ## replace tblstats (modtime = "now") where tblstats.table = tab
173 ## replace values (value = dcmenable) where values.name = "dcm_enable"
181 fprintf(stderr, "Out of memory while %s\n", msg);