From: Robert K. <may...@us...> - 2001-07-23 21:22:38
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv23145/lib Modified Files: main.c plugin_man.c Log Message: Updated the version number, added a ChangeLog file and applied the -f patch. Index: main.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/main.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** main.c 2001/06/18 07:27:17 1.23 --- main.c 2001/07/23 21:22:34 1.24 *************** *** 9,12 **** --- 9,13 ---- #include <stdlib.h> #include <string.h> + #include <ctype.h> #include "bc_version.h" *************** *** 107,111 **** /* Load the plugins from the build dir first if ./plugins exists */ if (printDebugInfo) ! printf("Loading plugins from ./plugins:\n"); total = load_plugins(bc, "./plugins", printDebugInfo); --- 108,112 ---- /* Load the plugins from the build dir first if ./plugins exists */ if (printDebugInfo) ! fprintf(stderr, "Loading plugins from ./plugins:\n"); total = load_plugins(bc, "./plugins", printDebugInfo); *************** *** 116,120 **** sprintf(path, "%s/.bitcollider/plugins", ptr); if (printDebugInfo) ! printf("Loading plugins from %s:\n", path); total += load_plugins(bc, path, printDebugInfo); } --- 117,121 ---- sprintf(path, "%s/.bitcollider/plugins", ptr); if (printDebugInfo) ! fprintf(stderr, "Loading plugins from %s:\n", path); total += load_plugins(bc, path, printDebugInfo); } *************** *** 155,163 **** { if (printDebugInfo) ! printf("Loading plugins from %s:\n", ptr); total += load_plugins(bc, ptr, printDebugInfo); } if (printDebugInfo) ! printf("Loaded %d plugins total.\n\n", total); return bc; --- 156,164 ---- { if (printDebugInfo) ! fprintf(stderr, "Loading plugins from %s:\n", ptr); total += load_plugins(bc, ptr, printDebugInfo); } if (printDebugInfo) ! fprintf(stderr, "Loaded %d plugins total.\n\n", total); return bc; *************** *** 170,173 **** --- 171,260 ---- } + BitcolliderSubmission *read_submission_from_file(Bitcollider *bc, FILE *infile) + { + BitcolliderSubmission *submission; + char buf[BUFFER_LEN], last[BUFFER_LEN], temp[BUFFER_LEN]; + char *c, *t; + int line, empty = 1; + + submission = (BitcolliderSubmission *)malloc(sizeof(BitcolliderSubmission)); + if (submission == NULL) + return NULL; + + memset(submission, 0, sizeof(BitcolliderSubmission)); + submission->bc = bc; + + last[0] = 0; + + for( line = 1; fgets( buf, BUFFER_LEN, infile ) != NULL; ++line ) + { + if( ! ( ( t = strchr( buf, '\r' ) ) || ( t = strchr( buf, '\n' ) ) ) ) + { + if( strlen( buf ) == BUFFER_LEN - 1 ) + { + fprintf( stderr, "Line %d exceeds length limit\n", line ); + exit(1); + } + else + { + fprintf( stderr, "Line %d is truncated\n", line ); + exit(1); + } + } + *t = 0; + + for( c = buf; *c == ' ' && *c == '\t'; ++c ) + ; /* <-- Empty for loop */ + + if( ! *c || *c == '#' ) + continue; + + if( ! ( t = strchr( c, '=' ) ) ) + { + fprintf( stderr, "Line %d does not appear to contain a tag\n", + line ); + exit(1); + } + *t = 0; + if( ! strncmp( c, "head.", 5 ) ) + continue; + if( isdigit( *c ) ) + { + if( ! ( t = strchr( c, '.' ) ) ) + { + fprintf(stderr, "Line %d does not appear to contain a tag\n", + line ); + exit(1); + } + *t = 0; + + strcpy( last, c ); + c = t + 1; + } + if (empty) + { + empty = 0; + get_agent_string(temp); + add_attribute(submission, "head.agent", temp); + + sprintf(temp, "S%s", BC_SUBMITSPECVER); + add_attribute(submission, "head.version", temp); + } + + if(strncmp(c, "bitprint", 8) == 0) + { + if (submission->numBitprints == 1) + convert_to_multiple_submission(submission); + + submission->numBitprints++; + } + submission->numBitprints--; + add_attribute( submission, c, c + strlen( c ) + 1 ); + submission->numBitprints++; + } + + return submission; + } + BitcolliderSubmission *create_submission(Bitcollider *bc) { *************** *** 734,738 **** #ifdef _WIN32 ! GetTempPath(MAX_PATH, tempFile); strcat(tempFile, "bitprint.htm"); #else --- 821,825 ---- #ifdef _WIN32 ! GetTempPath(MAX_PATH, tempFile); strcat(tempFile, "bitprint.htm"); #else *************** *** 826,830 **** int i; - printf("\n"); for(i = 0; i < submission->numItems; i++) { --- 913,916 ---- Index: plugin_man.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/plugin_man.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** plugin_man.c 2001/07/09 21:19:52 1.11 --- plugin_man.c 2001/07/23 21:22:34 1.12 *************** *** 11,15 **** #include <sys/types.h> #include <dirent.h> ! #include <ltdl.h> #include "bitcollider.h" --- 11,15 ---- #include <sys/types.h> #include <dirent.h> ! #include "libltdl/ltdl.h" #include "bitcollider.h" *************** *** 41,44 **** --- 41,45 ---- } + #ifndef NO_PLUGINS int load_plugins(Bitcollider *bc, const char *path, b_bool printDebugInfo) { *************** *** 65,69 **** if (printDebugInfo) ! printf(" %s: ", entry->d_name); sprintf(file, "%s/%s", path, entry->d_name); --- 66,70 ---- if (printDebugInfo) ! fprintf(stderr, " %s: ", entry->d_name); sprintf(file, "%s/%s", path, entry->d_name); *************** *** 73,77 **** { if (printDebugInfo) ! printf("Cannot load plugin %s. (%s)\n", file, lt_dlerror()); continue; } --- 74,79 ---- { if (printDebugInfo) ! fprintf(stderr, "Cannot load plugin %s. (%s)\n", ! file, lt_dlerror()); continue; } *************** *** 85,89 **** lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) ! printf("Cannot find entry point in %s.\n", file); continue; } --- 87,91 ---- lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) ! fprintf(stderr, "Cannot find entry point in %s.\n", file); continue; } *************** *** 95,99 **** lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) ! printf("Cannot retrieve supported methods from %s.\n", file); continue; } --- 97,102 ---- lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) ! fprintf(stderr, "Cannot retrieve supported methods from %s.\n", ! file); continue; } *************** *** 105,111 **** if (printDebugInfo) { ! printf("%s ", bc->plugins[bc->numPluginsLoaded].methods->get_name()); ! printf("(%s)\n", bc->plugins[bc->numPluginsLoaded].methods-> ! get_version()); } --- 108,115 ---- if (printDebugInfo) { ! fprintf(stderr, "%s ", bc->plugins[bc->numPluginsLoaded]. ! methods->get_name()); ! fprintf(stderr, "(%s)\n", bc->plugins[bc->numPluginsLoaded]. ! methods->get_version()); } *************** *** 118,123 **** { if (printDebugInfo) ! printf(" [Plugin %s has already been loaded. Skipping.]\n", ! bc->plugins[bc->numPluginsLoaded].file); bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); --- 122,127 ---- { if (printDebugInfo) ! fprintf(stderr, " [Plugin %s has already been loaded. " ! "Skipping.]\n", bc->plugins[bc->numPluginsLoaded].file); bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); *************** *** 163,166 **** --- 167,180 ---- } } + #else + int load_plugins(Bitcollider *bc, const char *path, b_bool printDebugInfo) + { + return 0; + } + + void unload_plugins(Bitcollider *bc) + { + } + #endif int get_num_plugins(Bitcollider *bc) |