]>
Commit | Line | Data |
---|---|---|
1ba88c34 | 1 | |
2 | #include <stdio.h> | |
3 | ##define USERSMS 17069 | |
4 | ||
5 | FILE *open_file(); | |
6 | ||
7 | do_users() | |
8 | ##{ | |
9 | FILE *u, *f, *p; | |
10 | ## int flag; | |
11 | /* login = text(8), */ | |
12 | ## char t_login[9]; | |
13 | /* users_id = i4, */ | |
14 | ## int t_users_id; | |
15 | /* uid = i2, */ | |
16 | ## int t_uid; | |
17 | /* shell = text(32), */ | |
18 | ## char t_shell[33]; | |
19 | /* home = text(32), */ | |
20 | ## char t_home[33]; | |
21 | /* last = text(16), */ | |
22 | ## char t_last[17]; | |
23 | /* first = text(16), */ | |
24 | ## char t_first[17]; | |
25 | /* middle = text(16), */ | |
26 | ## char t_middle[17]; | |
27 | /* status = i2, */ | |
28 | ## int t_status; | |
29 | /* mit_id = c13, */ | |
30 | ## char t_mit_id[14]; | |
31 | /* mit_year = text(8), */ | |
32 | ## char t_mit_year[9]; | |
33 | /* expdate = date, */ | |
34 | ## char t_expdate[26]; | |
35 | /* modtime = date, */ | |
36 | ## char t_modtime[26]; | |
37 | /* acl_id = i4 */ | |
38 | ## int t_acl_id; | |
39 | /* users_id = i4, */ | |
40 | ## int t_fusers_id; | |
41 | /* fullname = text(32), */ | |
42 | ## char t_fullname[33]; | |
43 | /* nickname = text(16), */ | |
44 | ## char t_nickname[17]; | |
45 | /* home_addr = text(80), */ | |
46 | ## char t_home_addr[81]; | |
47 | /* home_phone = text(16), */ | |
48 | ## char t_home_phone[17]; | |
49 | /* office_addr = text(16), */ | |
50 | ## char t_office_addr[17]; | |
51 | /* office_phone = text(12), */ | |
52 | ## char t_office_phone[13]; | |
53 | /* mit_dept = text(12), */ | |
54 | ## char t_mit_dept[13]; | |
55 | /* mit_affil = text(4), */ | |
56 | ## char t_mit_affil[5]; | |
57 | /* modtime = date */ | |
58 | ## char t_fmodtime[26]; | |
59 | /* users_id = i4, */ | |
60 | ## int t_pusers_id; | |
61 | /* type = text(8), */ | |
62 | ## char t_type[9]; | |
63 | /* mach_id = i4, */ | |
64 | ## int t_mach_id; | |
65 | /* box = text(32), */ | |
66 | ## char t_box[33]; | |
67 | /* created = date */ | |
68 | ## char t_pcreated[26]; | |
69 | ||
70 | u = open_file("users"); | |
71 | f = open_file("finger"); | |
72 | p = open_file("pobox"); | |
73 | ||
74 | ## range of u is users | |
75 | ## range of m is machine | |
76 | ||
77 | while(!feof(u)) { | |
78 | parse_str(u, t_login, 9); | |
79 | if (feof(u)) break; | |
80 | parse_sep(u); | |
81 | t_users_id = parse_int(u); | |
82 | parse_sep(u); | |
83 | t_uid = parse_int(u); | |
84 | parse_sep(u); | |
85 | parse_str(u, t_shell, 33); | |
86 | parse_sep(u); | |
87 | parse_str(u, t_home, 33); | |
88 | parse_sep(u); | |
89 | parse_str(u, t_last, 17); | |
90 | parse_sep(u); | |
91 | parse_str(u, t_first, 17); | |
92 | parse_sep(u); | |
93 | parse_str(u, t_middle, 17); | |
94 | parse_sep(u); | |
95 | t_status = parse_int(u); | |
96 | parse_sep(u); | |
97 | parse_str(u, t_mit_id, 14); | |
98 | parse_sep(u); | |
99 | parse_str(u, t_mit_year, 9); | |
100 | parse_sep(u); | |
101 | parse_str(u, t_expdate, 26); | |
102 | parse_sep(u); | |
103 | parse_str(u, t_modtime, 26); | |
104 | parse_sep(u); | |
105 | t_acl_id = parse_int(u); | |
106 | parse_nl(u); | |
107 | ||
108 | while (t_fusers_id < t_users_id) { | |
109 | t_fusers_id = parse_int(f); | |
110 | parse_sep(f); | |
111 | parse_str(f, t_fullname, 33); | |
112 | parse_sep(f); | |
113 | parse_str(f, t_nickname, 17); | |
114 | parse_sep(f); | |
115 | parse_str(f, t_home_addr, 81); | |
116 | parse_sep(f); | |
117 | parse_str(f, t_home_phone, 17); | |
118 | parse_sep(f); | |
119 | parse_str(f, t_office_addr, 17); | |
120 | parse_sep(f); | |
121 | parse_str(f, t_office_phone, 13); | |
122 | parse_sep(f); | |
123 | parse_str(f, t_mit_dept, 13); | |
124 | parse_sep(f); | |
125 | parse_str(f, t_mit_affil, 5); | |
126 | parse_sep(f); | |
127 | parse_str(f, t_fmodtime, 26); | |
128 | parse_nl(f); | |
129 | if (t_fusers_id < t_users_id) | |
130 | printf("orphaned finger info for user \"%s\" (%d)\n", | |
131 | t_fullname, t_fusers_id); | |
132 | } | |
133 | ||
134 | while (t_pusers_id < t_users_id) { | |
135 | t_pusers_id = parse_int(p); | |
136 | parse_sep(p); | |
137 | parse_str(p, t_type, 9); | |
138 | parse_sep(p); | |
139 | t_mach_id = parse_int(p); | |
140 | parse_sep(p); | |
141 | parse_str(p, t_box, 33); | |
142 | parse_sep(p); | |
143 | parse_str(p, t_pcreated, 26); | |
144 | parse_nl(p); | |
145 | if (t_pusers_id < t_users_id) | |
146 | printf("orphaned pobox for user \"%s\" (%d)\n", | |
147 | t_box, t_pusers_id); | |
148 | } | |
149 | /* | |
150 | # repeat retrieve (flag = any(u.login where u.login = @t_login | |
151 | # or u.users_id = @t_users_id)) | |
152 | if (flag) { | |
153 | printf("Conflict! User %s, users_id %d conflicts with another user in the database\n", t_login, t_users_id); | |
154 | continue; | |
155 | } | |
156 | */ | |
157 | printf("adding \"%s\"\n", t_login); | |
158 | if (t_users_id == t_fusers_id && t_users_id == t_pusers_id) { | |
159 | ## append users ( | |
160 | ## login = t_login, | |
161 | ## users_id = t_users_id, | |
162 | ## uid = t_uid, | |
163 | ## shell = t_shell, | |
164 | ## last = t_last, | |
165 | ## first = t_first, | |
166 | ## middle = t_middle, | |
167 | ## status = t_status, | |
168 | ## mit_id = t_mit_id, | |
169 | ## mit_year = t_mit_year, | |
170 | ## modtime = t_modtime, | |
171 | ## modwith = "convert", | |
172 | ## modby = USERSMS, | |
173 | ## fullname = t_fullname, | |
174 | ## nickname = t_nickname, | |
175 | ## home_addr = t_home_addr, | |
176 | ## home_phone = t_home_phone, | |
177 | ## office_addr = t_office_addr, | |
178 | ## office_phone = t_office_phone, | |
179 | ## mit_dept = t_mit_dept, | |
180 | ## mit_affil = t_mit_affil, | |
181 | ## fmodtime = t_modtime, | |
182 | ## fmodwith = "convert", | |
183 | ## fmodby = USERSMS, | |
184 | ## potype = t_type, | |
185 | ## pop_id = t_mach_id, | |
186 | ## box_id = t_mach_id, | |
187 | ## pmodtime = t_created, | |
188 | ## pmodwith = "convert", | |
189 | ## pmodby = USERSMS | |
190 | ## ) | |
191 | } else if (t_users_id == t_fusers_id) { | |
192 | ## append users ( | |
193 | ## login = t_login, | |
194 | ## users_id = t_users_id, | |
195 | ## uid = t_uid, | |
196 | ## shell = t_shell, | |
197 | ## last = t_last, | |
198 | ## first = t_first, | |
199 | ## middle = t_middle, | |
200 | ## status = t_status, | |
201 | ## mit_id = t_mit_id, | |
202 | ## mit_year = t_mit_year, | |
203 | ## modtime = t_modtime, | |
204 | ## modwith = "convert", | |
205 | ## modby = USERSMS, | |
206 | ## fullname = t_fullname, | |
207 | ## nickname = t_nickname, | |
208 | ## home_addr = t_home_addr, | |
209 | ## home_phone = t_home_phone, | |
210 | ## office_addr = t_office_addr, | |
211 | ## office_phone = t_office_phone, | |
212 | ## mit_dept = t_mit_dept, | |
213 | ## mit_affil = t_mit_affil, | |
214 | ## fmodtime = t_modtime, | |
215 | ## fmodwith = "convert", | |
216 | ## fmodby = USERSMS, | |
217 | ## potype = "NONE", | |
218 | ## pop_id = 0, | |
219 | ## box_id = 0, | |
220 | ## pmodtime = "now", | |
221 | ## pmodwith = "convert", | |
222 | ## pmodby = USERSMS | |
223 | ## ) | |
224 | } else { | |
225 | ## append users ( | |
226 | ## login = t_login, | |
227 | ## users_id = t_users_id, | |
228 | ## uid = t_uid, | |
229 | ## shell = t_shell, | |
230 | ## last = t_last, | |
231 | ## first = t_first, | |
232 | ## middle = t_middle, | |
233 | ## status = t_status, | |
234 | ## mit_id = t_mit_id, | |
235 | ## mit_year = t_mit_year, | |
236 | ## modtime = t_modtime, | |
237 | ## modwith = "convert", | |
238 | ## modby = USERSMS, | |
239 | ## mit_affil = t_mit_year, | |
240 | ## fmodtime = "now", | |
241 | ## fmodwith = "convert", | |
242 | ## fmodby = USERSMS, | |
243 | ## potype = "NONE", | |
244 | ## pop_id = 0, | |
245 | ## box_id = 0, | |
246 | ## pmodtime = "now", | |
247 | ## pmodwith = "convert", | |
248 | ## pmodby = USERSMS | |
249 | ## ) | |
250 | } | |
251 | } | |
252 | (void) fclose(f); | |
253 | ||
254 | ##} | |
255 |