X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/ba1f57aed838d0f1a04906e8b16ac6d3ea33b58f..50e8f6887fe94756a248b68cfcbd2ca8c9ebdaef:/regtape/staff.pc?ds=sidebyside diff --git a/regtape/staff.pc b/regtape/staff.pc index aac56316..5e85f1fd 100644 --- a/regtape/staff.pc +++ b/regtape/staff.pc @@ -74,19 +74,17 @@ struct entry { char *address; char *phone; char *phone2; - int highid; }; struct entry *get_next_entry(FILE *in); void process_entry(struct entry *e); void newuser(struct entry *e); int set_next_users_id(int limit); -int set_next_uid(int high); +int set_next_uid(void); void sqlexit(void); void dbmserr(char *where, int what); char *whoami; -int highid = 0; #define sqlfail() (sqlca.sqlcode && sqlca.sqlcode != 1403) #define SQL_DUPLICATE -2112 @@ -115,8 +113,6 @@ int main(int argc, char **argv) { if (!strcmp(argv[i], "-w")) wait++; - else if (!strcmp(argv[i], "-h")) - highid++; else if (file) fprintf(stderr, "Usage: %s [-w] [-D] [-n] inputfile\n", whoami); else @@ -285,14 +281,10 @@ struct entry *get_next_entry(FILE *in) e.title = strtrim(title); e.class = "MITS"; - e.highid = highid; if (strstr(e.title, "PROF") || strstr(e.title, "LECTURE")) e.class = "FACULTY"; if (!strcmp(e.dept, "LINCOLN LAB")) - { - e.class = "LINCOLN"; - e.highid = 1; - } + e.class = "LINCOLN"; return &e; } @@ -517,7 +509,7 @@ void newuser(struct entry *e) dept[USERS_DEPARTMENT_SIZE - 1] = '\0'; id = set_next_users_id(0); - uid = set_next_uid(e->highid); + uid = set_next_uid(); sprintf(login, "#%d", uid); last = e->last; first = e->first; @@ -539,11 +531,11 @@ void newuser(struct entry *e) com_err(whoami, 0, "adding user %s %s", e->first, e->last); EXEC SQL INSERT INTO users - (login, users_id, unix_uid, shell, last, first, middle, status, - clearid, type, modtime, modby, modwith, fullname, office_addr, - office_phone, department, fmodtime, fmodby, fmodwith, + (login, users_id, unix_uid, shell, winconsoleshell, last, first, + middle, status, clearid, type, modtime, modby, modwith, fullname, + office_addr, office_phone, department, fmodtime, fmodby, fmodwith, potype, xname, xdept, xtitle, xaddress, xphone1, xphone2, xmodtime) - VALUES (:login, :id, :uid, '/bin/athena/tcsh', + VALUES (:login, :id, :uid, '/bin/athena/tcsh', 'cmd', NVL(:last, CHR(0)), NVL(:first, CHR(0)), NVL(:middle, CHR(0)), :st, NVL(:sid, CHR(0)), NVL(:class, CHR(0)), SYSDATE, :who, :prog, NVL(:fullname, CHR(0)), NVL(:oaddr, CHR(0)), NVL(:ophone, CHR(0)), @@ -610,20 +602,15 @@ int set_next_users_id(int limit) return retval; } -int set_next_uid(int high) +int set_next_uid(void) { EXEC SQL BEGIN DECLARE SECTION; int flag, initial, value, retval; char *name; EXEC SQL END DECLARE SECTION; - if (high) - name = "high_uid"; - else - name = "unix_uid"; - EXEC SQL SELECT value INTO :initial FROM numvalues - WHERE name = :name; + WHERE name = 'unix_uid'; if (sqlfail()) sqlexit(); if (sqlca.sqlerrd[2] != 1) @@ -642,7 +629,11 @@ int set_next_uid(int high) while (flag) { value++; - if (!high && value > MAX_ID_VALUE) +#ifdef ULTRIX_ID_HOLE + if (value > 31999 && value < 32768) + value = 32768; +#endif + if (value > MAX_ID_VALUE) value = MIN_ID_VALUE; if (value == initial) { @@ -658,9 +649,9 @@ int set_next_uid(int high) } retval = value++; - if (!high && value > MAX_ID_VALUE) + if (value > MAX_ID_VALUE) value = MIN_ID_VALUE; - EXEC SQL UPDATE numvalues SET value = :value WHERE name = :name; + EXEC SQL UPDATE numvalues SET value = :value WHERE name = 'unix_uid'; if (sqlca.sqlcode) { dbmserr("assigning ID", sqlca.sqlcode);