-/* $Header$
+/* $Id$
*
- * (c) Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
+ * (c) Copyright 1988-1998 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
*/
#include <mit-copyright.h>
-#include <stdlib.h>
#include <moira.h>
#include "dbck.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
EXEC SQL INCLUDE sqlca;
-static char phase4_qc_rcsid[] = "$Header$";
+RCSID("$Header$");
EXEC SQL WHENEVER SQLERROR DO dbmserr();
-count_boxes(int id, struct user *u, struct hash *boxes)
+void count_boxes(int id, void *user, void *boxes);
+void check_box_counts(int id, void *cnt, void *counts);
+void check_nfs_counts(int id, void *nfsphys, void *hint);
+
+void count_boxes(int id, void *user, void *boxes)
{
+ struct user *u = user;
int i;
if (u->potype == 'P')
{
if ((i = (int) hash_lookup(boxes, u->pobox_id)))
{
- if (hash_store(boxes, u->pobox_id, i + 1) == -1)
+ if (hash_store(boxes, u->pobox_id, (void *)(i + 1)) == -1)
out_of_mem("storing poboxes in hash table");
}
else
}
-check_box_counts(int id, int cnt, struct hash *counts)
+void check_box_counts(int id, void *cnt, void *counts)
{
EXEC SQL BEGIN DECLARE SECTION;
- int oldval, rowcount, iid = id, icnt = cnt;
+ int oldval, rowcount, iid = id, icnt = (int)cnt;
EXEC SQL END DECLARE SECTION;
oldval = (int) hash_lookup(counts, id);
- cnt--;
- if (oldval != cnt)
+ icnt--;
+ if (oldval != icnt)
{
printf("Count wrong on POBox machine %s; is %d in db, counted %d\n",
((struct machine *) hash_lookup(machines, id))->name,
- oldval, cnt);
+ oldval, icnt);
if (single_fix("Update", 1))
{
EXEC SQL UPDATE serverhosts SET value1 = :icnt
}
-check_nfs_counts(int id, struct nfsphys *n, int hint)
+void check_nfs_counts(int id, void *nfsphys, void *hint)
{
+ struct nfsphys *n = nfsphys;
EXEC SQL BEGIN DECLARE SECTION;
int iid = id, val, rowcount;
EXEC SQL END DECLARE SECTION;
}
-phase4(void)
+void phase4(void)
{
struct hash *boxes, *counts;
int id, cnt;
if (sqlca.sqlcode)
break;
- if (hash_store(boxes, id, 1) == -1)
+ if (hash_store(boxes, id, (void *)1) == -1)
out_of_mem("storing poboxes");
- if (hash_store(counts, id, cnt) == -1)
+ if (hash_store(counts, id, (void *)cnt) == -1)
out_of_mem("storing pobox counts in hash table");
}
EXEC SQL CLOSE csr401;
}
-count_only_setup(void)
+void count_only_setup(void)
{
EXEC SQL BEGIN DECLARE SECTION;
int id, status, id2, id3;
char name[33], last[17], first[17], buf[257];
EXEC SQL END DECLARE SECTION;
- struct save_queue *sq;
struct user *u;
struct nfsphys *n;
struct machine *m;
strcpy(u->login, strtrim(name));
u->potype = buf[0];
sprintf(buf, "%s, %s", strtrim(last), strtrim(first));
- u->fullname = strsave(buf);
+ u->fullname = strdup(buf);
u->status = status;
u->users_id = id;
switch (u->potype)
if (sqlca.sqlcode)
break;
- if (n = (struct nfsphys *) hash_lookup(nfsphys, id))
+ if ((n = hash_lookup(nfsphys, id)))
n->count += id2;
}
EXEC SQL CLOSE csr405;