]> andersk Git - moira.git/blobdiff - regtape/employee.dc
there's not always 2 spaces between first & last names;
[moira.git] / regtape / employee.dc
index cfd198392e7e9c5b815e9860e6e0228d7d3ce1b0..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,7 +40,7 @@
 #define LOC_HOST 187
 
 #define LEN_ID 9
-#define LEN_NAME 30
+#define LEN_NAME 29
 #define LEN_OFFICE 12
 #define LEN_PHONE 12
 #define LEN_PHONE2 12
@@ -143,13 +143,15 @@ FILE *in;
 
     if (fgets(buf, sizeof(buf), in) == NULL)
       return((struct entry *)NULL);
-    buf[LEN_NAME] = 0;
+    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);
@@ -188,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";
@@ -213,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,
@@ -223,7 +229,8 @@ struct entry *e;
        newuser(e);
        return;
     }
-    if (strcmp(e->class, strtrim(class)) && strcmp(class, "STAFF")) {
+    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);
@@ -331,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.032243 seconds and 4 git commands to generate.