]> andersk Git - moira.git/blobdiff - regtape/employee.dc
there's not always 2 spaces between first & last names;
[moira.git] / regtape / employee.dc
index 885ae9d67a4ac665ac774cef0f24f61024d4dea9..280474af9de8422a9f290002315771f0e2b41703 100644 (file)
@@ -5,8 +5,8 @@
 #include <strings.h>
 #include <ctype.h>
 #include <sys/time.h>
-#include <sms.h>
-#include <sms_app.h>
+#include <moira.h>
+#include <moira_site.h>
 
 
 ##define WHO 11859             /* root */
@@ -40,8 +40,8 @@
 #define LOC_HOST 187
 
 #define LEN_ID 9
-#define LEN_NAME 30
-#define LEN_OFFICE 23
+#define LEN_NAME 29
+#define LEN_OFFICE 12
 #define LEN_PHONE 12
 #define LEN_PHONE2 12
 #define LEN_DEPT 19
@@ -138,17 +138,20 @@ FILE *in;
 {
     static struct entry e;
     static char buf[BUFSIZ], mid[16], eid[16], email[256], phone[13];
-    int ends_jr, ends_iii, ends_iv;
+    int ends_sr, ends_jr, ends_iii, ends_iv;
     char *p;
 
-    fgets(buf, sizeof(buf), in);
-    buf[LEN_NAME] = 0;
+    if (fgets(buf, sizeof(buf), in) == NULL)
+      return((struct entry *)NULL);
+    buf[LOC_NAME + LEN_NAME] = 0;
     p = index(&buf[LOC_NAME], ',');
     if (p)
       *p = 0;
     e.last = strtrim(&buf[LOC_NAME]);
     if (p) {
-       e.first = p + 3;
+       e.first = p + 1;
+       while (*(e.first) && isspace(*(e.first)))
+         (e.first)++;
        if (p = index(e.first, ' ')) {
            *p = 0;
            e.middle = strtrim(p + 1);
@@ -157,11 +160,11 @@ FILE *in;
     } else
       e.first = "";
     e.first = strtrim(e.first);
-    ends_jr = ends_iii = ends_iv = 0;
+    ends_sr = ends_jr = ends_iii = ends_iv = 0;
     LookForSt(e.last);
     LookForO(e.last);
-    LookForJrAndIII(e.last, &ends_jr, &ends_iii, &ends_iv);
-    LookForJrAndIII(e.first, &ends_jr, &ends_iii, &ends_iv);
+    LookForJrAndIII(e.last, &ends_sr, &ends_jr, &ends_iii, &ends_iv);
+    LookForJrAndIII(e.first, &ends_sr, &ends_jr, &ends_iii, &ends_iv);
     FixCase(e.last);
     FixCase(e.first);
     FixCase(e.middle);
@@ -187,7 +190,7 @@ FILE *in;
     e.class = "MITS";
     if (!strcmp(e.dept, "PROJECT ATHENA"))
       e.class = "STAFF";
-    else if (substr(e.title, "PROF"))
+    else if (substr(e.title, "PROF") || substr(e.title, "LECTURE"))
       e.class = "FACULTY";
     else if (!strcmp(e.title, "VISITING SCIENTIST"))
       e.class = "VSCIENTI";
@@ -212,7 +215,11 @@ struct entry *e;
 ##  int id;
 
     first = e->first;
+    if (strlen(first) > 16)
+      first[16] = 0;
     last = e->last;
+    if (strlen(last) > 16)
+      last[16] = 0;
     eid = e->eid;
     id = 0;
 ##  repeat retrieve (id = u.users_id, class = u.mit_year, oaddr = u.office_addr,
@@ -222,13 +229,14 @@ struct entry *e;
        newuser(e);
        return;
     }
-    if (strcmp(e->class, strtrim(class))) {
+    if (strcmp(e->class, strtrim(class)) &&
+       strcmp(class, "STAFF") && strcmp(class, "SIPB")) {
        com_err(whoami, 0, "updating class for %s %s from %s to %s",
                first, last, class, e->class);
        strcpy(class, e->class);
 ##     repeat replace u (mit_year = @class,
 ##                modtime = "now", modby = WHO, modwith = PROG)
-##         where u.users_id = id
+##         where u.users_id = @id
     }
     changed = nochange = 0;
     strcpy(buf, e->address);
@@ -330,7 +338,7 @@ struct entry *e;
     else
       sprintf(fullname, "%s %s", first, last);
     st = US_NOT_ALLOWED;
-    if (!strcmp(e->class, "FACULTY"))
+    if (!strcmp(e->class, "FACULTY") || !strcmp(e->class, "STAFF"))
       st = US_NO_LOGIN_YET;
     
 ##  append users (#login = login, users_id = id, #uid = uid, shell = "/bin/csh",
This page took 0.062553 seconds and 4 git commands to generate.