From: danw Date: Wed, 29 Jan 1997 22:56:42 +0000 (+0000) Subject: Remove unused migrate.qc X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/b4cd3401e3b16294ecce97a727066a6e31be50bf Remove unused migrate.qc Move sync.dc to sync.pc bsd->ansi string functions --- diff --git a/afssync/Imakefile b/afssync/Imakefile index 02c72e2e..a6b64cb2 100644 --- a/afssync/Imakefile +++ b/afssync/Imakefile @@ -6,7 +6,7 @@ LIBS= -L../lib -L/usr/athena/lib -lmoira -lcom_err -lkrb -ldes ${DBLIBS} OBJS= ptutils.o utils.o ubik.o SRCS= ptutils.c utils.c ubik.c -CODE= $(SRCS) migrate.qc sync.dc +CODE= $(SRCS) sync.pc AFSDIR = /mit/afsuser AFSLIBS=$(AFSDIR)/lib/afs/libprot.a $(AFSDIR)/lib/afs/libauth.a \ @@ -21,4 +21,3 @@ genutil(pt_util,pt_util.o $(OBJS),,$(AFSLIBS) -L../lib -L/usr/athena/lib -lcom_e /* genutil(ptdump,ptdump.o $(OBJS),,) */ sqlfile(sync) -sqlfile(migrate) diff --git a/afssync/migrate.qc b/afssync/migrate.qc deleted file mode 100644 index db81efc3..00000000 --- a/afssync/migrate.qc +++ /dev/null @@ -1,197 +0,0 @@ -/* $Header$ */ - -#include -#include - - -int ingerr(); - -main(argc, argv) -int argc; -char **argv; -{ - int debug = 0; - FILE *input = stdin; - char buf[1024], junk[129]; -## int cell, quota, cnt, mach, oquota, id, who; -## char name[81], type[9], volume[81], path[129], quotas[33]; -## char oname[129],otype[9]; - char **arg = argv, *first_indir(), *second_indir(), *course_indir(); - - cnt = 0; - - while (++arg - argv < argc) { - if (**arg == '-') { - switch ((*arg)[1]) { - case 'd': - debug = atoi((*arg)[2] ? *arg+2 : *++arg); - break; - default: - fprintf(stderr, "Usage: %s [-d level] [inputfile]\n", - argv[0]); - exit(1); - } - } else { - input = fopen(*arg, "r"); - if (input == NULL) { - fprintf(stderr, "Unable to open in put file %s\n", *arg); - exit(1); - } - } - } - - if (debug > 4) - setenv("ING_SET", "set printqry"); - setlinebuf(stdout); - setlinebuf(stderr); - - if (debug) { printf("Opening database..."); fflush(stdout);} - IIseterr(ingerr); -## ingres sms - if (debug) printf("done.\n"); - -## range of f is filesys -## range of m is machine -## range of q is #quota -## retrieve (cell = machine.mach_id) where machine.#name="ATHENA.MIT.EDU" -## retrieve (who = users.users_id) where users.login="root" - - while (!feof(input)) { - fgets(buf, sizeof(buf), input); - if (sscanf(buf, "%s %s %s %s %s %s %s %s %s %s %s %s", - name, type, junk, junk, junk, junk, - quotas, junk, junk, junk, junk, junk) < 12) { - fprintf(stderr, "unable to parse line: %s\n", buf); - continue; - } - quota = atoi(quotas); - if (!strcmp(type, "HOMEDIR")) { - sprintf(path, "/afs/athena.mit.edu/user/%s/%s/%s", - first_indir(name), second_indir(name), name); - } else if (!strcmp(type, "COURSE")) { - sprintf(path, "/afs/athena.mit.edu/course/%s/%s", - course_indir(name), name); - } else if (!strcmp(type, "ACTIVITY")) { - sprintf(path, "/afs/athena.mit.edu/activity/%s/%s", - first_indir(name), name); - } else if (!strcmp(type, "APROJ")) { - sprintf(path, "/afs/athena.mit.edu/astaff/project/%s", - name); - } else if (!strcmp(type, "PROJECT")) { - sprintf(path, "/afs/athena.mit.edu/project/%s", - name); - } else if (!strcmp(type, "AREF")) { - sprintf(path, "/afs/athena.mit.edu/astaff/reference/%s", - name); - } else if (!strcmp(type, "REF")) { - sprintf(path, "/afs/athena.mit.edu/reference/%s", - name); - } else if (!strcmp(type, "CONTRIB")) { - sprintf(path, "/afs/athena.mit.edu/contrib/%s", - name); - } else if (!strcmp(type, "SW")) { - sprintf(path, "/afs/athena.mit.edu/software/%s", - name); - } else if (!strcmp(type, "SYSTEM")) { - sprintf(path, "/afs/athena.mit.edu/system/%s", - name); - } else { - fprintf(stderr, "Don't know how to deal with type %s\n", type); - continue; - } -## repeat retrieve (otype = f.#type, mach = f.mach_id, oname = f.#name) -## where f.label = @name { - strtrim(oname); - printf("changing FS %s (%s, %s on %d) to (AFS, %s)\n", - name, type, oname, mach, path); -## } -## repeat replace f (phys_id=0, #type="AFS", mach_id=cell, -## #name=@path, modtime=date("now"), -## modby=who, modwith="migrate") -## where f.label = @name -## repeat retrieve (type = q.#type, id=q.entity_id, oquota=q.#quota) -## where q.filsys_id = f.filsys_id and f.label=@name { - printf("removing quota (%d (%s %d) on %s)\n", - oquota, type, id, name); -## } -## repeat delete q where q.filsys_id = f.filsys_id and f.label=@name - printf("adding quota of %d on %s\n", quota, name); -## repeat append #quota (filsys_id = f.filsys_id, #type="ANY", -## entity_id=0, phys_id=0, -## #quota=@quota, modtime=date("now"), -## modby=who, modwith="migrate") -## where f.label= @name - cnt++; - } - - if (cnt > 0) { -## replace tblstats (updates = tblstats.updates + cnt, -## modtime = date("now")) -## where tblstats.tbl = "filesys" -## replace tblstats (updates = tblstats.updates + cnt, -## modtime = date("now")) -## where tblstats.tbl = "quota" - } - - if (debug) printf("Done.\n"); - exit(0); -} - - -char *first_indir(name) -char *name; -{ - static char buf[10]; - - if (islower(name[0])) - sprintf(buf, "%c", name[0]); - else - sprintf(buf, "other"); - return(buf); -} - -char *second_indir(name) -char *name; -{ - static char buf[10]; - - if (islower(name[1])) - sprintf(buf, "%c", name[1]); - else - sprintf(buf, "other"); - return(buf); -} - -char *course_indir(name) -char *name; -{ - static char buf[10]; - char *src, *dst; - - dst = buf; - for (src = name; *src && isdigit(*src); src++) - *dst++ = *src; - - if (dst == buf) - strcpy(buf, "other"); - else - *dst = 0; - - return(buf); -} - - -ingerr(num) -int *num; -{ - fprintf(stderr, "An ingres error ocurred, code %d\n", *num); - switch (*num) { - case 4700: - fprintf(stderr, "Deadlock**************************\n"); - break; - default: - fprintf(stderr, "Aborting\n"); - exit(1); - } - return(0); -} diff --git a/afssync/pt_util-fast.c b/afssync/pt_util-fast.c index 833c6e72..8b32d43a 100644 --- a/afssync/pt_util-fast.c +++ b/afssync/pt_util-fast.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -169,7 +169,7 @@ char **argv; if (ntohl(uh->magic) != UBIK_MAGIC) fprintf(stderr, "ptdump: %s: Bad UBIK_MAGIC. Is %x should be %x\n", pfile, ntohl(uh->magic), UBIK_MAGIC); - bcopy(&uh->version, &uv, sizeof(struct ubik_version)); + memcpy(&uv, &uh->version, sizeof(struct ubik_version)); fprintf(stderr, "Ubik Version is: %d.%d\n", ntohl(uv.epoch), ntohl(uv.counter)); if (read(dbase_fd, &prh, sizeof(struct prheader)) < 0) { diff --git a/afssync/pt_util.c b/afssync/pt_util.c index 355c0215..85f124ef 100644 --- a/afssync/pt_util.c +++ b/afssync/pt_util.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/afssync/ptdump.c b/afssync/ptdump.c index 1e443ba2..07742d76 100644 --- a/afssync/ptdump.c +++ b/afssync/ptdump.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/afssync/sync.dc b/afssync/sync.pc similarity index 100% rename from afssync/sync.dc rename to afssync/sync.pc