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);
91 signal(SIGHUP, interrupt);
92 signal(SIGQUIT, interrupt);
93 signal(SIGINT, interrupt);
94 modtables = sq_create();
97 printf("Opening database %s...", database);
101 ## retrieve (dcmenable = values.value) where values.name = "dcm_enable"
102 dprintf("DCM disabled (was %d)\n", dcmenable);
103 ## replace values (value = 0) where values.name = "dcm_enable"
125 printf("An ingres error occuurred, code %d\n", *num);
126 printf("Aborting...\n");
137 printf("Signal caught\n");
138 if (prompt("Save database changes")) {
139 /* break out of a retrieve loop */
145 printf("Aborting transaction\n");
148 /* break out of a retrieve loop */
152 ## replace values (value = dcmenable) where values.name = "dcm_enable"
161 sq_save_unique_string(modtables, table);
168 while (sq_get_data(modtables, &tab)) {
169 ## replace tblstats (modtime = "now") where tblstats.table = tab
171 ## replace values (value = dcmenable) where values.name = "dcm_enable"
179 fprintf(stderr, "Out of memory while %s\n", msg);