[digraphanalysis-cvs] digraphanalysis/src main.c,
Status: Planning
Brought to you by:
jbreker
|
From: Jeff B. <jb...@us...> - 2005-05-14 03:02:46
|
Update of /cvsroot/digraphanalysis/digraphanalysis/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1969 Modified Files: main.c Log Message: remove debug Index: main.c =================================================================== RCS file: /cvsroot/digraphanalysis/digraphanalysis/src/main.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** main.c 14 May 2005 02:56:24 -0000 1.8 --- main.c 14 May 2005 03:02:38 -0000 1.9 *************** *** 33,59 **** #include "node.h" - int - create_new_directory(char *dirname) - { - int rtn; - struct stat *sb; - - rtn = 0; - sb = NULL; - warnx("DEBUG:015"); - /* 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; - warnx("DEBUG:016"); - free(sb); - warnx("DEBUG:017"); - return rtn; - } - - /* Analyze the keys and output the results. * --- 33,36 ---- *************** *** 66,79 **** graph_list = NULL; - warnx("DEBUG:007"); if(analysis_main_directory(outputdir) == (-1)) return (-1); - warnx("DEBUG:008"); analysis_nodes(graph); - warnx("DEBUG:009"); graph_list = analysis_seperate_nodes(graph); - warnx("DEBUG:010"); analysis_output_report(graph_list); - warnx("DEBUG:011"); return 0; } --- 43,51 ---- *************** *** 98,102 **** dir = NULL; rtn = 0; - warnx("DEBUG:012"); /* Create and enter the output directory */ if((dir = dirname(outputdir)) == NULL) --- 70,73 ---- *************** *** 106,113 **** (chdir(outputdir) == -1)) rtn = -1; ! warnx("DEBUG:013"); ! /* ? free(dir); */ - warnx("DEBUG:014"); return rtn; } --- 77,82 ---- (chdir(outputdir) == -1)) rtn = -1; ! /* afaik the call to dirname isn't mangling a copied string it's giving us the address in memory of the actual fs dir label. thus segfaulting (badly) when trying to free it. free(dir); */ return rtn; } *************** *** 132,144 **** filep = fopen("report.html", "w"); fprintf(filep, "<html><body>\n"); - warnx("OUTPUT:001"); while(!LIST_EMPTY(graph_list)) { - warnx("OUTPUT:002"); 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; - warnx("OUTPUT:006"); 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"); --- 101,110 ---- *************** *** 147,151 **** while(!LIST_EMPTY(graph->node_list)) { - warnx("OUTPUT:003"); node_link = LIST_FIRST(graph->node_list); node = (struct node *) node_link->node; --- 113,116 ---- *************** *** 168,172 **** if(graph_link != NULL) { - warnx("OUTPUT:004"); 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"); --- 133,136 ---- *************** *** 174,178 **** while(graph_link != NULL) { - warnx("OUTPUT:005"); graph = graph_link->graph; LIST_FOREACH(node_link, graph->node_list, list) --- 138,141 ---- *************** *** 264,267 **** --- 227,249 ---- } + 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; + } + /* DONE */ |