]> andersk Git - moira.git/blobdiff - server/increment.dc
Fixes, including uqot, aqot, GDSS stuff, wildcards for gfsp.
[moira.git] / server / increment.dc
index 8d9d5c5113bee39ae6f539850b7e32a30633029d..a71430e633d846e38ca745008b13948823823bac 100644 (file)
@@ -13,6 +13,7 @@
 static char *rcsid_increment_dc = "$Header$";
 #endif lint
 
+#include <fcntl.h>
 #include <mit-copyright.h>
 #include <moira.h>
 #include "query.h"
@@ -125,13 +126,6 @@ char **argv;
     beforetable = table;
 
     if (!strcmp(table, "users")) {
-/*
- *     retrieve (barg0 = u.login, barg1 = text(u.uid),
- *               barg2 = u.shell, barg3 = u.last, barg4 = u.first,
- *               barg5 = u.middle, barg6 = text(u.status),
- *               barg7 = u.mit_id, barg8 = u.mit_year)
- *             where qual
- */
        EXEC SQL SELECT login, CHAR(uid), shell, last, first, middle, 
            CHAR(status), clearid, type
          INTO :barg0, :barg1, :barg2, :barg3, :barg4, :barg5, :barg6,
@@ -139,17 +133,10 @@ char **argv;
          FROM users WHERE :qual;
        beforec = 9;
     } else if (!strcmp(table, "machine")) {
-/*
- *     retrieve (barg0 = m.name, barg1 = m.type) where qual
- */
        EXEC SQL SELECT name, type INTO :barg0, :barg1 FROM machine
          WHERE :qual;
        beforec = 2;
     } else if (!strcmp(table, "cluster")) {
-/*
- *     retrieve (barg0 = c.name, barg1 = c.desc, barg2 = c.location)
- *             where qual
- */
        EXEC SQL SELECT name, description, location 
          INTO :barg0, :barg1, :barg2
          FROM cluster WHERE :qual;
@@ -164,43 +151,33 @@ char **argv;
        strcpy(barg2, argv[2]);
        beforec = 3;
     } else if (!strcmp(table, "filesys")) {
-/*
- *     range of fs is filesys
- *     retrieve (barg0 = fs.label, barg1 = fs.type, barg2 = text(fs.mach_id),
- *               barg3 = fs.name, barg4 = fs.mount, barg5 = fs.access,
- *               barg6 = fs.comments, barg7 = text(fs.owner),
- *               barg8 = text(fs.owners), barg9 = text(fs.createflg),
- *               barg10 = fs.lockertype)
- *       where qual
- */
        EXEC SQL SELECT label, type, CHAR(mach_id), name, mount, access,
-           comments, CHAR(owner), CHAR(owners), CHAR(createflag), lockertype
+           comments, CHAR(owner), CHAR(owners), CHAR(createflg), lockertype
          INTO :barg0, :barg1, :barg2, :barg3, :barg4, :barg5, :barg6, 
             :barg7, :barg8, :barg9, :barg10
          FROM filesys WHERE :qual;
+        name = malloc(0);
+        id = atoi(barg2);
+        id_to_name(id, "MACHINE", &name);
+        strcpy(barg2, name);
+        id = atoi(barg7);
+        id_to_name(id, "USER", &name);
+        strcpy(barg7, name);
+        id = atoi(barg8);
+        id_to_name(id, "LIST", &name);
+        strcpy(barg8, name);
+        free(name);
        beforec = 11;
     } else if (!strcmp(table, "quota")) {
        strcpy(barg0, "?");
        strcpy(barg1, argv[1]);
        strcpy(barg2, "?");
-       sprintf(buffer, "%s and fs.filsys_id = q.filsys_id", qual);
+       sprintf(buffer, "%s and filesys.filsys_id = quota.filsys_id", qual);
        qual = buffer;
-/*
- *     range of q is quota
- *     retrieve (barg3 = text(q.quota), barg4 = filesys.name) where qual
- */
-       EXEC SQL SELECT q.quota, fs.name INTO :barg3, :barg4
-         FROM quota q, filesys fs WHERE :qual;
+       EXEC SQL SELECT CHAR(quota.quota), filesys.name INTO :barg3, :barg4
+         FROM quota, filesys WHERE :qual;
        beforec = 5;
     } else if (!strcmp(table, "list")) {
-/*
- *     retrieve (barg0 = l.name, barg1 = text(l.active),
- *               barg2 = text(l.public), barg3 = text(l.hidden),
- *               barg4 = text(l.maillist), barg5 = text(l.group),
- *               barg6 = text(l.gid), barg7 = l.acl_type,
- *               barg8 = text(l.acl_id), barg9 = l.desc)
- *       where qual
- */
        EXEC SQL SELECT name, CHAR(active), CHAR(publicflg), CHAR(hidden),
            CHAR(maillist), CHAR(grouplist), CHAR(gid), acl_type,
            CHAR(acl_id), description
@@ -210,9 +187,6 @@ char **argv;
        beforec = 10;
     } else if (!strcmp(table, "members")) {
        id = (int) argv[0];
-/*
- *     retrieve (barg3 = text(list.group)) where list.list_id = id
- */
        EXEC SQL SELECT CHAR(grouplist) INTO :barg3 FROM list 
          WHERE list_id = :id;
        name = malloc(0);
@@ -264,13 +238,6 @@ EXEC SQL END DECLARE SECTION;
     char **copy_argv();
 
     if (!strcmp(table, "users")) {
-/*
- *     retrieve (aarg0 = u.login, aarg1 = text(u.uid),
- *               aarg2 = u.shell, aarg3 = u.last, aarg4 = u.first,
- *               aarg5 = u.middle, aarg6 = text(u.status),
- *               aarg7 = u.mit_id, aarg8 = u.mit_year)
- *             where qual
- */
        EXEC SQL SELECT login, CHAR(uid), shell, last, first, middle,
            CHAR(status), clearid, type
          INTO :aarg0, :aarg1, :aarg2, :aarg3, :aarg4, :aarg5,
@@ -278,17 +245,10 @@ EXEC SQL END DECLARE SECTION;
          FROM users WHERE :qual;
        afterc = 9;
     } else if (!strcmp(table, "machine")) {
-/*
- *     retrieve (aarg0 = m.name, aarg1 = m.type) where qual
- */
        EXEC SQL SELECT name, type INTO :aarg0, :aarg1
          FROM machine WHERE :qual;
        afterc = 2;
     } else if (!strcmp(table, "cluster")) {
-/*
- *     retrieve (aarg0 = c.name, aarg1 = c.desc, aarg2 = c.location)
- *             where qual
- */
        EXEC SQL SELECT name, description, location 
          INTO :aarg0, :aarg1, :aarg2
          FROM cluster WHERE :qual;
@@ -303,44 +263,33 @@ EXEC SQL END DECLARE SECTION;
        strcpy(aarg2, argv[2]);
        afterc = 3;
     } else if (!strcmp(table, "filesys")) {
-/*
- *     range of fs is filesys
- *     retrieve (aarg0 = fs.label, aarg1 = fs.type,
- *               aarg2 = text(fs.mach_id),
- *               aarg3 = fs.name, aarg4 = fs.mount, aarg5 = fs.access,
- *               aarg6 = fs.comments, aarg7 = text(fs.owner),
- *               aarg8 = text(fs.owners), aarg9 = text(fs.createflg),
- *               aarg10 = fs.lockertype)
- *       where qual
- */
-        EXEC SQL SELECT label, type, CHAR(mach_id), name, mount, access,
-           comments, CHAR(owner), CHAR(owners), CHAR(createflag), lockertype
+        EXEC SQL SELECT CHAR(label), type, CHAR(mach_id), name, mount, access,
+           comments, CHAR(owner), CHAR(owners), CHAR(createflg), lockertype
           INTO :aarg0, :aarg1, :aarg2, :aarg3, :aarg4, :aarg5, :aarg6,
              :aarg7, :aarg8, :aarg9, :aarg10
           FROM filesys fs WHERE :qual;
+        name = malloc(0);
+        id = atoi(aarg2);
+        id_to_name(id, "MACHINE", &name);
+        strcpy(aarg2, name);
+        id = atoi(aarg7);
+        id_to_name(id, "USER", &name);
+        strcpy(aarg7, name);
+        id = atoi(aarg8);
+        id_to_name(id, "LIST", &name);
+        strcpy(aarg8, name);
+        free(name);
        afterc = 11;
     } else if (!strcmp(table, "quota")) {
        strcpy(aarg0, "?");
        strcpy(aarg1, argv[1]);
        strcpy(aarg2, "?");
-       sprintf(buffer, "%s and fs.filsys_id = q.filsys_id", qual);
+       sprintf(buffer, "%s and filesys.filsys_id = quota.filsys_id", qual);
        qual = buffer;
-/*
- *     range of q is quota
- *     retrieve (aarg3 = text(q.quota), aarg4 = filesys.name) where qual
- */
-       EXEC SQL SELECT CHAR(q.quota), fs.name INTO :aarg3, :aarg4
-         FROM quota q, filesys fs WHERE :qual;
+       EXEC SQL SELECT CHAR(quota.quota), filesys.name INTO :aarg3, :aarg4
+         FROM quota, filesys WHERE :qual;
        afterc = 5;
     } else if (!strcmp(table, "list")) {
-/*
- *     retrieve (aarg0 = l.name, aarg1 = text(l.active),
- *               aarg2 = text(l.public), aarg3 = text(l.hidden),
- *               aarg4 = text(l.maillist), aarg5 = text(l.group),
- *               aarg6 = text(l.gid), aarg7 = l.acl_type,
- *               aarg8 = text(l.acl_id), aarg9 = l.desc)
- *       where qual
- */
        EXEC SQL SELECT name, CHAR(active), CHAR(publicflg), CHAR(hidden),
            CHAR(maillist), CHAR(grouplist), CHAR(gid), acl_type,
            CHAR(acl_id), description
@@ -350,9 +299,6 @@ EXEC SQL END DECLARE SECTION;
        afterc = 10;
     } else if (!strcmp(table, "members")) {
        id = (int) argv[0];
-/*
- *     retrieve (aarg3 = text(list.group)) where list.list_id = id
- */
        EXEC SQL SELECT CHAR(grouplist) INTO :aarg3 FROM list
          WHERE list_id = :id;
        name = malloc(0);
@@ -500,7 +446,7 @@ next_incremental()
     switch (inc_pid) {
     case 0:
        execv(prog, argv);
-       exit(1);
+       _exit(1);
     case -1:
        com_err(whoami, 0, "Failed to start incremental update");
        break;
This page took 1.421731 seconds and 4 git commands to generate.