|
|
1.1 root 1: /* SMMUTIL.C */
2:
3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
4:
5: #include <stdio.h>
6: #include <time.h>
7: #include <stdlib.h>
8: #include <io.h>
9: #include <dos.h>
10: #include <fcntl.h>
11: #include <sys\stat.h>
12: #include <malloc.h>
13: #include <stdarg.h>
14: #include "gen_defs.h"
15: #include "smmdefs.h"
16: #include "crc32.h"
17:
18: struct date date;
19: struct time curtime;
20:
21: FILE *log=NULL;
22:
23: /****************************************************************************/
24: /* Returns 32-crc of string (not counting terminating NULL) */
25: /****************************************************************************/
26: ulong crc32(char *str)
27: {
28: int i=0;
29: ulong crc=0xffffffffUL;
30:
31: while(str[i])
32: crc=ucrc32(str[i++],crc);
33: crc=~crc;
34: return(crc);
35: }
36:
37: /****************************************************************************/
38: /* Returns the age derived from the string 'birth' in the format MM/DD/YY */
39: /****************************************************************************/
40: char getage(char *birth)
41: {
42: char age;
43:
44: if(birth[0]<=SP)
45: return(0);
46: getdate(&date);
47: age=(date.da_year-1900)-(((birth[6]&0xf)*10)+(birth[7]&0xf));
1.1.1.2 ! root 48: if(age>90)
! 49: age-=90;
1.1 root 50: if(atoi(birth)>12 || atoi(birth+3)>31)
51: return(0);
52: if(((birth[0]&0xf)*10)+(birth[1]&0xf)>date.da_mon ||
53: (((birth[0]&0xf)*10)+(birth[1]&0xf)==date.da_mon &&
54: ((birth[3]&0xf)*10)+(birth[4]&0xf)>date.da_day))
55: age--;
56: if(age<0)
57: return(0);
58: return(age);
59: }
60:
61: /**********************/
62: /* Log print function */
63: /**********************/
64: void logprintf(char *str, ...)
65: {
66: va_list argptr;
67: char buf[256];
68: time_t now;
69: struct tm *gm;
70:
71: va_start(argptr,str);
72: vsprintf(buf,str,argptr);
73: va_end(argptr);
74: fprintf(stderr,"\n%s",buf);
75: if(!log) return;
76: now=time(NULL);
77: gm=localtime(&now);
78: fseek(log,0L,SEEK_END);
79: fprintf(log,"%02u/%02u/%02u %02u:%02u:%02u %s\r\n"
1.1.1.2 ! root 80: ,gm->tm_mon+1,gm->tm_mday,TM_YEAR(gm->tm_year),gm->tm_hour,gm->tm_min,gm->tm_sec
1.1 root 81: ,buf);
82: fflush(log);
83: }
84:
85:
86: char *base41(unsigned int i, char *str)
87: {
88: char c;
89: unsigned int j=41*41,k;
90:
91: for(c=0;c<3;c++) {
92: k=i/j;
93: str[c]='0'+k;
94: i-=(k*j);
95: j/=41;
96: if(str[c]>=':')
97: str[c]='A'+(str[c]-':');
98: if(str[c]>='[')
99: str[c]='#'+(str[c]-'['); }
100: str[c]=0;
101: return(str);
102: }
103:
104: /****************************************************************************/
105: /* Updates 16-bit "rcrc" with character 'ch' */
106: /****************************************************************************/
107: void ucrc16(uchar ch, ushort *rcrc) {
108: ushort i, cy;
109: uchar nch=ch;
110:
111: for (i=0; i<8; i++) {
112: cy=*rcrc & 0x8000;
113: *rcrc<<=1;
114: if (nch & 0x80) *rcrc |= 1;
115: nch<<=1;
116: if (cy) *rcrc ^= 0x1021; }
117: }
118:
119: /****************************************************************************/
120: /* Returns 16-crc of string (not counting terminating NULL) */
121: /****************************************************************************/
122: ushort crc16(char *str)
123: {
124: int i=0;
125: ushort crc=0;
126:
127: ucrc16(0,&crc);
128: while(str[i])
129: ucrc16(str[i++],&crc);
130: ucrc16(0,&crc);
131: ucrc16(0,&crc);
132: return(crc);
133: }
134:
135:
136: void delphoto(user_t user)
137: {
138: char fname[64],path[128],tmp[128];
139: int i;
140: struct ffblk ff;
141:
142: if(!(user.misc&USER_PHOTO))
143: return;
144: for(i=0;user.system[i];i++)
145: if(isalnum(user.system[i]))
146: break;
147: if(!user.system[i])
148: fname[0]='~';
149: else
150: fname[0]=user.system[i];
151: for(i=strlen(user.system)-1;i>0;i--)
152: if(isalnum(user.system[i]))
153: break;
154: if(i<=0)
155: fname[1]='~';
156: else
157: fname[1]=user.system[i];
158: fname[2]=0;
159: strupr(user.system);
160: strcat(fname,base41(crc16(user.system),tmp));
161: strcat(fname,base41(user.number,tmp));
162: strcat(fname,".*");
163: strupr(fname);
164: sprintf(path,"PHOTO\\%s",fname);
165: i=findfirst(path,&ff,0);
166: if(i)
167: return;
168: sprintf(path,"PHOTO\\%s",ff.ff_name);
169: if(remove(path))
170: logprintf("Photo (%s) couldn't be removed!",path);
171: else
172: logprintf("Photo (%s) removed",path);
173: }
174:
175:
176: int main(int argc, char **argv)
177: {
178: int i,file,max_age=0,max_wall=0,age;
179: long l,m,total_ixbs=0
180: ,users=0,photos=0,networked=0
181: ,male_straight=0
182: ,male_gay=0
183: ,male_bi=0
184: ,female_straight=0
185: ,female_gay=0
186: ,female_bi=0
187: ,age12=0
188: ,age15=0
189: ,age20=0,age25=0
190: ,age30=0,age35=0
191: ,age40=0,age45=0
192: ,age50=0,age55=0
193: ,age60=0,age65=0
194: ,age70=0,age71=0
195: ,zodiac_aries=0
196: ,zodiac_taurus=0
197: ,zodiac_gemini=0
198: ,zodiac_cancer=0
199: ,zodiac_leo=0
200: ,zodiac_virgo=0
201: ,zodiac_libra=0
202: ,zodiac_scorpio=0
203: ,zodiac_sagittarius=0
204: ,zodiac_capricorn=0
205: ,zodiac_aquarius=0
206: ,zodiac_pisces=0
207: ,hair_blonde=0
208: ,hair_brown=0
209: ,hair_red=0
210: ,hair_black=0
211: ,hair_grey=0
212: ,hair_other=0
213: ,eyes_blue=0
214: ,eyes_green=0
215: ,eyes_hazel=0
216: ,eyes_brown=0
217: ,eyes_other=0
218: ,race_white=0
219: ,race_black=0
220: ,race_hispanic=0
221: ,race_asian=0
222: ,race_amerindian=0
223: ,race_mideastern=0
224: ,race_other=0
225: ,marital_single=0
226: ,marital_married=0
227: ,marital_divorced=0
228: ,marital_widowed=0
229: ,marital_other=0
230: ;
231: FILE *ixb_fp,*dab_fp,*tmp_fp;
232: ixb_t huge *ixb=NULL,ixbrec;
233: user_t user;
234: wall_t wall;
235: time_t now;
236:
237: fprintf(stderr,"\nSMMUTIL � Synchronet Match Maker Utility � v2.01�\n\n");
238:
239: for(i=1;i<argc;i++)
240: if(isdigit(argv[i][0])) {
241: if(max_age)
242: max_wall=atoi(argv[i]);
243: else
244: max_age=atoi(argv[i]); }
245: else {
246: printf("usage: SMMUTIL max_profile_age_in_days "
247: "max_wall_writing_age_in_days\n");
248: printf("\n");
249: printf("example: SMMUTIL 90 7\n");
250: exit(1); }
251:
252: if((file=open("SMM.IXB",O_RDWR|O_BINARY|O_CREAT|O_DENYNONE
253: ,S_IWRITE|S_IREAD))==-1
254: || (ixb_fp=fdopen(file,"r+b"))==NULL) {
255: printf("Error opening SMM.IXB\n");
256: exit(1); }
257:
258: if((file=open("SMM.DAB",O_RDWR|O_BINARY|O_DENYNONE))==-1
259: || (dab_fp=fdopen(file,"r+b"))==NULL) {
260: printf("Error opening SMM.DAB\n");
261: exit(1); }
262:
263: if((file=open("SMM.TMP",O_WRONLY|O_CREAT|O_TRUNC|O_BINARY|O_DENYALL
264: ,S_IWRITE|S_IREAD))==-1
265: || (tmp_fp=fdopen(file,"r+b"))==NULL) {
266: printf("Error opening SMM.TMP\n");
267: exit(1); }
268:
269: if((file=open("SMMUTIL.LOG",O_WRONLY|O_CREAT|O_APPEND|O_BINARY|O_DENYALL
270: ,S_IWRITE|S_IREAD))==-1
271: || (log=fdopen(file,"w+b"))==NULL) {
272: printf("Error opening SMMUTIL.LOG\n");
273: exit(1); }
274:
275: fprintf(stderr,"Reading profile data...");
276: rewind(dab_fp);
277: while(!feof(dab_fp)) {
278: if(!fread(&user,sizeof(user_t),1,dab_fp))
279: break;
280: if((ixb=REALLOC(ixb,sizeof(ixb_t)*(total_ixbs+1)))==NULL) {
281: printf("Malloc error\n");
282: exit(1); }
283: user.name[25]=0;
284: strupr(user.name);
285: ixb[total_ixbs].name=crc32(user.name);
286: user.system[25]=0;
287: strupr(user.system);
288: ixb[total_ixbs].system=crc32(user.system);
289: ixb[total_ixbs].updated=user.updated;
290: if(user.misc&USER_DELETED)
291: ixb[total_ixbs].number=0;
292: else
293: ixb[total_ixbs].number=user.number;
294: total_ixbs++; }
295: fprintf(stderr,"\n");
296:
297: now=time(NULL);
298: fprintf(stderr,"Creating new profile index and data files...");
299: chsize(fileno(ixb_fp),0);
300: rewind(ixb_fp);
301: rewind(tmp_fp);
302: for(l=0;l<total_ixbs;l++) {
303: fseek(dab_fp,l*sizeof(user_t),SEEK_SET);
304: if(!fread(&user,sizeof(user_t),1,dab_fp)) {
305: logprintf("%04lX Couldn't read user record",l);
306: continue; }
307:
308: /* Make sure all strings are NULL terminated */
309: user.name[25]=user.realname[25]=user.system[40]=user.birth[8]=0;
310: user.zipcode[10]=user.location[30]=0;
311: user.min_zipcode[10]=user.max_zipcode[10]=0;
312: for(i=0;i<5;i++)
313: user.note[i][50]=0;
314:
315: if(!ixb[l].number) {
316: logprintf("%04lX %5lu %-25s Deleted user"
317: ,l,user.number,user.system);
318: delphoto(user);
319: continue; }
320: if(ixb[l].number&0xffff0000UL) {
321: logprintf("%04lX %5lu %-25s Invalid user number"
322: ,l,ixb[l].number,user.system);
323: delphoto(user);
324: continue; }
325: if(max_age
326: && now>ixb[l].updated // Not in the future
327: && (now-ixb[l].updated)/(24UL*60UL*60UL)>max_age) {
328: logprintf("%04lX %5lu %-25s Not updated in %lu days"
329: ,l,user.number,user.system,(now-ixb[l].updated)/(24UL*60UL*60UL));
330: delphoto(user);
331: continue; }
332: for(m=l+1;m<total_ixbs;m++)
333: if(ixb[l].number
334: && ixb[l].number==ixb[m].number && ixb[l].system==ixb[m].system)
335: break;
336: if(m<total_ixbs) { /* Duplicate found! */
337: logprintf("%04lX %5lu %-25s Duplicate user"
338: ,l,user.number,user.system);
339: delphoto(user);
340: continue; }
341:
342: if(user.name[0]<SP || user.realname[0]<SP || user.system[0]<SP
343: || user.location[0]<SP || user.zipcode[0]<SP || user.birth[0]<SP) {
344: logprintf("%04lX %5lu %-25s Invalid user string"
345: ,l,user.number,user.system);
346: delphoto(user);
347: continue; }
348: if(!user.sex || !user.marital || !user.race || !user.hair || !user.eyes) {
349: logprintf("%04lX %5lu %-25s Null field"
350: ,l,user.number,user.system);
351: delphoto(user);
352: continue; }
353: if(user.sex=='M') {
354: if(user.pref_sex=='F')
355: male_straight++;
356: else if(user.pref_sex=='M')
357: male_gay++;
358: else
359: male_bi++; }
360: else if(user.sex=='F') {
361: if(user.pref_sex=='M')
362: female_straight++;
363: else if(user.pref_sex=='F')
364: female_gay++;
365: else
366: female_bi++; }
367: else {
368: logprintf("%04lX %5lu %-25s Invalid sex (%02X)"
369: ,l,user.number,user.system,user.sex);
370: delphoto(user);
371: continue; }
372: users++;
373: if(user.misc&USER_PHOTO)
374: photos++;
375: if(user.misc&USER_FROMSMB)
376: networked++;
377: age=getage(user.birth);
378: if(age<13) age12++;
379: else if(age<16) age15++;
380: else if(age<21) age20++;
381: else if(age<26) age25++;
382: else if(age<31) age30++;
383: else if(age<36) age35++;
384: else if(age<41) age40++;
385: else if(age<46) age45++;
386: else if(age<51) age50++;
387: else if(age<56) age55++;
388: else if(age<61) age60++;
389: else if(age<66) age65++;
390: else if(age<71) age70++;
391: else age71++;
392: switch(user.hair) {
393: case HAIR_BLONDE:
394: hair_blonde++;
395: break;
396: case HAIR_BROWN:
397: hair_brown++;
398: break;
399: case HAIR_RED:
400: hair_red++;
401: break;
402: case HAIR_BLACK:
403: hair_black++;
404: break;
405: case HAIR_GREY:
406: hair_grey++;
407: break;
408: default:
409: hair_other++;
410: break; }
411:
412: switch(user.eyes) {
413: case EYES_BLUE:
414: eyes_blue++;
415: break;
416: case EYES_BROWN:
417: eyes_brown++;
418: break;
419: case EYES_GREEN:
420: eyes_green++;
421: break;
422: case EYES_HAZEL:
423: eyes_hazel++;
424: break;
425: default:
426: eyes_other++;
427: break; }
428: switch(user.marital) {
429: case MARITAL_SINGLE:
430: marital_single++;
431: break;
432: case MARITAL_MARRIED:
433: marital_married++;
434: break;
435: case MARITAL_DIVORCED:
436: marital_divorced++;
437: break;
438: case MARITAL_WIDOWED:
439: marital_widowed++;
440: break;
441: default:
442: marital_other++;
443: break; }
444:
445: switch(user.race) {
446: case RACE_WHITE:
447: race_white++;
448: break;
449: case RACE_BLACK:
450: race_black++;
451: break;
452: case RACE_HISPANIC:
453: race_hispanic++;
454: break;
455: case RACE_ASIAN:
456: race_asian++;
457: break;
458: case RACE_AMERINDIAN:
459: race_amerindian++;
460: break;
461: case RACE_MIDEASTERN:
462: race_mideastern++;
463: break;
464: default:
465: race_other++;
466: break; }
467:
468: if((!strncmp(user.birth,"03",2) && atoi(user.birth+3)>=21)
469: || (!strncmp(user.birth,"04",2) && atoi(user.birth+3)<=19))
470: zodiac_aries++;
471: else if((!strncmp(user.birth,"04",2) && atoi(user.birth+3)>=20)
472: || (!strncmp(user.birth,"05",2) && atoi(user.birth+3)<=20))
473: zodiac_taurus++;
474: else if((!strncmp(user.birth,"05",2) && atoi(user.birth+3)>=21)
475: || (!strncmp(user.birth,"06",2) && atoi(user.birth+3)<=20))
476: zodiac_gemini++;
477: else if((!strncmp(user.birth,"06",2) && atoi(user.birth+3)>=21)
478: || (!strncmp(user.birth,"07",2) && atoi(user.birth+3)<=22))
479: zodiac_cancer++;
480: else if((!strncmp(user.birth,"07",2) && atoi(user.birth+3)>=23)
481: || (!strncmp(user.birth,"08",2) && atoi(user.birth+3)<=22))
482: zodiac_leo++;
483: else if((!strncmp(user.birth,"08",2) && atoi(user.birth+3)>=23)
484: || (!strncmp(user.birth,"09",2) && atoi(user.birth+3)<=22))
485: zodiac_virgo++;
486: else if((!strncmp(user.birth,"09",2) && atoi(user.birth+3)>=23)
487: || (!strncmp(user.birth,"10",2) && atoi(user.birth+3)<=22))
488: zodiac_libra++;
489: else if((!strncmp(user.birth,"10",2) && atoi(user.birth+3)>=23)
490: || (!strncmp(user.birth,"11",2) && atoi(user.birth+3)<=21))
491: zodiac_scorpio++;
492: else if((!strncmp(user.birth,"11",2) && atoi(user.birth+3)>=22)
493: || (!strncmp(user.birth,"12",2) && atoi(user.birth+3)<=21))
494: zodiac_sagittarius++;
495: else if((!strncmp(user.birth,"12",2) && atoi(user.birth+3)>=22)
496: || (!strncmp(user.birth,"01",2) && atoi(user.birth+3)<=19))
497: zodiac_capricorn++;
498: else if((!strncmp(user.birth,"01",2) && atoi(user.birth+3)>=20)
499: || (!strncmp(user.birth,"02",2) && atoi(user.birth+3)<=18))
500: zodiac_aquarius++;
501: else if((!strncmp(user.birth,"02",2) && atoi(user.birth+3)>=19)
502: || (!strncmp(user.birth,"03",2) && atoi(user.birth+3)<=20))
503: zodiac_pisces++;
504:
505: fwrite(&ixb[l],sizeof(ixb_t),1,ixb_fp);
506: fwrite(&user,sizeof(user_t),1,tmp_fp);
507: }
508: fprintf(stderr,"\n");
509: fcloseall();
510: remove("SMM.DAB");
511: rename("SMM.TMP","SMM.DAB");
512:
513: printf("Synchronet Match Maker Statistics\n");
514: printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
515: printf("\n");
516: printf("%-25s : %lu\n","Total",users);
517: printf("%-25s : %lu\n","Photos",photos);
518: printf("%-25s : %lu\n","Networked",networked);
519: // if(male_straight)
520: printf("%-25s (%4.1f%%) : %lu\n","Sex: male (hetero)"
521: ,(((float)male_straight/users)*100.0),male_straight);
522: // if(male_gay)
523: printf("%-25s (%4.1f%%) : %lu\n","Sex: male (gay)"
524: ,(((float)male_gay/users)*100.0),male_gay);
525: // if(male_bi)
526: printf("%-25s (%4.1f%%) : %lu\n","Sex: male (bi)"
527: ,(((float)male_bi/users)*100.0),male_bi);
528: // if(female_straight)
529: printf("%-25s (%4.1f%%) : %lu\n","Sex: female (hetero)"
530: ,(((float)female_straight/users)*100.0),female_straight);
531: // if(female_gay)
532: printf("%-25s (%4.1f%%) : %lu\n","Sex: female (gay)"
533: ,(((float)female_gay/users)*100.0),female_gay);
534: // if(female_bi)
535: printf("%-25s (%4.1f%%) : %lu\n","Sex: female (bi)"
536: ,(((float)female_bi/users)*100.0),female_bi);
537: // if(age12)
538: printf("%-25s (%4.1f%%) : %lu\n","Age: 12 and younger"
539: ,(((float)age12/users)*100.0),age12);
540: // if(age15)
541: printf("%-25s (%4.1f%%) : %lu\n","Age: 13 to 15 years old"
542: ,(((float)age15/users)*100.0),age15);
543: // if(age20)
544: printf("%-25s (%4.1f%%) : %lu\n","Age: 16 to 20 years old"
545: ,(((float)age20/users)*100.0),age20);
546: // if(age25)
547: printf("%-25s (%4.1f%%) : %lu\n","Age: 21 to 25 years old"
548: ,(((float)age25/users)*100.0),age25);
549: // if(age30)
550: printf("%-25s (%4.1f%%) : %lu\n","Age: 26 to 30 years old"
551: ,(((float)age30/users)*100.0),age30);
552: // if(age35)
553: printf("%-25s (%4.1f%%) : %lu\n","Age: 31 to 35 years old"
554: ,(((float)age35/users)*100.0),age35);
555: // if(age40)
556: printf("%-25s (%4.1f%%) : %lu\n","Age: 36 to 40 years old"
557: ,(((float)age40/users)*100.0),age40);
558: // if(age45)
559: printf("%-25s (%4.1f%%) : %lu\n","Age: 41 to 45 years old"
560: ,(((float)age45/users)*100.0),age45);
561: // if(age50)
562: printf("%-25s (%4.1f%%) : %lu\n","Age: 46 to 50 years old"
563: ,(((float)age50/users)*100.0),age50);
564: // if(age55)
565: printf("%-25s (%4.1f%%) : %lu\n","Age: 51 to 55 years old"
566: ,(((float)age55/users)*100.0),age55);
567: // if(age60)
568: printf("%-25s (%4.1f%%) : %lu\n","Age: 56 to 60 years old"
569: ,(((float)age60/users)*100.0),age60);
570: // if(age65)
571: printf("%-25s (%4.1f%%) : %lu\n","Age: 61 to 65 years old"
572: ,(((float)age65/users)*100.0),age65);
573: // if(age70)
574: printf("%-25s (%4.1f%%) : %lu\n","Age: 66 to 70 years old"
575: ,(((float)age70/users)*100.0),age70);
576: // if(age71)
577: printf("%-25s (%4.1f%%) : %lu\n","Age: 71 and older"
578: ,(((float)age71/users)*100.0),age71);
579: // if(hair_blonde)
580: printf("%-25s (%4.1f%%) : %lu\n","Hair: blonde"
581: ,(((float)hair_blonde/users)*100.0),hair_blonde);
582: // if(hair_brown)
583: printf("%-25s (%4.1f%%) : %lu\n","Hair: brown"
584: ,(((float)hair_brown/users)*100.0),hair_brown);
585: // if(hair_black)
586: printf("%-25s (%4.1f%%) : %lu\n","Hair: black"
587: ,(((float)hair_black/users)*100.0),hair_black);
588: // if(hair_red)
589: printf("%-25s (%4.1f%%) : %lu\n","Hair: red"
590: ,(((float)hair_red/users)*100.0),hair_red);
591: // if(hair_grey)
592: printf("%-25s (%4.1f%%) : %lu\n","Hair: grey"
593: ,(((float)hair_grey/users)*100.0),hair_grey);
594: // if(hair_other)
595: printf("%-25s (%4.1f%%) : %lu\n","Hair: other"
596: ,(((float)hair_other/users)*100.0),hair_other);
597: // if(eyes_blue)
598: printf("%-25s (%4.1f%%) : %lu\n","Eyes: blue"
599: ,(((float)eyes_blue/users)*100.0),eyes_blue);
600: // if(eyes_brown)
601: printf("%-25s (%4.1f%%) : %lu\n","Eyes: brown"
602: ,(((float)eyes_brown/users)*100.0),eyes_brown);
603: // if(eyes_green)
604: printf("%-25s (%4.1f%%) : %lu\n","Eyes: green"
605: ,(((float)eyes_green/users)*100.0),eyes_green);
606: // if(eyes_hazel)
607: printf("%-25s (%4.1f%%) : %lu\n","Eyes: hazel"
608: ,(((float)eyes_hazel/users)*100.0),eyes_hazel);
609: // if(eyes_other)
610: printf("%-25s (%4.1f%%) : %lu\n","Eyes: other"
611: ,(((float)eyes_other/users)*100.0),eyes_other);
612: // if(race_white)
613: printf("%-25s (%4.1f%%) : %lu\n","Race: white"
614: ,(((float)race_white/users)*100.0),race_white);
615: // if(race_black)
616: printf("%-25s (%4.1f%%) : %lu\n","Race: black"
617: ,(((float)race_black/users)*100.0),race_black);
618: // if(race_asian)
619: printf("%-25s (%4.1f%%) : %lu\n","Race: asian"
620: ,(((float)race_asian/users)*100.0),race_asian);
621: // if(race_amerindian)
622: printf("%-25s (%4.1f%%) : %lu\n","Race: amerindian"
623: ,(((float)race_amerindian/users)*100.0),race_amerindian);
624: // if(race_mideastern)
625: printf("%-25s (%4.1f%%) : %lu\n","Race: mideastern"
626: ,(((float)race_mideastern/users)*100.0),race_mideastern);
627: // if(race_hispanic)
628: printf("%-25s (%4.1f%%) : %lu\n","Race: hispanic"
629: ,(((float)race_hispanic/users)*100.0),race_hispanic);
630: // if(race_other)
631: printf("%-25s (%4.1f%%) : %lu\n","Race: other"
632: ,(((float)race_other/users)*100.0),race_other);
633: // if(marital_single)
634: printf("%-25s (%4.1f%%) : %lu\n","Marital: single"
635: ,(((float)marital_single/users)*100.0),marital_single);
636: // if(marital_married)
637: printf("%-25s (%4.1f%%) : %lu\n","Marital: married"
638: ,(((float)marital_married/users)*100.0),marital_married);
639: // if(marital_divorced)
640: printf("%-25s (%4.1f%%) : %lu\n","Marital: divorced"
641: ,(((float)marital_divorced/users)*100.0),marital_divorced);
642: // if(marital_widowed)
643: printf("%-25s (%4.1f%%) : %lu\n","Marital: widowed"
644: ,(((float)marital_widowed/users)*100.0),marital_widowed);
645: // if(marital_other)
646: printf("%-25s (%4.1f%%) : %lu\n","Marital: other"
647: ,(((float)marital_other/users)*100.0),marital_other);
648: // if(zodiac_aries)
649: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: aries"
650: ,(((float)zodiac_aries/users)*100.0),zodiac_aries);
651: // if(zodiac_taurus)
652: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: taurus"
653: ,(((float)zodiac_taurus/users)*100.0),zodiac_taurus);
654: // if(zodiac_gemini)
655: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: gemini"
656: ,(((float)zodiac_gemini/users)*100.0),zodiac_gemini);
657: // if(zodiac_cancer)
658: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: cancer"
659: ,(((float)zodiac_cancer/users)*100.0),zodiac_cancer);
660: // if(zodiac_leo)
661: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: leo"
662: ,(((float)zodiac_leo/users)*100.0),zodiac_leo);
663: // if(zodiac_virgo)
664: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: virgo"
665: ,(((float)zodiac_virgo/users)*100.0),zodiac_virgo);
666: // if(zodiac_libra)
667: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: libra"
668: ,(((float)zodiac_libra/users)*100.0),zodiac_libra);
669: // if(zodiac_scorpio)
670: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: scorpio"
671: ,(((float)zodiac_scorpio/users)*100.0),zodiac_scorpio);
672: // if(zodiac_sagittarius)
673: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: sagittarius"
674: ,(((float)zodiac_sagittarius/users)*100.0),zodiac_sagittarius);
675: // if(zodiac_capricorn)
676: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: capricorn"
677: ,(((float)zodiac_capricorn/users)*100.0),zodiac_capricorn);
678: // if(zodiac_aquarius)
679: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: aquarius"
680: ,(((float)zodiac_aquarius/users)*100.0),zodiac_aquarius);
681: // if(zodiac_pisces)
682: printf("%-25s (%4.1f%%) : %lu\n","Zodiac: pisces"
683: ,(((float)zodiac_pisces/users)*100.0),zodiac_pisces);
684:
685: if(!max_wall)
686: return(0);
687:
688: if((file=open("WALL.DAB",O_RDWR|O_BINARY|O_DENYNONE))==-1
689: || (dab_fp=fdopen(file,"r+b"))==NULL) {
690: printf("Error opening WALL.DAB\n");
691: exit(1); }
692:
693: if((file=open("WALL.TMP",O_WRONLY|O_CREAT|O_TRUNC|O_BINARY|O_DENYALL
694: ,S_IWRITE|S_IREAD))==-1
695: || (tmp_fp=fdopen(file,"r+b"))==NULL) {
696: printf("Error opening WALL.TMP\n");
697: exit(1); }
698:
699: fprintf(stderr,"Reading wall data...");
700: rewind(dab_fp);
701: while(!feof(dab_fp)) {
702: if(!fread(&wall,sizeof(wall_t),1,dab_fp))
703: break;
704: if((now-wall.imported)/(24UL*60UL*60UL)<=max_wall)
705: fwrite(&wall,sizeof(wall_t),1,tmp_fp); }
706:
707: fprintf(stderr,"\n");
708: fcloseall();
709: remove("WALL.DAB");
710: rename("WALL.TMP","WALL.DAB");
711:
712: return(0);
713: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.