[digraphanalysis-cvs] digraphanalysis/src main.c,JBREKER
Status: Planning
Brought to you by:
jbreker
|
From: Jeff B. <jb...@us...> - 2005-04-07 03:02:57
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31439 Modified Files: Tag: JBREKER main.c Log Message: Finish up LIST_* macros. compiles Index: main.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/main.c,v retrieving revision 1.2.2.7 retrieving revision 1.2.2.8 diff -C2 -d -r1.2.2.7 -r1.2.2.8 *** main.c 4 Apr 2005 16:14:16 -0000 1.2.2.7 --- main.c 7 Apr 2005 03:02:47 -0000 1.2.2.8 *************** *** 84,88 **** * Return -1 on error */ ! int do_analysis(list_t *keys1, char *outputdir) { char *dir; --- 84,88 ---- * Return -1 on error */ ! int do_analysis(struct list_t *keys1, char *outputdir) { char *dir; *************** *** 90,95 **** float last_msd; int i, j, k; ! list_t *keys2, *tmplist1, *tmplist2, *wots, *nnlist, *nslist, *snlist, *sslist; ! node_t *iter1, *iter2; pgpkey_t *key; struct stat *sb; --- 90,95 ---- float last_msd; int i, j, k; ! struct list_t *keys2, *tmplist1, *tmplist2, *wots, *nnlist, *nslist, *snlist, *sslist; ! struct node_t *iter1, *iter2; pgpkey_t *key; struct stat *sb; *************** *** 110,120 **** /* Iterate through the list of keys, analyzing the key and outputting its file */ ! iter1 = keys1->head; while(iter1 != NULL) { ! nnlist = list_new(&pgpkey_compare); ! nslist = list_new(&pgpkey_compare); ! snlist = list_new(&pgpkey_compare); ! sslist = list_new(&pgpkey_compare); analyze_key(iter1->object, keys1, nnlist, nslist, snlist, sslist); output_file(iter1->object, nnlist, nslist, snlist, sslist); --- 110,120 ---- /* Iterate through the list of keys, analyzing the key and outputting its file */ ! iter1 = LIST_FIRST(keys1); while(iter1 != NULL) { ! nnlist = list_new(); ! nslist = list_new(); ! snlist = list_new(); ! sslist = list_new(); analyze_key(iter1->object, keys1, nnlist, nslist, snlist, sslist); output_file(iter1->object, nnlist, nslist, snlist, sslist); *************** *** 123,163 **** list_free(snlist); list_free(sslist); ! iter1 = iter1->next; } iter1 = NULL; /* Pull apart the list of keys and seperate them into lists where all the keys can reach one another */ ! keys2 = list_duplicate(keys1); wots = list_new(&wot_compare); ! while(keys2->head != NULL) { if(((tmplist1 = list_new(&pgpkey_compare_msd)) == NULL) || ((tmplist2 = list_new(&pgpkey_compare_msd)) == NULL) || ! (list_add_object(tmplist1, keys2->head->object) == -1)) return -1; ! list_remove(keys2, keys2->head->object); ! while(tmplist1->size != tmplist2->size) { list_free(tmplist2); ! if((tmplist2 = list_duplicate(tmplist1)) == NULL) return -1; ! iter1 = tmplist2->head; while(iter1 != NULL) { ! iter2 = ((pgpkey_t *) iter1->object)->signatures->head; while(iter2 != NULL) { if(pgpkey_distance(iter2->object, iter1->object) != 0) { ! if(list_add_object(tmplist1, iter2->object) == -1) return -1; ! list_remove(keys2, iter2->object); } ! iter2 = iter2->next; } ! iter1 = iter1->next; } } ! if(list_add_object(wots, tmplist1) == -1) return -1; list_free(tmplist2); --- 123,163 ---- list_free(snlist); list_free(sslist); ! iter1 = LIST_NEXT(iter1, entries); } iter1 = NULL; /* Pull apart the list of keys and seperate them into lists where all the keys can reach one another */ ! keys2 = list_duplicate(keys1, &pgpkey_compare); wots = list_new(&wot_compare); ! while(LIST_EMPTY(keys2)) { if(((tmplist1 = list_new(&pgpkey_compare_msd)) == NULL) || ((tmplist2 = list_new(&pgpkey_compare_msd)) == NULL) || ! (list_add_object(tmplist1, LIST_FIRST(keys2)->object, &pgpkey_compare) == -1)) return -1; ! list_remove(keys2, LIST_FIRST(keys2)->object, &pgpkey_compare); ! while(list_size(tmplist1) != list_size(tmplist2)) { list_free(tmplist2); ! if((tmplist2 = list_duplicate(tmplist1, &pgpkey_compare)) == NULL) return -1; ! iter1 = LIST_FIRST(tmplist2); while(iter1 != NULL) { ! iter2 = LIST_FIRST(((pgpkey_t *) iter1->object)->signatures); while(iter2 != NULL) { if(pgpkey_distance(iter2->object, iter1->object) != 0) { ! if(list_add_object(tmplist1, iter2->object, &pgpkey_compare) == -1) return -1; ! list_remove(keys2, iter2->object, &pgpkey_compare); } ! iter2 = LIST_NEXT(iter2, entries); } ! iter1 = LIST_NEXT(iter1, entries); } } ! if(list_add_object(wots, tmplist1, &pgpkey_compare) == -1) return -1; list_free(tmplist2); *************** *** 173,189 **** filep = fopen("report.html", "w"); fprintf(filep, "<html><body>\n"); ! while(wots->head != NULL) { ! iter1 = wots->head; /* If the size of this web of trust is 1 then the remaining are of size 1, so group them all together */ ! if(((list_t *) iter1->object)->size == 1) break; fprintf(filep, "<div class=\"wottable\"><div class=\"wottable_title\">Web Of Trust %d</div>\n", i); fprintf(filep, "<table><tr><td>Rank</td><td>KeyID</td><td>Name</td><td>MSD</td></tr>\n"); ! tmplist1 = (list_t *) iter1->object; ! while(tmplist1->head != NULL) { ! iter2 = tmplist1->head; key = (pgpkey_t *) iter2->object; if(key->msd != last_msd) --- 173,189 ---- filep = fopen("report.html", "w"); fprintf(filep, "<html><body>\n"); ! while(LIST_FIRST(wots) != NULL) { ! iter1 = LIST_FIRST(wots); /* If the size of this web of trust is 1 then the remaining are of size 1, so group them all together */ ! if(list_size(((struct list_t *) iter1->object)) == 1) break; fprintf(filep, "<div class=\"wottable\"><div class=\"wottable_title\">Web Of Trust %d</div>\n", i); fprintf(filep, "<table><tr><td>Rank</td><td>KeyID</td><td>Name</td><td>MSD</td></tr>\n"); ! tmplist1 = (struct list_t *) iter1->object; ! while(LIST_FIRST(tmplist1) != NULL) { ! iter2 = LIST_FIRST(tmplist1); key = (pgpkey_t *) iter2->object; if(key->msd != last_msd) *************** *** 197,206 **** free(dir); dir = NULL; ! list_remove(tmplist1, key); key = NULL; } fprintf(filep, "</table></div>\n"); tmplist1 = iter1->object; ! list_remove(wots, tmplist1); list_free(tmplist1); tmplist1 = NULL; --- 197,206 ---- free(dir); dir = NULL; ! list_remove(tmplist1, key, &pgpkey_compare); key = NULL; } fprintf(filep, "</table></div>\n"); tmplist1 = iter1->object; ! list_remove(wots, tmplist1, &pgpkey_compare); list_free(tmplist1); tmplist1 = NULL; *************** *** 218,222 **** while(iter1 != NULL) { ! iter2 = ((list_t *) iter1->object)->head; key = (pgpkey_t *) iter2->object; dir = (char *) malloc(3); --- 218,222 ---- while(iter1 != NULL) { ! iter2 = LIST_FIRST(((struct list_t *) iter1->object)); key = (pgpkey_t *) iter2->object; dir = (char *) malloc(3); *************** *** 225,229 **** fprintf(filep, "<tr><td><a href=\"%s/%s\">%s</a></td><td>%s</td></tr>\n", dir, key->keyid + 8, key->keyid + 8, key->name); free(dir); ! iter1 = iter1->next; } fprintf(filep, "</table></div>\n"); --- 225,229 ---- fprintf(filep, "<tr><td><a href=\"%s/%s\">%s</a></td><td>%s</td></tr>\n", dir, key->keyid + 8, key->keyid + 8, key->name); free(dir); ! iter1 = LIST_NEXT(iter1, entries); } fprintf(filep, "</table></div>\n"); *************** *** 408,412 **** extern char *__progname; ! fprintf(stderr, "usage: %s [-k pubring.gpg] -o output_directory\n", __progname); return; } --- 408,412 ---- extern char *__progname; ! fprintf(stderr, "usage: %s -o output_directory\n", __progname); return; } |