]> andersk Git - moira.git/commitdiff
handle AFS homedirs in different cells
authormar <mar>
Tue, 3 Sep 1991 16:53:50 +0000 (16:53 +0000)
committermar <mar>
Tue, 3 Sep 1991 16:53:50 +0000 (16:53 +0000)
gen/ca.dc

index 4725d44c90b05a33753f09169afe23eceed1392a..c21134b7d5a62cf426534077e81723b67d9ae0a1 100644 (file)
--- a/gen/ca.dc
+++ b/gen/ca.dc
@@ -15,6 +15,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#include <strings.h>
 EXEC SQL INCLUDE sqlca;
 
 extern int errno;
@@ -32,7 +33,7 @@ int argc;
 char **argv;
 {
     FILE *out = stdout;
-    char *outf = NULL, outft[64];
+    char *outf = NULL, outft[64], *p, last[256];
     struct stat sb;
     struct save_queue *sq;
     struct prec *prec;
@@ -124,17 +125,16 @@ char **argv;
       SELECT DISTINCT u.login, u.fullname, f.name
       FROM users u, filesys f
        WHERE f.label = u.login and u.status = 1 and f.type = "AFS"
-       ORDER BY login;
+       ORDER BY name;
     EXEC SQL OPEN z;
-    first = 0;
     while (1) {
        EXEC SQL FETCH z INTO :login, :name, :dir;
        if (sqlca.sqlcode != 0) break;
-       if (strncmp(dir, "/afs/athena", 11)) break;
-       if (first != login[0]) {
-           first = login[0];
-           fprintf(out, "*%s:%s%c\n", "AFS", "/afs/athena.mit.edu/user/",
-                   first);
+       p = rindex(dir, '/');
+       if (p) *p = 0;
+       if (strcmp(last, dir)) {
+           strcpy(last, dir);
+           fprintf(out, "*%s:%s\n", "AFS", dir);
        }
        strtrim(login);
        strtrim(name);
This page took 0.050524 seconds and 5 git commands to generate.