-
-## append users (#login = login, users_id = id, #uid = uid, shell = "/bin/csh",
-## #last = last, #first = first, #middle = middle, status = 0,
-## #mit_id = sid, #mit_year = class,
-## modtime = "now", modby = WHO, modwith = PROG,
-## #fullname = fullname, home_addr = haddr, home_phone = hphone,
-## office_phone = ophone, #mit_dept = dept,
-## fmodtime = "now", fmodby = WHO, fmodwith = PROG,
-## potype = "NONE",
-## xname = fullname, xdept = dept, xtitle = title,
-## xaddress = haddr, xphone1 = hphone, xphone2 = ophone,
-## xmodtime = date("now"))
-
- com_err(whoami, 0, "adding user %s %s", e->first, e->last);
-##}
-
-
-set_next_object_id(object, limit)
- char *object;
+ name = e->name;
+ strcpy(raddr, e->address);
+ if (*e->dorm) {
+ strcat(raddr, " ");
+ strcat(raddr, e->dorm);
+ }
+ strcat(raddr, "|");
+ if (*e->city) {
+ strcat(raddr, e->city);
+ FixCase(raddr);
+ if (*e->state) {
+ strcat(raddr, " ");
+ if (isupper(e->state[0]) && isupper(e->state[1]) &&
+ isdigit(e->state[2]) && isdigit(e->state[3]) &&
+ isdigit(e->state[4]) && isdigit(e->state[5]) &&
+ isdigit(e->state[6])) {
+ sprintf(buf, "%c%c %s", e->state[0],e->state[1],
+ &(e->state[2]));
+ strcat(raddr, buf);
+ } else
+ strcat(raddr, e->state);
+ }
+ } else {
+ FixCase(raddr);
+ strcat(raddr, "MIT INTERDEPARTMENTAL MAIL");
+ }
+ EXEC SQL REPEATED INSERT INTO users
+ (login, users_id, uid, shell, last, first, middle, status,
+ clearid, type, modtime, modby, modwith, fullname, home_addr,
+ home_phone, office_phone, department, fmodtime, fmodby, fmodwith,
+ potype, xname, xdept, xtitle, xaddress, xphone1, xphone2, xmodtime)
+ VALUES (:login, :id, :uid, '/bin/csh', :last, :first, :middle, 0,
+ :sid, :class, 'now', :who, :prog, :fullname, :haddr, :hphone,
+ :ophone, :dept, 'now', :who, :prog, 'NONE', :name, :dept,
+ :title, :raddr, :hphone, :ophone, date('now'));
+ if (sqlca.sqlcode != 0) {
+ if (sqlca.sqlcode == SQL_DEADLOCK) {
+ com_err(whoami, MR_DEADLOCK, "adding user %s", sid);
+ EXEC SQL ROLLBACK;
+ return newuser(e);
+ } else {
+ com_err(whoami, 0, "ingres error %d", sqlca.sqlcode);
+ exit(1);
+ }
+ } else
+ com_err(whoami, 0, "adding user %s %s", e->first, e->last);
+}
+
+
+
+set_next_users_id(limit)