digraphanalysis-cvs Mailing List for The Digraph Analysis Project (Page 4)
Status: Planning
Brought to you by:
jbreker
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(10) |
Apr
(31) |
May
(27) |
Jun
(16) |
Jul
(10) |
Aug
|
Sep
(27) |
Oct
|
Nov
|
Dec
|
|---|
|
From: Jeff B. <jb...@us...> - 2005-05-11 22:52:08
|
Update of /cvsroot/digraphanalysis/digraphanalysis/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13103 Removed Files: Makefile doxygen.cfg Log Message: remove --- Makefile DELETED --- --- doxygen.cfg DELETED --- |
|
From: Jeff B. <jb...@us...> - 2005-05-11 20:16:00
|
Update of /cvsroot/digraphanalysis/digraphanalysis In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12434 Added Files: BSDmakefile Log Message: add bsd makefile system --- NEW FILE: BSDmakefile --- # $Id: BSDmakefile,v 1.1 2005/05/11 20:15:49 jbreker Exp $ # # Copyright (C) 2005 Jeff Breker <jb...@sy...> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. SUBDIR= src \ utils .include <bsd.subdir.mk> |
|
From: Jeff B. <jb...@us...> - 2005-05-11 20:15:59
|
Update of /cvsroot/digraphanalysis/digraphanalysis/utils/gpg2dot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12434/utils/gpg2dot Added Files: BSDmakefile gpg2dot.1 Log Message: add bsd makefile system --- NEW FILE: gpg2dot.1 --- --- NEW FILE: BSDmakefile --- # $Id: BSDmakefile,v 1.1 2005/05/11 20:15:51 jbreker Exp $ # # Copyright (C) 2005 Jeff Breker <jb...@sy...> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PROG= gpg2dot .include <bsd.prog.mk> |
|
From: Jeff B. <jb...@us...> - 2005-05-11 20:15:58
|
Update of /cvsroot/digraphanalysis/digraphanalysis/utils/gpg2digraph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12434/utils/gpg2digraph Added Files: BSDmakefile gpg2digraph.1 Log Message: add bsd makefile system --- NEW FILE: BSDmakefile --- # $Id: BSDmakefile,v 1.1 2005/05/11 20:15:50 jbreker Exp $ # # Copyright (C) 2005 Jeff Breker <jb...@sy...> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PROG= gpg2digraph .include <bsd.prog.mk> --- NEW FILE: gpg2digraph.1 --- |
|
From: Jeff B. <jb...@us...> - 2005-05-11 20:15:58
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12434/src Added Files: digraphanalysis.1 Log Message: add bsd makefile system --- NEW FILE: digraphanalysis.1 --- |
|
From: Jeff B. <jb...@us...> - 2005-04-27 16:06:38
|
Update of /cvsroot/digraphanalysis/digraphanalysis/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23837/doc Added Files: Makefile doxygen.cfg Log Message: documentation --- NEW FILE: Makefile --- # $Id: Makefile,v 1.1 2005/04/27 16:05:53 jbreker Exp $ # # Copyright (C) 2005 Jeff Breker <jb...@sy...> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. all: html html: doxygen.cfg doxygen doxygen.cfg clean: rm -rf html --- NEW FILE: doxygen.cfg --- # Doxyfile 1.4.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. [...1179 lines suppressed...] # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO |
|
From: Jeff B. <jb...@us...> - 2005-04-27 16:05:42
|
Update of /cvsroot/digraphanalysis/digraphanalysis/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23547/doc Log Message: Directory /cvsroot/digraphanalysis/digraphanalysis/doc added to the repository |
|
From: Jeff B. <jb...@us...> - 2005-04-27 02:18:39
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28992 Modified Files: main.c main.h Log Message: small changes Index: main.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/main.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** main.c 26 Apr 2005 03:49:27 -0000 1.6 --- main.c 27 Apr 2005 02:18:26 -0000 1.7 *************** *** 33,48 **** #include "node.h" ! void create_new_directory(char *dirname) { ! struct stat *sb; ! ! sb = (struct stat *) malloc(sizeof(struct stat)); ! stat(".", sb); ! mkdir(dirname, sb->st_mode); free(sb); } --- 33,56 ---- #include "node.h" ! int create_new_directory(char *dirname) { ! int rtn; ! struct stat *sb; ! rtn = 0; ! sb = NULL; ! /* Allocate memory for sb */ ! if(((sb = (struct stat *) malloc(sizeof(struct stat))) == NULL) || ! /* Stat the current working directory for mode value */ ! (stat(".", sb) == -1) || ! /* Make the new directory with the cwd's mode value */ ! (mkdir(dirname, sb->st_mode) == -1)) ! rtn = -1; free(sb); + + return rtn; } *************** *** 75,79 **** LIST_FOREACH(node_link, graph->node_list, list) ! output_file(node_link->node, graph->alias_list, graph->node_list); return; --- 83,87 ---- LIST_FOREACH(node_link, graph->node_list, list) ! output_file(node_link->node, graph); return; *************** *** 83,98 **** analysis_main_directory(char *outputdir) { ! char *dir; ! struct stat *sb; /* Create and enter the output directory */ ! if (((sb = (struct stat *) malloc(sizeof(struct stat))) == NULL) || ! ((dir = dirname(outputdir)) == NULL) || ! (stat(dir, sb) == -1) || ! (mkdir(outputdir, sb->st_mode) == -1) || (chdir(outputdir) == -1)) ! return -1; ! return 0; } --- 91,110 ---- analysis_main_directory(char *outputdir) { ! char *dir; ! int rtn; ! ! dir = NULL; ! rtn = 0; /* Create and enter the output directory */ ! if(((dir = dirname(outputdir)) == NULL) || ! (chdir(dir) == -1) || ! (create_new_directory(outputdir) == -1) || (chdir(outputdir) == -1)) ! rtn = -1; ! free(dir); ! ! return rtn; } *************** *** 284,290 **** */ void ! output_file(struct node *node, ! struct aliaslist *alias_list, ! struct nodelist *node_list) { struct nodelink *node_link; --- 296,300 ---- */ void ! output_file(struct node *node, struct graph *graph) { struct nodelink *node_link; *************** *** 314,318 **** nodes_we_link_to = nodelist_new(); ! LIST_FOREACH(node_link, node_list, list) if(nodelist_find(((struct node *) node_link->node)->links, node) != NULL) nodelist_add(nodes_we_link_to, node_link->node); --- 324,328 ---- nodes_we_link_to = nodelist_new(); ! LIST_FOREACH(node_link, graph->node_list, list) if(nodelist_find(((struct node *) node_link->node)->links, node) != NULL) nodelist_add(nodes_we_link_to, node_link->node); *************** *** 324,328 **** fprintf(filep, "MSD: %.4f\n\n", node->msd); ! tmp_nodelist = nodelist_subtract(node_list, nodelist_union(node->links, nodes_we_link_to)); fprintf(filep, "This key has not signed, nor been signed by:\n"); nodelist_print(filep, tmp_nodelist); --- 334,338 ---- fprintf(filep, "MSD: %.4f\n\n", node->msd); ! tmp_nodelist = nodelist_subtract(graph->node_list, nodelist_union(node->links, nodes_we_link_to)); fprintf(filep, "This key has not signed, nor been signed by:\n"); nodelist_print(filep, tmp_nodelist); Index: main.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/main.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.h 17 Apr 2005 03:05:58 -0000 1.3 --- main.h 27 Apr 2005 02:18:26 -0000 1.4 *************** *** 32,36 **** int do_analysis(struct graph *, char *); char *get_field(void); ! void output_file(struct node *, struct aliaslist *, struct nodelist *); void parse_input(struct graph *); void print_graph(FILE *, struct nodelist *); --- 32,36 ---- int do_analysis(struct graph *, char *); char *get_field(void); ! void output_file(struct node *, struct graph *); void parse_input(struct graph *); void print_graph(FILE *, struct nodelist *); |
|
From: Jeff B. <jb...@us...> - 2005-04-26 03:49:37
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19894/src Modified Files: main.c Added Files: BSDmakefile Log Message: outputs gpg stuff now --- NEW FILE: BSDmakefile --- # $Id: BSDmakefile,v 1.1 2005/04/26 03:49:27 jbreker Exp $ # # Copyright (C) 2005 Jeff Breker <jb...@sy...> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PROG= digraphanalysis SRCS= alias.c \ graph.c \ main.c \ node.c .include <bsd.prog.mk> Index: main.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/main.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** main.c 18 Apr 2005 14:53:29 -0000 1.5 --- main.c 26 Apr 2005 03:49:27 -0000 1.6 *************** *** 243,250 **** if(string != NULL) - { fgets(string, size, stdin); - *(string + size) = '\0'; - } return string; --- 243,247 ---- *************** *** 376,380 **** { if(((c = getchar()) != ':') && (c != EOF)) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); if(c == EOF) break; --- 373,377 ---- { if(((c = getchar()) != ':') && (c != EOF)) ! errx(EX_DATAERR, "1: Invalid character, %c (ASCII: %d), encountered!\n", c, c); if(c == EOF) break; *************** *** 386,390 **** { if(((c = getchar()) != ':') && (c != EOF)) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); if(c == EOF) break; --- 383,387 ---- { if(((c = getchar()) != ':') && (c != EOF)) ! errx(EX_DATAERR, "2: Invalid character, %c (ASCII: %d), encountered!\n", c, c); if(c == EOF) break; *************** *** 396,400 **** { if(((c = getchar()) != ':') && (c != EOF)) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); if(c == EOF) break; --- 393,397 ---- { if(((c = getchar()) != ':') && (c != EOF)) ! errx(EX_DATAERR, "3: Invalid character, %c (ASCII: %d), encountered!\n", c, c); if(c == EOF) break; *************** *** 406,410 **** } if(((c = getchar()) != '\n') && (c != EOF)) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); switch (type) --- 403,407 ---- } if(((c = getchar()) != '\n') && (c != EOF)) ! errx(EX_DATAERR, "4: Invalid character, %c (ASCII: %d), encountered!\n", c, c); switch (type) *************** *** 450,454 **** if(c != EOF) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", type, type); return; --- 447,451 ---- if(c != EOF) ! errx(EX_DATAERR, "5: Invalid character, %c (ASCII: %d), encountered!\n", type, type); return; |
|
From: Jeff B. <jb...@us...> - 2005-04-26 03:49:37
|
Update of /cvsroot/digraphanalysis/digraphanalysis/utils/gpg2digraph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19894/utils/gpg2digraph Modified Files: gpg2digraph.c Log Message: outputs gpg stuff now Index: gpg2digraph.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/utils/gpg2digraph/gpg2digraph.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gpg2digraph.c 18 Apr 2005 14:54:49 -0000 1.3 --- gpg2digraph.c 26 Apr 2005 03:49:28 -0000 1.4 *************** *** 25,29 **** char *do_pub(void); void do_sig(char *); ! char *do_uid(void); unsigned int encode(char *); void func001(unsigned int); --- 25,29 ---- char *do_pub(void); void do_sig(char *); ! char *do_uid(char *); unsigned int encode(char *); void func001(unsigned int); *************** *** 94,98 **** name = get_name(); fprintf(stdout, "n:%u:%s\n", strlen(keyid), keyid); ! fprintf(stdout, "a:%u:%s:%u:%s:%u:%s", strlen(keyid), keyid, strlen(keyid), keyid, strlen(name), name); while (((c = fgetc(stdin)) != '\n') && (feof(stdin) == 0)) if (ferror(stdin)) --- 94,98 ---- name = get_name(); fprintf(stdout, "n:%u:%s\n", strlen(keyid), keyid); ! fprintf(stdout, "a:%u:%s:%u:%s:%u:%s\n", strlen(keyid), keyid, strlen(keyid), keyid, strlen(name), name); while (((c = fgetc(stdin)) != '\n') && (feof(stdin) == 0)) if (ferror(stdin)) *************** *** 242,246 **** break; case (117105100): /* uid */ ! keyid_p = do_uid(); break; default: --- 242,246 ---- break; case (117105100): /* uid */ ! keyid_p = do_uid(keyid_p); break; default: *************** *** 256,260 **** break; case (117105100): /* uid */ ! keyid_p = do_uid(); while (feof(stdin) == 0) { --- 256,260 ---- break; case (117105100): /* uid */ ! keyid_p = do_uid(keyid_p); while (feof(stdin) == 0) { *************** *** 271,275 **** break; case (117105100): /* uid */ ! keyid_p = do_uid(); break; default: --- 271,275 ---- break; case (117105100): /* uid */ ! keyid_p = do_uid(keyid_p); break; default: |
|
From: Jeff B. <jb...@us...> - 2005-04-25 15:07:25
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13771 Modified Files: node.c Log Message: finish implementing functions Index: node.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** node.c 25 Apr 2005 04:53:14 -0000 1.9 --- node.c 25 Apr 2005 15:07:16 -0000 1.10 *************** *** 267,271 **** nodelist_subtract(struct nodelist *node_list1, struct nodelist *node_list2) { ! return NULL; } --- 267,279 ---- nodelist_subtract(struct nodelist *node_list1, struct nodelist *node_list2) { ! struct nodelink *node_link; ! struct nodelist *node_list; ! ! node_list = nodelist_duplicate(node_list1); ! ! LIST_FOREACH(node_link, node_list2, list) ! nodelist_remove(node_list, node_link->node); ! ! return node_list; } *************** *** 273,277 **** nodelist_union(struct nodelist *node_list1, struct nodelist *node_list2) { ! return NULL; } --- 281,290 ---- nodelist_union(struct nodelist *node_list1, struct nodelist *node_list2) { ! struct nodelist *node_list; ! ! node_list = nodelist_duplicate(node_list1); ! nodelist_merge(node_list, node_list2); ! ! return node_list; } |
|
From: Jeff B. <jb...@us...> - 2005-04-25 04:53:22
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10101 Modified Files: node.c node.h Log Message: woops commited when it didn't compile... Index: node.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** node.h 21 Apr 2005 18:44:42 -0000 1.6 --- node.h 25 Apr 2005 04:53:14 -0000 1.7 *************** *** 38,47 **** --- 38,51 ---- }; + int node_compare(struct node *, struct node *); + int node_compare_msd(struct node *, struct node *); unsigned int node_distance(struct node *, struct node *); void node_free(struct node *); struct node *node_new(char *); + void node_print(FILE *, struct node *); struct node *nodelist_add(struct nodelist *, struct node *); struct node *nodelist_add_msd(struct nodelist *, struct node *); + int nodelist_compare(struct nodelist *, struct nodelist *); struct nodelist *nodelist_duplicate(struct nodelist *); struct node *nodelist_find(struct nodelist *, struct node *); Index: node.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** node.c 25 Apr 2005 04:40:03 -0000 1.8 --- node.c 25 Apr 2005 04:53:14 -0000 1.9 *************** *** 49,52 **** --- 49,60 ---- } + void + node_print(FILE *filep, struct node *node) + { + fprintf(filep, "%s\n", node->uid); + + return; + } + struct node * nodelist_add(struct nodelist *node_list, struct node *node) *************** *** 222,225 **** --- 230,234 ---- { int i; + struct node *tmp_node; struct nodelink *node_link; *************** *** 258,261 **** --- 267,271 ---- nodelist_subtract(struct nodelist *node_list1, struct nodelist *node_list2) { + return NULL; } *************** *** 263,266 **** --- 273,277 ---- nodelist_union(struct nodelist *node_list1, struct nodelist *node_list2) { + return NULL; } |
|
From: Jeff B. <jb...@us...> - 2005-04-25 04:40:12
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4474 Modified Files: node.c Log Message: function implementation Index: node.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** node.c 24 Apr 2005 03:50:22 -0000 1.7 --- node.c 25 Apr 2005 04:40:03 -0000 1.8 *************** *** 210,213 **** --- 210,219 ---- nodelist_print(FILE *filep, struct nodelist *node_list) { + struct nodelink *node_link; + + LIST_FOREACH(node_link, node_list, list) + node_print(filep, node_link->node); + + return; } *************** *** 215,218 **** --- 221,242 ---- nodelist_remove(struct nodelist *node_list, struct node *node) { + int i; + struct nodelink *node_link; + + LIST_FOREACH(node_link, node_list, list) + { + tmp_node = node_link->node; + if((i = node_compare(tmp_node, node)) == 0) + { + LIST_REMOVE(node_link, list); + free(node_link); + return tmp_node; + } + else + if(i > 0) + break; + } + + return NULL; } |
|
From: Jeff B. <jb...@us...> - 2005-04-24 03:50:30
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22716 Modified Files: node.c Log Message: function implementations. Index: node.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** node.c 22 Apr 2005 14:58:32 -0000 1.6 --- node.c 24 Apr 2005 03:50:22 -0000 1.7 *************** *** 174,177 **** --- 174,186 ---- nodelist_intersection(struct nodelist *node_list1, struct nodelist *node_list2) { + struct nodelink *node_iter; + struct nodelist *node_list; + + node_list = nodelist_new(); + LIST_FOREACH(node_iter, node_list1, list) + if(nodelist_find(node_list2, node_iter->node) != NULL) + nodelist_add(node_list, node_iter->node); + + return node_list; } *************** *** 179,182 **** --- 188,197 ---- nodelist_merge(struct nodelist *node_list1, struct nodelist *node_list2) { + struct nodelink *node_iter; + + LIST_FOREACH(node_iter, node_list2, list) + nodelist_add(node_list1, node_iter->node); + + return node_list1; } *************** *** 205,208 **** --- 220,232 ---- nodelist_size(struct nodelist *node_list) { + struct nodelink *node_iter; + unsigned int size; + + size = 0; + + LIST_FOREACH(node_iter, node_list, list) + ++size; + + return size; } |
|
From: Jeff B. <jb...@us...> - 2005-04-22 14:58:42
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22490/src Modified Files: node.c Log Message: function implementation Index: node.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** node.c 22 Apr 2005 01:55:21 -0000 1.5 --- node.c 22 Apr 2005 14:58:32 -0000 1.6 *************** *** 25,28 **** --- 25,31 ---- node_free(struct node *node) { + free(node->uid); + nodelist_free(node->links); + free(node); } *************** *** 30,33 **** --- 33,50 ---- node_new(char *uid) { + struct node *node; + size_t len; + + node = (struct node *) malloc(sizeof(struct node *)); + + len = strlen(uid) + 1; + node->uid = (char *) malloc(len); + strlcpy(node->uid, uid, len); + + node->msd = 0; + + node->links = nodelist_new(); + + return node; } *************** *** 35,38 **** --- 52,83 ---- nodelist_add(struct nodelist *node_list, struct node *node) { + int i; + struct nodelink *node_iter, *node_link; + + node_link = (struct nodelink *) malloc(sizeof(struct nodelink)); + node_link->node = node; + + if(LIST_EMPTY(node_list)) + LIST_INSERT_HEAD(node_list, node_link, list); + else + LIST_FOREACH(node_iter, node_list, list) + { + if((i = node_compare(node, node_iter->node)) < 0) + { + if(node_iter == LIST_FIRST(node_list)) + LIST_INSERT_HEAD(node_list, node_link, list); + else + LIST_INSERT_BEFORE(node_iter, node_link, list); + break; + } + else + if(i == 0) + return node_iter->node; + else + if(LIST_NEXT(node_iter, list) == NULL) + LIST_INSERT_AFTER(node_iter, node_link, list); + } + + return node; } *************** *** 40,43 **** --- 85,116 ---- nodelist_add_msd(struct nodelist *node_list, struct node *node) { + int i; + struct nodelink *node_iter, *node_link; + + node_link = (struct nodelink *) malloc(sizeof(struct nodelink)); + node_link->node = node; + + if(LIST_EMPTY(node_list)) + LIST_INSERT_HEAD(node_list, node_link, list); + else + LIST_FOREACH(node_iter, node_list, list) + { + if((i = node_compare_msd(node, node_iter->node)) < 0) + { + if(node_iter == LIST_FIRST(node_list)) + LIST_INSERT_HEAD(node_list, node_link, list); + else + LIST_INSERT_BEFORE(node_iter, node_link, list); + break; + } + else + if(i == 0) + return node_iter->node; + else + if(LIST_NEXT(node_iter, list) == NULL) + LIST_INSERT_AFTER(node_iter, node_link, list); + } + + return node; } *************** *** 45,53 **** nodelist_compare(struct nodelist *node_list1, struct nodelist *node_list2) { } struct nodelist * ! nodelist_duplicate(struct nodelist *node_list) { } --- 118,138 ---- nodelist_compare(struct nodelist *node_list1, struct nodelist *node_list2) { + return nodelist_size(node_list2) - nodelist_size(node_list1); } + /* How should we go about duplicating a msd organized list. + */ struct nodelist * ! nodelist_duplicate(struct nodelist *node_list1) { + struct nodelist *node_list2; + struct nodelink *node_link; + + node_list2 = nodelist_new(); + + LIST_FOREACH(node_link, node_list1, list) + nodelist_add(node_list2, node_link->node); + + return node_list2; } *************** *** 55,58 **** --- 140,154 ---- nodelist_find(struct nodelist *node_list, struct node *node) { + int i; + struct nodelink *node_link; + + LIST_FOREACH(node_link, node_list, list) + if((i = node_compare(node_link->node, node)) == 0) + return node_link->node; + else + if(i > 0) + break; + + return NULL; } *************** *** 60,63 **** --- 156,172 ---- nodelist_free(struct nodelist *node_list) { + struct nodelink *node_link, *tmp_link; + + tmp_link = NULL; + + LIST_FOREACH(node_link, node_list, list) + { + free(tmp_link); + tmp_link = node_link; + LIST_REMOVE(node_link, list); + } + + free(node_link); + free(node_list); } |
|
From: Jeff B. <jb...@us...> - 2005-04-22 01:55:31
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3817 Modified Files: graph.c node.c Log Message: implementing functions Index: graph.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/graph.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** graph.c 21 Apr 2005 18:44:42 -0000 1.2 --- graph.c 22 Apr 2005 01:55:21 -0000 1.3 *************** *** 22,25 **** --- 22,31 ---- #include "node.h" + int + graph_compare(struct graph *graph1, struct graph *graph2) + { + return nodelist_compare(graph1->node_list, graph2->node_list); + } + struct graph * graph_new(struct aliaslist *alias_list, struct nodelist *node_list) *************** *** 39,42 **** --- 45,76 ---- graphlist_add(struct graphlist *graph_list, struct graph *graph) { + int i; + struct graphlink *graph_iter, *graph_link; + + graph_link = (struct graphlink *) malloc(sizeof(struct graphlink)); + graph_link->graph = graph; + + if(LIST_EMPTY(graph_list)) + LIST_INSERT_HEAD(graph_list, graph_link, list); + else + LIST_FOREACH(graph_iter, graph_list, list) + { + if((i = graph_compare(graph, graph_iter->graph)) < 0) + { + if(graph_iter == LIST_FIRST(graph_list)) + LIST_INSERT_HEAD(graph_list, graph_link, list); + else + LIST_INSERT_BEFORE(graph_iter, graph_link, list); + break; + } + else + if(i == 0) + return graph_iter->graph; + else + if(LIST_NEXT(graph_iter, list) == NULL) + LIST_INSERT_AFTER(graph_iter, graph_link, list); + } + + return graph; } Index: node.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** node.c 21 Apr 2005 18:44:42 -0000 1.4 --- node.c 22 Apr 2005 01:55:21 -0000 1.5 *************** *** 42,45 **** --- 42,50 ---- } + int + nodelist_compare(struct nodelist *node_list1, struct nodelist *node_list2) + { + } + struct nodelist * nodelist_duplicate(struct nodelist *node_list) |
|
From: Jeff B. <jb...@us...> - 2005-04-21 19:52:20
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25779 Modified Files: alias.c Log Message: implementing alias_compare aliaslist_find Index: alias.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/alias.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** alias.c 21 Apr 2005 19:03:12 -0000 1.5 --- alias.c 21 Apr 2005 19:52:11 -0000 1.6 *************** *** 24,27 **** --- 24,28 ---- alias_compare(struct alias *alias1, struct alias *alias2) { + return strcmp(alias1->uid, alias2->uid); } *************** *** 96,102 **** --- 97,119 ---- } + /* This should take a struct alias, not a char */ struct alias * aliaslist_find(struct aliaslist *alias_list, char *uid) { + int i; + struct aliaslink *alias_link; + + alias_link = LIST_FIRST(alias_list); + + LIST_FOREACH(alias_link, alias_list, list) + { + if((i = strcmp(((struct alias *) alias_link->alias)->uid, uid)) == 0) + return alias_link->alias; + else + if(i > 0) + break; + } + + return NULL; } |
|
From: Jeff B. <jb...@us...> - 2005-04-21 19:03:34
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29899 Modified Files: alias.c alias.h Log Message: implement aliaslist_add Index: alias.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/alias.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** alias.h 17 Apr 2005 03:05:58 -0000 1.3 --- alias.h 21 Apr 2005 19:03:12 -0000 1.4 *************** *** 38,41 **** --- 38,42 ---- }; + int alias_compare(struct alias *, struct alias *); void alias_free(struct alias *); struct alias *alias_new(char *, char *, struct node *); Index: alias.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/alias.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** alias.c 21 Apr 2005 18:44:42 -0000 1.4 --- alias.c 21 Apr 2005 19:03:12 -0000 1.5 *************** *** 21,24 **** --- 21,29 ---- #include "alias.h" + int + alias_compare(struct alias *alias1, struct alias *alias2) + { + } + void alias_free(struct alias *alias) *************** *** 61,65 **** aliaslist_add(struct aliaslist *alias_list, struct alias *alias) { ! } --- 66,97 ---- aliaslist_add(struct aliaslist *alias_list, struct alias *alias) { ! int i; ! struct aliaslink *alias_iter, *alias_link; ! ! alias_link = (struct aliaslink *) malloc(sizeof(struct aliaslink)); ! alias_link->alias = alias; ! ! if(LIST_EMPTY(alias_list)) ! LIST_INSERT_HEAD(alias_list, alias_link, list); ! else ! LIST_FOREACH(alias_iter, alias_list, list) ! { ! if((i = alias_compare(alias, alias_iter->alias)) < 0) ! { ! if(alias_iter == LIST_FIRST(alias_list)) ! LIST_INSERT_HEAD(alias_list, alias_link, list); ! else ! LIST_INSERT_BEFORE(alias_iter, alias_link, list); ! break; ! } ! else ! if(i == 0) ! return alias_iter->alias; ! else ! if(LIST_NEXT(alias_iter, list) == NULL) ! LIST_INSERT_AFTER(alias_iter, alias_link, list); ! } ! ! return alias; } |
|
From: Jeff B. <jb...@us...> - 2005-04-21 18:44:54
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19583 Modified Files: alias.c graph.c node.c node.h Log Message: compiles Index: node.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** node.h 17 Apr 2005 03:05:58 -0000 1.5 --- node.h 21 Apr 2005 18:44:42 -0000 1.6 *************** *** 21,24 **** --- 21,26 ---- #include <sys/queue.h> + #include <stdio.h> + struct nodelink { Index: graph.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/graph.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** graph.c 18 Apr 2005 14:53:29 -0000 1.1 --- graph.c 21 Apr 2005 18:44:42 -0000 1.2 *************** *** 22,26 **** #include "node.h" ! struct graph *graph_new(struct aliaslist *alias_list, struct nodelist *node_list) { struct graph *graph; --- 22,27 ---- #include "node.h" ! struct graph * ! graph_new(struct aliaslist *alias_list, struct nodelist *node_list) { struct graph *graph; *************** *** 35,39 **** } ! struct graphlist *graphlist_new() { struct graphlist *graphlist; --- 36,46 ---- } ! struct graph * ! graphlist_add(struct graphlist *graph_list, struct graph *graph) ! { ! } ! ! struct graphlist * ! graphlist_new() { struct graphlist *graphlist; Index: node.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** node.c 15 Apr 2005 19:32:32 -0000 1.3 --- node.c 21 Apr 2005 18:44:42 -0000 1.4 *************** *** 22,28 **** #include "node.h" ! /* DONE ! */ ! struct nodelist *nodelist_new() { struct nodelist *list; --- 22,72 ---- #include "node.h" ! void ! node_free(struct node *node) ! { ! } ! ! struct node * ! node_new(char *uid) ! { ! } ! ! struct node * ! nodelist_add(struct nodelist *node_list, struct node *node) ! { ! } ! ! struct node * ! nodelist_add_msd(struct nodelist *node_list, struct node *node) ! { ! } ! ! struct nodelist * ! nodelist_duplicate(struct nodelist *node_list) ! { ! } ! ! struct node * ! nodelist_find(struct nodelist *node_list, struct node *node) ! { ! } ! ! void ! nodelist_free(struct nodelist *node_list) ! { ! } ! ! struct nodelist * ! nodelist_intersection(struct nodelist *node_list1, struct nodelist *node_list2) ! { ! } ! ! struct nodelist * ! nodelist_merge(struct nodelist *node_list1, struct nodelist *node_list2) ! { ! } ! ! struct nodelist * ! nodelist_new() { struct nodelist *list; *************** *** 34,37 **** --- 78,106 ---- } + void + nodelist_print(FILE *filep, struct nodelist *node_list) + { + } + + struct node * + nodelist_remove(struct nodelist *node_list, struct node *node) + { + } + + unsigned int + nodelist_size(struct nodelist *node_list) + { + } + + struct nodelist * + nodelist_subtract(struct nodelist *node_list1, struct nodelist *node_list2) + { + } + + struct nodelist * + nodelist_union(struct nodelist *node_list1, struct nodelist *node_list2) + { + } + int node_compare(struct node *node1, struct node *node2) { Index: alias.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/alias.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** alias.c 18 Apr 2005 14:53:29 -0000 1.3 --- alias.c 21 Apr 2005 18:44:42 -0000 1.4 *************** *** 24,29 **** alias_free(struct alias *alias) { ! free(uid); ! free(name); free(alias); alias = NULL; --- 24,29 ---- alias_free(struct alias *alias) { ! free(alias->uid); ! free(alias->name); free(alias); alias = NULL; *************** *** 65,69 **** struct alias * ! aliaslist_find(struct aliaslist *alias_list, struct char *uid) { } --- 65,69 ---- struct alias * ! aliaslist_find(struct aliaslist *alias_list, char *uid) { } *************** *** 74,82 **** struct aliaslink *alias_link; ! FOREACH(alias_link, alias_list, list) { LIST_REMOVE(alias_link, list); alias_free(alias_link->alias); - free(list); free(alias_link); alias_link = NULL; --- 74,81 ---- struct aliaslink *alias_link; ! LIST_FOREACH(alias_link, alias_list, list) { LIST_REMOVE(alias_link, list); alias_free(alias_link->alias); free(alias_link); alias_link = NULL; |
|
From: Jeff B. <jb...@us...> - 2005-04-18 14:55:02
|
Update of /cvsroot/digraphanalysis/digraphanalysis/utils/gpg2digraph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21966 Modified Files: gpg2digraph.c Log Message: output alines Index: gpg2digraph.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/utils/gpg2digraph/gpg2digraph.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gpg2digraph.c 14 Apr 2005 03:24:28 -0000 1.2 --- gpg2digraph.c 18 Apr 2005 14:54:49 -0000 1.3 *************** *** 69,73 **** if (strcmp(name, "[User ID not found]") != 0) { ! fprintf(stdout, "e:%u:%s:%u:%s\n", strlen(keyid_s), keyid_s, strlen(keyid_p), keyid_p); while (((c = fgetc(stdin)) != '\n') && (feof(stdin) == 0)) if(ferror(stdin)) --- 69,73 ---- if (strcmp(name, "[User ID not found]") != 0) { ! fprintf(stdout, "e:%u:%s:%u:%s\n", strlen(keyid_p), keyid_p, strlen(keyid_s), keyid_s); while (((c = fgetc(stdin)) != '\n') && (feof(stdin) == 0)) if(ferror(stdin)) *************** *** 80,84 **** } ! /* Handle a pub line. */ char * --- 80,86 ---- } ! /* Handle a pub line. Note: this should output only an a line, with this in mind ! * a lines will be renamed to n lines (dont do this until digraphanalysis ! * compiles cleanly handling the alias + node lists. */ char * *************** *** 91,95 **** func001(5); name = get_name(); ! fprintf(stdout, "n:%u:%s:%u:%s\n", strlen(keyid), keyid, strlen(name), name); while (((c = fgetc(stdin)) != '\n') && (feof(stdin) == 0)) if (ferror(stdin)) --- 93,98 ---- func001(5); name = get_name(); ! fprintf(stdout, "n:%u:%s\n", strlen(keyid), keyid); ! fprintf(stdout, "a:%u:%s:%u:%s:%u:%s", strlen(keyid), keyid, strlen(keyid), keyid, strlen(name), name); while (((c = fgetc(stdin)) != '\n') && (feof(stdin) == 0)) if (ferror(stdin)) *************** *** 103,107 **** */ char * ! do_uid() { char c, *keyid, *name; --- 106,110 ---- */ char * ! do_uid(char *keyid_p) { char c, *keyid, *name; *************** *** 111,115 **** func001(2); name = get_name(); ! fprintf(stdout, "n:%u:%s:%u:%s\n", strlen(keyid), keyid, strlen(name), name); while (((c = fgetc(stdin)) != '\n') && (feof(stdin) == 0)) if (ferror(stdin)) --- 114,118 ---- func001(2); name = get_name(); ! fprintf(stdout, "a:%u:%s:%u:%s:%u:%s\n", strlen(keyid_p), keyid_p, strlen(keyid), keyid, strlen(name), name); while (((c = fgetc(stdin)) != '\n') && (feof(stdin) == 0)) if (ferror(stdin)) |
|
From: Jeff B. <jb...@us...> - 2005-04-18 14:53:43
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21524 Modified Files: alias.c list.h main.c Added Files: graph.c graph.h Log Message: interm commit (need to switch os's on my laptop sigh...) Index: list.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/list.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** list.h 14 Apr 2005 03:24:28 -0000 1.2 --- list.h 18 Apr 2005 14:53:29 -0000 1.3 *************** *** 21,31 **** #include <sys/queue.h> ! struct node_t { void *object; ! LIST_ENTRY(node_t) entries; }; ! LIST_HEAD(list_t, node_t); void *list_add_object(struct list_t *, void *, int (*)(void *, void *)); --- 21,31 ---- #include <sys/queue.h> ! struct listlink { void *object; ! LIST_ENTRY(listlink) list; }; ! LIST_HEAD(list, listlink); void *list_add_object(struct list_t *, void *, int (*)(void *, void *)); --- NEW FILE: graph.c --- /* $Id: graph.c,v 1.1 2005/04/18 14:53:29 jbreker Exp $ * * Copyright (C) 2005 Jeff Breker <jb...@sy...> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <stdlib.h> #include "alias.h" #include "graph.h" #include "node.h" struct graph *graph_new(struct aliaslist *alias_list, struct nodelist *node_list) { struct graph *graph; if((graph = (struct graph *) malloc(sizeof(struct graph))) != NULL) { graph->alias_list = alias_list; graph->node_list = node_list; } return graph; } struct graphlist *graphlist_new() { struct graphlist *graphlist; if((graphlist = (struct graphlist *) malloc(sizeof(struct graphlist))) != NULL) LIST_INIT(graphlist); return graphlist; } Index: main.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** main.c 17 Apr 2005 03:05:58 -0000 1.4 --- main.c 18 Apr 2005 14:53:29 -0000 1.5 *************** *** 29,32 **** --- 29,33 ---- #include "alias.h" + #include "graph.h" #include "main.h" #include "node.h" Index: alias.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/alias.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** alias.c 15 Apr 2005 19:00:56 -0000 1.2 --- alias.c 18 Apr 2005 14:53:29 -0000 1.3 *************** *** 21,25 **** #include "alias.h" ! struct alias *alias_new(char *uid, char *name, struct node *node) { struct alias *alias; --- 21,35 ---- #include "alias.h" ! void ! alias_free(struct alias *alias) ! { ! free(uid); ! free(name); ! free(alias); ! alias = NULL; ! } ! ! struct alias * ! alias_new(char *uid, char *name, struct node *node) { struct alias *alias; *************** *** 48,52 **** } ! struct aliaslist *aliaslist_new() { struct aliaslist *list; --- 58,92 ---- } ! struct alias * ! aliaslist_add(struct aliaslist *alias_list, struct alias *alias) ! { ! ! } ! ! struct alias * ! aliaslist_find(struct aliaslist *alias_list, struct char *uid) ! { ! } ! ! void ! aliaslist_free(struct aliaslist *alias_list) ! { ! struct aliaslink *alias_link; ! ! FOREACH(alias_link, alias_list, list) ! { ! LIST_REMOVE(alias_link, list); ! alias_free(alias_link->alias); ! free(list); ! free(alias_link); ! alias_link = NULL; ! } ! free(alias_list); ! ! return; ! } ! ! struct aliaslist * ! aliaslist_new() { struct aliaslist *list; --- NEW FILE: graph.h --- /* $Id: graph.h,v 1.1 2005/04/18 14:53:29 jbreker Exp $ * * Copyright (C) 2005 Jeff Breker <jb...@sy...> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _GRAPH_H_ #define _GRAPH_H_ #include <sys/queue.h> #include "alias.h" #include "node.h" struct graphlink { void *graph; LIST_ENTRY(graphlink) list; }; LIST_HEAD(graphlist, graphlink); struct graph { struct aliaslist *alias_list; struct nodelist *node_list; }; struct graph *graph_new(struct aliaslist *, struct nodelist *); struct graph *graphlist_add(struct graphlist *, struct graph *); struct graphlist *graphlist_new(); #endif /* _GRAPH_H_ */ |
|
From: Jeff B. <jb...@us...> - 2005-04-17 03:06:08
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3030 Modified Files: alias.h main.c main.h node.h Log Message: interm commit Index: node.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** node.h 15 Apr 2005 19:32:32 -0000 1.4 --- node.h 17 Apr 2005 03:05:58 -0000 1.5 *************** *** 36,47 **** --- 36,56 ---- }; + unsigned int node_distance(struct node *, struct node *); void node_free(struct node *); struct node *node_new(char *); struct node *nodelist_add(struct nodelist *, struct node *); + struct node *nodelist_add_msd(struct nodelist *, struct node *); + struct nodelist *nodelist_duplicate(struct nodelist *); struct node *nodelist_find(struct nodelist *, struct node *); + void nodelist_free(struct nodelist *); + struct nodelist *nodelist_intersection(struct nodelist *, struct nodelist *); struct nodelist *nodelist_merge(struct nodelist *, struct nodelist *); struct nodelist *nodelist_new(void); + void nodelist_print(FILE *, struct nodelist *); + struct node *nodelist_remove(struct nodelist *, struct node *); unsigned int nodelist_size(struct nodelist *); + struct nodelist *nodelist_subtract(struct nodelist *, struct nodelist *); + struct nodelist *nodelist_union(struct nodelist *, struct nodelist *); #endif /* _NODE_H_ */ Index: alias.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/alias.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** alias.h 15 Apr 2005 19:00:56 -0000 1.2 --- alias.h 17 Apr 2005 03:05:58 -0000 1.3 *************** *** 38,43 **** --- 38,47 ---- }; + void alias_free(struct alias *); struct alias *alias_new(char *, char *, struct node *); + struct alias *aliaslist_add(struct aliaslist *, struct alias *); + struct alias *aliaslist_find(struct aliaslist *, char *); + void aliaslist_free(struct aliaslist *); struct aliaslist *aliaslist_new(void); Index: main.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.c 14 Apr 2005 03:24:28 -0000 1.3 --- main.c 17 Apr 2005 03:05:58 -0000 1.4 *************** *** 28,181 **** #include <unistd.h> ! #include "list.h" #include "main.h" #include "node.h" ! int analyze_key(pgpkey_t *key, struct list_t *keys, struct list_t *nnlist, struct list_t *nslist, struct list_t *snlist, struct list_t *sslist) { ! struct node_t *iter; ! iter = LIST_FIRST(keys); ! pgpkey_msd(key, keys); ! while(iter != NULL) ! { ! if(list_find_object(key->signatures, iter->object, pgpkey_compare) != NULL) ! if(list_find_object(((pgpkey_t *) iter->object)->signatures, key, pgpkey_compare) != NULL) ! list_add_object(sslist, iter->object, pgpkey_compare); ! else ! list_add_object(nslist, iter->object, pgpkey_compare); ! else ! if(list_find_object(((pgpkey_t *) iter->object)->signatures, key, pgpkey_compare) != NULL) ! list_add_object(snlist, iter->object, pgpkey_compare); ! else ! list_add_object(nnlist, iter->object, pgpkey_compare); ! iter = LIST_NEXT(iter, entries); ! } ! return 0; } /* Analyze the keys and output the results. * * Return -1 on error */ ! int do_analysis(struct list_t *keys1, char *outputdir) { ! char *dir; ! FILE *filep; ! 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; ! i = j = k = 1; ! last_msd = -1.0; /* Create and enter the output directory */ ! if(((sb = (struct stat *) malloc(sizeof(struct stat))) == NULL) || ! ((dir = dirname(outputdir)) == NULL) || ! (stat(dir, sb) == -1) || ! (mkdir(outputdir, sb->st_mode) == -1) || ! (chdir(outputdir) == -1)) return -1; - /* Free any memory no longer needed, and set thier values to NULL */ - free(sb); /* I hope there is nothing in this struct that also needs to be free()'d */ - sb = NULL; ! /* Iterate through the list of keys, analyzing the key and outputting its file */ ! LIST_FOREACH(iter1, keys1, entries) ! { ! 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); ! list_free(nnlist); ! list_free(nslist); ! list_free(snlist); ! list_free(sslist); ! } ! 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(); ! while(!LIST_EMPTY(keys2)) ! { ! if(((tmplist1 = list_new()) == NULL) || ! ((tmplist2 = list_new()) == NULL)) ! return -1; ! list_add_object(tmplist1, LIST_FIRST(keys2)->object, &pgpkey_compare_msd); ! 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_msd)) == 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) ! { ! list_add_object(tmplist1, iter2->object, &pgpkey_compare_msd); ! list_remove(keys2, iter2->object, &pgpkey_compare); ! } ! iter2 = LIST_NEXT(iter2, entries); ! } ! iter1 = LIST_NEXT(iter1, entries); ! } ! } ! list_add_object(wots, tmplist1, &wot_compare); ! list_free(tmplist2); ! tmplist2 = NULL; ! } ! list_free(keys2); ! keys2 = NULL; ! iter1 = NULL; ! iter2 = NULL; ! tmplist1 = NULL; - /* Build the report.html file from the wots file */ 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) j = k; ++k; ! last_msd = key->msd; dir = (char *) malloc(3); ! strncpy(dir, key->keyid + 8, 2); *(dir + 2) = '\0'; ! fprintf(filep, "<tr><td>%d</td><td><a href=\"%s/%s\">%s</a></td><td>%s</td><td>%f</td></tr>\n", j, dir, key->keyid + 8, key->keyid + 8, key->name, key->msd); free(dir); ! dir = NULL; ! list_remove(tmplist1, key, &pgpkey_compare_msd); ! key = NULL; } fprintf(filep, "</table></div>\n"); ! tmplist1 = iter1->object; ! list_remove(wots, tmplist1, &wot_compare); ! list_free(tmplist1); ! tmplist1 = NULL; j = k = 1; --- 28,145 ---- #include <unistd.h> ! #include "alias.h" #include "main.h" #include "node.h" ! void ! create_new_directory(char *dirname) { ! struct stat *sb; ! sb = (struct stat *) malloc(sizeof(struct stat)); ! stat(".", sb); ! mkdir(dirname, sb->st_mode); ! ! free(sb); } + /* Analyze the keys and output the results. * * Return -1 on error */ ! int ! do_analysis(struct graph *graph, char *outputdir) { ! struct graphlist *graph_list; ! if(analysis_main_directory(outputdir) == (-1)) ! return (-1); ! ! analysis_nodes(graph); ! ! graph_list = analysis_seperate_nodes(graph); ! ! analysis_output_report(graph_list); ! ! return 0; ! } ! ! void ! analysis_nodes(struct graph *graph) ! { ! struct nodelink *node_link; ! ! LIST_FOREACH(node_link, graph->node_list, list) ! output_file(node_link->node, graph->alias_list, graph->node_list); ! ! return; ! } ! ! int ! analysis_main_directory(char *outputdir) ! { ! char *dir; ! struct stat *sb; /* Create and enter the output directory */ ! if (((sb = (struct stat *) malloc(sizeof(struct stat))) == NULL) || ! ((dir = dirname(outputdir)) == NULL) || ! (stat(dir, sb) == -1) || ! (mkdir(outputdir, sb->st_mode) == -1) || ! (chdir(outputdir) == -1)) return -1; ! return 0; ! } ! void ! analysis_output_report(struct graphlist *graph_list) ! { ! struct alias *alias; ! char *dir; ! FILE *filep; ! struct graph *graph; ! struct graphlink *graph_link; ! int i; ! int j; ! int k; ! float last_msd; ! struct node *node; ! struct nodelink *node_link; filep = fopen("report.html", "w"); fprintf(filep, "<html><body>\n"); ! ! while(!LIST_EMPTY(graph_list)) { ! graph_link = LIST_FIRST(graph_list); /* If the size of this web of trust is 1 then the remaining are of size 1, so group them all together */ ! if(nodelist_size(((struct graph *) graph_link->graph)->node_list) == 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"); ! graph = (struct graph *) graph_link->graph; ! while(!LIST_EMPTY(graph->node_list)) { ! node_link = LIST_FIRST(graph->node_list); ! node = (struct node *) node_link->node; ! if(node->msd != last_msd) j = k; ++k; ! last_msd = node->msd; dir = (char *) malloc(3); ! strncpy(dir, node->uid, 2); *(dir + 2) = '\0'; ! alias = aliaslist_find(graph->alias_list, node->uid); ! fprintf(filep, "<tr><td>%d</td><td><a href=\"%s/%s\">%s</a></td><td>%s</td><td>%f</td></tr>\n", j, dir, node->uid, node->uid, ((alias != NULL)?(alias->name):""), node->msd); free(dir); ! LIST_REMOVE(node_link, list); } fprintf(filep, "</table></div>\n"); ! LIST_REMOVE(graph_link, list); j = k = 1; *************** *** 184,202 **** } ! if(iter1 != NULL) { fprintf(filep, "<div class=\"wottable\"><div class=\"wottable_title\">Unconnected Keys</div>\n"); fprintf(filep, "<table><tr><td>KeyID</td><td>Name</td></tr>\n"); ! while(iter1 != NULL) { ! iter2 = LIST_FIRST(((struct list_t *) iter1->object)); ! key = (pgpkey_t *) iter2->object; dir = (char *) malloc(3); ! strncpy(dir, key->keyid + 8, 2); *(dir + 2) = '\0'; ! 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"); --- 148,168 ---- } ! if(graph_link != NULL) { fprintf(filep, "<div class=\"wottable\"><div class=\"wottable_title\">Unconnected Keys</div>\n"); fprintf(filep, "<table><tr><td>KeyID</td><td>Name</td></tr>\n"); ! while(graph_link != NULL) { ! graph = graph_link->graph; ! node_link = LIST_FIRST(graph->node_list); ! node = (struct node *) node_link->node; dir = (char *) malloc(3); ! strncpy(dir, node->uid, 2); *(dir + 2) = '\0'; ! alias = aliaslist_find(graph->alias_list, node->uid); ! fprintf(filep, "<tr><td><a href=\"%s/%s\">%s</a></td><td>%s</td></tr>\n", dir, node->uid, node->uid, ((alias != NULL)?(alias->name):"")); free(dir); ! graph_link = LIST_NEXT(graph_link, list); } fprintf(filep, "</table></div>\n"); *************** *** 206,216 **** fclose(filep); ! return 0; } char *get_field() { ! char c, *string; ! size_t size = 0; while(((c = getchar()) != ':') && (c != EOF)) --- 172,230 ---- fclose(filep); ! return; ! } ! ! struct graphlist * ! analysis_seperate_nodes(struct graph *graph) ! { ! struct aliaslist *alias_list; ! struct graphlist *graph_list; ! struct nodelink *node_link1; ! struct nodelink *node_link2; ! struct nodelist *node_list; ! struct nodelist *node_list_msd1; ! struct nodelist *node_list_msd2; ! ! node_list = nodelist_duplicate(graph->node_list); ! graph_list = graphlist_new(); ! ! while(!LIST_EMPTY(node_list)) ! { ! if(((node_list_msd1 = nodelist_new()) == NULL) || ! ((node_list_msd2 = nodelist_new()) == NULL)) ! return NULL; ! ! nodelist_add_msd(node_list_msd1, LIST_FIRST(node_list)->node); ! LIST_REMOVE(LIST_FIRST(node_list), list); ! while(nodelist_size(node_list_msd1) != nodelist_size(node_list_msd2)) ! { ! nodelist_free(node_list_msd2); ! if((node_list_msd2 = nodelist_duplicate(node_list_msd1)) == NULL) ! return NULL; ! LIST_FOREACH(node_link1, node_list_msd2, list) ! LIST_FOREACH(node_link2, ((struct node *) node_link1->node)->links, list) ! if(node_distance(node_link2->node, node_link1->node)) ! { ! nodelist_add_msd(node_list_msd1, node_link2->node); ! nodelist_remove(node_list, node_link2->node); ! } ! } ! graphlist_add(graph_list, graph_new(alias_list, node_list_msd1)); ! nodelist_free(node_list_msd2); ! } ! nodelist_free(node_list); ! ! return graph_list; } + /* DONE + */ char *get_field() { ! char c; ! size_t size; ! char *string; ! ! size = 0; while(((c = getchar()) != ':') && (c != EOF)) *************** *** 221,240 **** size = size + c - '0'; } if(c == EOF) errx(EX_DATAERR, "Unexpected termination of data input!\n"); ! ++size; ! string = (char *) malloc(size); ! if(string == NULL) ! return NULL; ! fgets(string, size, stdin); ! *(string + size) = '\0'; return string; } int main(int argc, char **argv) { ! char c; ! char *outputdir = NULL; ! struct list_t *keys; while ((c = getopt(argc, argv, "o:")) != -1) --- 235,263 ---- size = size + c - '0'; } + if(c == EOF) errx(EX_DATAERR, "Unexpected termination of data input!\n"); ! ! string = (char *) malloc(++size); ! ! if(string != NULL) ! { ! fgets(string, size, stdin); ! *(string + size) = '\0'; ! } ! return string; } + /* DONE + */ int main(int argc, char **argv) { ! int c; ! struct graph *graph; ! char *output_dir; ! ! graph = graph_new(aliaslist_new(), nodelist_new()); ! output_dir = NULL; while ((c = getopt(argc, argv, "o:")) != -1) *************** *** 242,246 **** { case 'o': ! outputdir = optarg; break; default: --- 265,269 ---- { case 'o': ! output_dir = optarg; break; default: *************** *** 249,253 **** } ! if(outputdir == NULL) { usage(); --- 272,276 ---- } ! if(output_dir == NULL) { usage(); *************** *** 255,327 **** } ! keys = parse_keyring(); ! do_analysis(keys, outputdir); return EXIT_SUCCESS; } ! ! void output_file(pgpkey_t *key, struct list_t *nnlist, struct list_t *nslist, struct list_t *snlist, struct list_t *sslist) { char *file_dir; FILE *filep; - struct list_t *tmp_list; - struct stat *sb; unsigned int tmp_size; file_dir = (char *) malloc(3); ! sb = (struct stat *) malloc(sizeof(struct stat)); ! ! stat(".", sb); ! ! strncpy(file_dir, key->keyid + 8, 2); *(file_dir + 2) = '\0'; ! mkdir(file_dir, sb->st_mode); - free(sb); - chdir(file_dir); free(file_dir); ! filep = fopen(key->keyid + 8, "a"); ! fprintf(filep, "Keyid: %s\n\n", key->keyid); fprintf(filep, "Signatures to this key:\n"); ! tmp_list = list_union(nslist, sslist, &pgpkey_compare); ! print_list(filep, tmp_list); ! tmp_size = list_size(tmp_list); fprintf(filep, " Total: %u signature%s to this key from this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); - list_free(tmp_list); fprintf(filep, "Signatures from this key:\n"); ! tmp_list = list_union(snlist, sslist, &pgpkey_compare); ! print_list(filep, tmp_list); ! tmp_size = list_size(tmp_list); fprintf(filep, " Total: %u signature%s from this key to this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); - list_free(tmp_list); ! fprintf(filep, "MSD: %.4f\n\n", key->msd); fprintf(filep, "This key has not signed, nor been signed by:\n"); ! print_list(filep, nnlist); ! tmp_size = list_size(nnlist); fprintf(filep, " Total: %u key%s in this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); fprintf(filep, "This key has not signed, but has been signed by:\n"); ! print_list(filep, nslist); ! tmp_size = list_size(nslist); fprintf(filep, " Total: %u key%s in this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); fprintf(filep, "This key has signed, but has not been signed by:\n"); ! print_list(filep, snlist); ! tmp_size = list_size(snlist); fprintf(filep, " Total: %u key%s in this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); fprintf(filep, "This key has signed and has been signed by:\n"); ! print_list(filep, sslist); ! tmp_size = list_size(sslist); fprintf(filep, " Total: %u key%s in this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); ! fclose(filep); chdir(".."); --- 278,354 ---- } ! parse_input(graph); ! do_analysis(graph, output_dir); return EXIT_SUCCESS; } ! /* key == node ! */ ! void ! output_file(struct node *node, ! struct aliaslist *alias_list, ! struct nodelist *node_list) { + struct nodelink *node_link; + struct nodelist *nodes_we_link_to; + struct nodelist *tmp_nodelist; char *file_dir; FILE *filep; unsigned int tmp_size; file_dir = (char *) malloc(3); ! strncpy(file_dir, node->uid, 2); *(file_dir + 2) = '\0'; ! create_new_directory(file_dir); chdir(file_dir); free(file_dir); ! filep = fopen(node->uid, "a"); ! fprintf(filep, "Keyid: %s\n\n", node->uid); fprintf(filep, "Signatures to this key:\n"); ! nodelist_print(filep, node->links); ! tmp_size = nodelist_size(node->links); fprintf(filep, " Total: %u signature%s to this key from this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); + nodes_we_link_to = nodelist_new(); + LIST_FOREACH(node_link, node_list, list) + if(nodelist_find(((struct node *) node_link->node)->links, node) != NULL) + nodelist_add(nodes_we_link_to, node_link->node); fprintf(filep, "Signatures from this key:\n"); ! nodelist_print(filep, nodes_we_link_to); ! tmp_size = nodelist_size(nodes_we_link_to); fprintf(filep, " Total: %u signature%s from this key to this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); ! fprintf(filep, "MSD: %.4f\n\n", node->msd); + tmp_nodelist = nodelist_subtract(node_list, nodelist_union(node->links, nodes_we_link_to)); fprintf(filep, "This key has not signed, nor been signed by:\n"); ! nodelist_print(filep, tmp_nodelist); fprintf(filep, " Total: %u key%s in this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); + tmp_nodelist = nodelist_subtract(node->links, nodes_we_link_to); fprintf(filep, "This key has not signed, but has been signed by:\n"); ! nodelist_print(filep, tmp_nodelist); ! tmp_size = nodelist_size(tmp_nodelist); fprintf(filep, " Total: %u key%s in this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); + nodelist_free(tmp_nodelist); + tmp_nodelist = nodelist_subtract(nodes_we_link_to, node->links); fprintf(filep, "This key has signed, but has not been signed by:\n"); ! nodelist_print(filep, tmp_nodelist); ! tmp_size = nodelist_size(tmp_nodelist); fprintf(filep, " Total: %u key%s in this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); + nodelist_free(tmp_nodelist); + tmp_nodelist = nodelist_intersection(node->links, nodes_we_link_to); fprintf(filep, "This key has signed and has been signed by:\n"); ! nodelist_print(filep, tmp_nodelist); ! tmp_size = nodelist_size(tmp_nodelist); fprintf(filep, " Total: %u key%s in this set.\n\n", tmp_size, ((tmp_size == 1)?"":"s")); ! nodelist_free(tmp_nodelist); fclose(filep); chdir(".."); *************** *** 330,342 **** } ! struct list_t *parse_keyring() { ! char c, type, *field1, *field2; ! pgpkey_t *key1, *key2, *tmpkey; ! struct list_t *keys; ! ! keys = list_new(); ! for(c = type = getchar(); c == 'e' || c == 'n'; c = type = getchar()) { if(((c = getchar()) != ':') && (c != EOF)) --- 357,376 ---- } ! /* DONE ! */ ! void parse_input(struct graph *graph) { ! struct alias *alias1; ! struct alias *alias2; ! char c; ! char *field1; ! char *field2; ! char *field3; ! struct node *node1; ! struct node *node2; ! struct node *node3; ! char type; ! for(c = type = getchar(); type == 'e' || type == 'n' || type == 'a'; c = type = getchar()) { if(((c = getchar()) != ':') && (c != EOF)) *************** *** 348,387 **** if(*field1 == EOF) break; ! if(((c = getchar()) != ':') && (c != EOF)) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); ! if(c == EOF) ! break; ! if((field2 = get_field()) == NULL) ! errx(EX_OSERR, "Cannot allocate memory!\n"); ! if(*field2 == EOF) ! break; ! if(((c = getchar()) != '\n') && (c != EOF)) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); ! ! if(type == 'n') { ! tmpkey = pgpkey_new(field1, field2); ! free(field1); ! if((key1 = list_add_object(keys, tmpkey, &pgpkey_compare)) != tmpkey) { ! free(tmpkey); ! if(*(key1->name) == '\0') ! { ! key1->name = field2; ! field2 = NULL; ! } } } ! else { ! tmpkey = pgpkey_new(field1, ""); free(field1); ! if((key1 = list_add_object(keys, tmpkey, &pgpkey_compare)) != tmpkey) ! free(tmpkey); ! tmpkey = pgpkey_new(field2, ""); free(field2); ! if((key2 = list_add_object(keys, tmpkey, &pgpkey_compare)) != tmpkey) ! free(tmpkey); ! list_add_object(key2->signatures, key1, &pgpkey_compare); } --- 382,444 ---- if(*field1 == EOF) break; ! if(type != 'n') /* Grab 2nd field for edges and alias' */ { ! if(((c = getchar()) != ':') && (c != EOF)) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); ! if(c == EOF) ! break; ! if((field2 = get_field()) == NULL) ! errx(EX_OSERR, "Cannot allocate memory!\n"); ! if(*field2 == EOF) ! break; ! if(type == 'a') /* Grab 3rd field for an alias */ { ! if(((c = getchar()) != ':') && (c != EOF)) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); ! if(c == EOF) ! break; ! if((field3 = get_field()) == NULL) ! errx(EX_OSERR, "Cannot allocate memory!\n"); ! if(*field3 == EOF) ! break; } } ! if(((c = getchar()) != '\n') && (c != EOF)) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); ! ! switch (type) { ! case 'a': ! node1 = node_new(field1); free(field1); ! if((node2 = nodelist_add(graph->node_list, node1)) != node1) ! node_free(node1); ! alias1 = alias_new(field2, field3, node2); free(field2); ! free(field3); ! if((alias2 = aliaslist_add(graph->alias_list, alias1)) != alias1) ! alias_free(alias1); ! break; ! case 'e': ! node1 = node_new(field1); ! free(field1); ! if((node2 = nodelist_add(graph->node_list, node1)) != node1) ! node_free(node1); ! node1 = node_new(field2); ! free(field2); ! if((node3 = nodelist_add(graph->node_list, node1)) != node1) ! node_free(node1); ! if((node1 = nodelist_add(node2->links, node3)) != node3) ! node_free(node3); ! break; ! /* a lines will eventually be renamed to n lines, when this happens ! * the following gets ripped out. ! */ ! case 'n': ! node1 = node_new(field1); ! free(field1); ! if((node2 = nodelist_add(graph->node_list, node1)) != node1) ! node_free(node1); ! break; } *************** *** 392,413 **** if(c != EOF) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", c, c); ! return keys; } ! void print_list(FILE *filep, struct list_t *list) { ! struct node_t *node; ! pgpkey_t *key; ! char *keyid, *name; ! LIST_FOREACH(node, list, entries) { ! key = (pgpkey_t *) node->object; ! keyid = key->keyid + 8; ! name = key->name; ! fprintf(filep, " %s %s\n", keyid, name); } return; --- 449,470 ---- if(c != EOF) ! errx(EX_DATAERR, "Invalid character, %c (ASCII: %d), encountered!\n", type, type); ! return; } ! void print_list(FILE *filep, struct graph *graph) { ! struct node *node; ! struct nodelink *node_link; ! char *uid, *name; ! LIST_FOREACH(node_link, graph->node_list, list) { ! node = node_link->node; ! uid = node->uid; ! name = aliaslist_find(graph->alias_list, uid)->name; ! fprintf(filep, " %s %s\n", uid, name); } return; *************** *** 422,438 **** return; } - - int wot_compare(void *obj1, void *obj2) - { - struct list_t *wot1 = obj1; - struct list_t *wot2 = obj2; - unsigned int wot1size, wot2size; - - if(wot1 == wot2) - return 0; - - if((wot1size = list_size(wot1)) == (wot2size = list_size(wot2))) - return pgpkey_compare(LIST_FIRST(wot1)->object, LIST_FIRST(wot2)->object); - - return wot2size - wot1size; - } --- 479,480 ---- Index: main.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/main.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.h 14 Apr 2005 03:24:28 -0000 1.2 --- main.h 17 Apr 2005 03:05:58 -0000 1.3 *************** *** 22,35 **** #include <stdio.h> ! #include "list.h" #include "node.h" ! int analyze_key(pgpkey_t *, struct list_t *, struct list_t *, struct list_t *, struct list_t *, struct list_t *); ! int do_analysis(struct list_t *, char *); ! void output_file(pgpkey_t *, struct list_t *, struct list_t *, struct list_t *, struct list_t *); ! struct list_t *parse_keyring(void); ! void print_list(FILE *, struct list_t *); ! void usage(void); ! int wot_compare(void *, void *); #endif --- 22,40 ---- #include <stdio.h> ! #include "alias.h" ! #include "graph.h" #include "node.h" ! int analysis_main_directory(char *); ! void analysis_nodes(struct graph *); ! void analysis_output_report(struct graphlist *); ! struct graphlist *analysis_seperate_nodes(struct graph *); ! int do_analysis(struct graph *, char *); ! char *get_field(void); ! void output_file(struct node *, struct aliaslist *, struct nodelist *); ! void parse_input(struct graph *); ! void print_graph(FILE *, struct nodelist *); ! void usage(void); ! int wot_compare(void *, void *); #endif |
|
From: Jeff B. <jb...@us...> - 2005-04-15 19:32:42
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31221 Modified Files: node.c node.h Log Message: node.c compiles Index: node.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** node.h 15 Apr 2005 19:00:56 -0000 1.3 --- node.h 15 Apr 2005 19:32:32 -0000 1.4 *************** *** 39,43 **** --- 39,47 ---- struct node *node_new(char *); + struct node *nodelist_add(struct nodelist *, struct node *); + struct node *nodelist_find(struct nodelist *, struct node *); + struct nodelist *nodelist_merge(struct nodelist *, struct nodelist *); struct nodelist *nodelist_new(void); + unsigned int nodelist_size(struct nodelist *); #endif /* _NODE_H_ */ Index: node.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** node.c 14 Apr 2005 03:24:28 -0000 1.2 --- node.c 15 Apr 2005 19:32:32 -0000 1.3 *************** *** 20,72 **** #include <string.h> - #include "list.h" #include "node.h" ! int pgpkey_compare(void *key1, void *key2) { ! return strcmp(((pgpkey_t *) key1)->keyid, ((pgpkey_t *) key2)->keyid); } ! int pgpkey_compare_msd(void *key1, void *key2) { ! float tmp; ! tmp = ((pgpkey_t *) key1)->msd - ((pgpkey_t *) key2)->msd; ! if(tmp == (float) 0) ! return strcmp(((pgpkey_t *) key1)->keyid, ((pgpkey_t *) key2)->keyid); else ! if(tmp > (float) 0) ! return 1; else ! return (-1); } ! unsigned int pgpkey_distance(pgpkey_t *keyto, pgpkey_t *keyfrom) { unsigned int distance; unsigned int last_known_size, tmpsize; ! struct list_t *traversed_keys, *tmp_keys; ! struct node_t *tmp_node; ! traversed_keys = list_new(); last_known_size = 0; distance = 1; ! list_merge_list(traversed_keys, keyto->signatures, &pgpkey_compare); ! while((tmpsize = list_size(traversed_keys)) != last_known_size) { ! if(list_find_object(traversed_keys, keyfrom, &pgpkey_compare) != NULL) return distance; last_known_size = tmpsize; ++distance; ! tmp_keys = traversed_keys; ! tmp_node = LIST_FIRST(tmp_keys); ! traversed_keys = list_new(); while(tmp_node != NULL) { ! list_add_object(traversed_keys, tmp_node->object, &pgpkey_compare); ! list_merge_list(traversed_keys, ((pgpkey_t *) tmp_node->object)->signatures, &pgpkey_compare); ! tmp_node = LIST_NEXT(tmp_node, entries); } } --- 20,92 ---- #include <string.h> #include "node.h" ! /* DONE ! */ ! struct nodelist *nodelist_new() { ! struct nodelist *list; ! ! if((list = (struct nodelist *) malloc(sizeof(struct nodelist))) != NULL) ! LIST_INIT(list); ! ! return list; } ! int node_compare(struct node *node1, struct node *node2) { ! return strcmp(node1->uid, node2->uid); ! } ! int node_compare_msd(struct node *node1, struct node *node2) ! { ! int i; ! float float_tmp; ! ! float_tmp = node1->msd - node2->msd; ! if(float_tmp == (float) 0) ! i = node_compare(node1, node2); else ! if(float_tmp > (float) 0) ! i = 1; else ! i = (-1); ! ! return i; } ! /* keyto == node1 ! * keyfrom == node2 ! * traversed_keys == traversed_nodes ! * tmp_keys == tmp_nodes ! * list_merge_list == nodelist_merge ! */ ! unsigned int node_distance(struct node *node1, struct node *node2) { unsigned int distance; unsigned int last_known_size, tmpsize; ! struct nodelist *traversed_nodes, *tmp_nodes; ! struct nodelink *tmp_node; ! traversed_nodes = nodelist_new(); last_known_size = 0; distance = 1; ! nodelist_merge(traversed_nodes, node1->links); ! while((tmpsize = nodelist_size(traversed_nodes)) != last_known_size) { ! if(nodelist_find(traversed_nodes, node2) != NULL) return distance; last_known_size = tmpsize; ++distance; ! tmp_nodes = traversed_nodes; ! tmp_node = LIST_FIRST(tmp_nodes); ! traversed_nodes = nodelist_new(); while(tmp_node != NULL) { ! nodelist_add(traversed_nodes, tmp_node->node); ! nodelist_merge(traversed_nodes, ((struct node *) tmp_node->node)->links); ! tmp_node = LIST_NEXT(tmp_node, list); } } *************** *** 75,116 **** } ! void pgpkey_msd(pgpkey_t *key, struct list_t *keys) { ! unsigned int distance, i, num_keys; ! struct node_t *iter; distance = 0; ! num_keys = 0; ! iter = LIST_FIRST(keys); while(iter != NULL) { ! i = pgpkey_distance(key, (pgpkey_t *) iter->object); if(i > 0) { distance += i; ! num_keys++; } ! iter = LIST_NEXT(iter, entries); } ! key->msd = ((float) distance) / ((float) num_keys); return; } - pgpkey_t *pgpkey_new(char *keyid, char *name) - { - pgpkey_t *pgpkey; - - pgpkey = (pgpkey_t *) malloc(sizeof(pgpkey_t)); - pgpkey->keyid = (char *) malloc(17); - strncpy(pgpkey->keyid, keyid, 16); - *(pgpkey->keyid + 16) = '\0'; - pgpkey->name = (char *) malloc(strlen(name) + 1); - strncpy(pgpkey->name, name, strlen(name)); - *(pgpkey->name + strlen(name)) = '\0'; - pgpkey->signatures = list_new(); - pgpkey->msd = 0; - - return pgpkey; - } --- 95,121 ---- } ! void node_msd(struct node *node, struct nodelist *nodes) { ! unsigned int distance, i, num_nodes; ! struct nodelink *iter; distance = 0; ! num_nodes = 0; ! iter = LIST_FIRST(nodes); while(iter != NULL) { ! i = node_distance(node, iter->node); if(i > 0) { distance += i; ! num_nodes++; } ! iter = LIST_NEXT(iter, list); } ! node->msd = ((float) distance) / ((float) num_nodes); ! return; } |
|
From: Jeff B. <jb...@us...> - 2005-04-15 19:01:06
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12766 Modified Files: alias.c alias.h node.h Log Message: alias.c compiles Index: node.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/node.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** node.h 14 Apr 2005 03:24:28 -0000 1.2 --- node.h 15 Apr 2005 19:00:56 -0000 1.3 *************** *** 19,39 **** #define _NODE_H_ ! #include "list.h" ! struct pgpkey_s { ! char *keyid; float msd; ! char *name; ! struct list_t *signatures; }; ! typedef struct pgpkey_s pgpkey_t; ! int pgpkey_compare(void *, void *); ! int pgpkey_compare_msd(void *, void *); ! unsigned int pgpkey_distance(pgpkey_t *, pgpkey_t *); ! void pgpkey_msd(pgpkey_t *, struct list_t *); ! pgpkey_t *pgpkey_new(char *, char *); #endif /* _NODE_H_ */ --- 19,43 ---- #define _NODE_H_ ! #include <sys/queue.h> ! struct nodelink { ! void *node; ! LIST_ENTRY(nodelink) list; ! }; ! ! LIST_HEAD(nodelist, nodelink); ! ! struct node ! { ! char *uid; /* The primary uid identifier for the node */ float msd; ! struct nodelist *links; /* Other nodes that "sign" this node */ }; ! void node_free(struct node *); ! struct node *node_new(char *); ! struct nodelist *nodelist_new(void); #endif /* _NODE_H_ */ Index: alias.h =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/alias.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** alias.h 15 Apr 2005 03:43:23 -0000 1.1 --- alias.h 15 Apr 2005 19:00:56 -0000 1.2 *************** *** 19,34 **** #define _ALIAS_H_ ! #include "list.h" ! struct alias ! { ! char *uid; ! char *name; ! struct node *node; ! }; struct aliaslink { ! struct alias alias; LIST_ENTRY(aliaslink) list; }; --- 19,29 ---- #define _ALIAS_H_ ! #include <sys/queue.h> ! #include "node.h" struct aliaslink { ! void *alias; LIST_ENTRY(aliaslink) list; }; *************** *** 36,42 **** LIST_HEAD(aliaslist, aliaslink); ! alias *alias_new(char *, char *, struct node *); ! aliaslist *aliaslist_new(void); #endif /* _ALIAS_H_ */ --- 31,44 ---- LIST_HEAD(aliaslist, aliaslink); ! struct alias ! { ! char *uid; ! char *name; ! struct node *node; ! }; ! struct alias *alias_new(char *, char *, struct node *); ! ! struct aliaslist *aliaslist_new(void); #endif /* _ALIAS_H_ */ Index: alias.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/alias.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** alias.c 15 Apr 2005 03:43:23 -0000 1.1 --- alias.c 15 Apr 2005 19:00:56 -0000 1.2 *************** *** 16,26 **** */ #include "alias.h" ! alias *alias_new(char *uid, char *name, struct node *node) { ! alias *alias; ! if((alias = (alias *) malloc(sizeof(alias))) != NULL) { if(((alias->uid = (char *) malloc(strlen(uid) + 1)) == NULL) || --- 16,29 ---- */ + #include <stdlib.h> + #include <string.h> + #include "alias.h" ! struct alias *alias_new(char *uid, char *name, struct node *node) { ! struct alias *alias; ! if((alias = (struct alias *) malloc(sizeof(struct alias))) != NULL) { if(((alias->uid = (char *) malloc(strlen(uid) + 1)) == NULL) || *************** *** 45,53 **** } ! aliaslist *aliaslist_new() { ! aliaslist *list; ! if((list = (aliaslist *) malloc(sizeof(aliaslist))) != NULL) LIST_INIT(list); --- 48,56 ---- } ! struct aliaslist *aliaslist_new() { ! struct aliaslist *list; ! if((list = (struct aliaslist *) malloc(sizeof(struct aliaslist))) != NULL) LIST_INIT(list); |
|
From: Jeff B. <jb...@us...> - 2005-04-15 03:43:35
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18429 Added Files: alias.c alias.h Log Message: initial add; This is for the upcomming seperation of nodes and alias' --- NEW FILE: alias.h --- /* $Id: alias.h,v 1.1 2005/04/15 03:43:23 jbreker Exp $ * * Copyright (C) 2005 Jeff Breker <jb...@sy...> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _ALIAS_H_ #define _ALIAS_H_ #include "list.h" struct alias { char *uid; char *name; struct node *node; }; struct aliaslink { struct alias alias; LIST_ENTRY(aliaslink) list; }; LIST_HEAD(aliaslist, aliaslink); alias *alias_new(char *, char *, struct node *); aliaslist *aliaslist_new(void); #endif /* _ALIAS_H_ */ --- NEW FILE: alias.c --- /* $Id: alias.c,v 1.1 2005/04/15 03:43:23 jbreker Exp $ * * Copyright (C) 2005 Jeff Breker <jb...@sy...> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "alias.h" alias *alias_new(char *uid, char *name, struct node *node) { alias *alias; if((alias = (alias *) malloc(sizeof(alias))) != NULL) { if(((alias->uid = (char *) malloc(strlen(uid) + 1)) == NULL) || ((alias->name = (char *) malloc(strlen(name) + 1)) == NULL)) { free(alias->name); free(alias->uid); free(alias); alias = NULL; } else { strncpy(alias->uid, uid, strlen(uid)); *(alias->uid + strlen(uid)) = '\0'; strncpy(alias->name, name, strlen(uid)); *(alias->name + strlen(name)) = '\0'; alias->node = node; } } return alias; } aliaslist *aliaslist_new() { aliaslist *list; if((list = (aliaslist *) malloc(sizeof(aliaslist))) != NULL) LIST_INIT(list); return list; } |