Added XML tagging to result and wu files.

svn path=/trunk/boinc/; revision=43
This commit is contained in:
Eric Heien 2002-05-14 23:13:17 +00:00
parent 55819aa6cb
commit b8293c3c9d
3 changed files with 53 additions and 13 deletions

View File

@ -26,11 +26,15 @@
#include "backend_lib.h"
#define INFILE_MACRO "INFILE_"
#define MD5_MACRO "MD5_"
#define WU_NAME_MACRO "WU_NAME"
#define RESULT_NAME_MACRO "RESULT_NAME"
#define OUTFILE_MACRO "OUTFILE_"
#define INFILE_MACRO "<INFILE_"
#define MD5_MACRO "<MD5_"
#define WU_NAME_MACRO "<WU_NAME/>"
#define RESULT_NAME_MACRO "<RESULT_NAME/>"
#define OUTFILE_MACRO "<OUTFILE_"
#define UPLOAD_URL_MACRO "<UPLOAD_URL/>"
#define DOWNLOAD_URL_MACRO "<DOWNLOAD_URL/>"
#define UPLOAD_URL "http://localhost/upload/"
#define DOWNLOAD_URL "http://localhost/download/"
int read_file(char* path, char* buf) {
FILE* f = fopen(path, "r");
@ -66,10 +70,24 @@ static int process_wu_template(
fprintf(stderr, "invalid file number\n");
return 1;
}
strcpy(buf, p+strlen(INFILE_MACRO)+1); // assume <= 10 files
strcpy(buf, p+strlen(INFILE_MACRO)+1+2); // assume <= 10 files
strcpy(p, infiles[i]);
strcat(p, buf);
}
p = strstr(out, UPLOAD_URL_MACRO);
if (p) {
found = true;
strcpy(buf, p+strlen(UPLOAD_URL_MACRO));
strcpy(p, UPLOAD_URL);
strcat(p, buf);
}
p = strstr(out, DOWNLOAD_URL_MACRO);
if (p) {
found = true;
strcpy(buf, p+strlen(DOWNLOAD_URL_MACRO));
strcpy(p, DOWNLOAD_URL);
strcat(p, buf);
}
p = strstr(out, MD5_MACRO);
if (p) {
found = true;
@ -80,7 +98,7 @@ static int process_wu_template(
}
sprintf(path, "%s/%s", dirpath, infiles[i]);
md5_file(path, md5, nbytes);
strcpy(buf, p+strlen(MD5_MACRO)+1); // assume <= 10 files
strcpy(buf, p+strlen(MD5_MACRO)+1+2); // assume <= 10 files
strcpy(p, md5);
strcat(p, buf);
}

View File

@ -44,7 +44,7 @@
#include "db.h"
#include "backend_lib.h"
#define INFILE_DIR "/mydisks/a/users/eheien/public_html/download"
#define INFILE_DIR "/disks/jill/a/inet_services/boinc_www/share/htdocs/download"
int main(int argc, char** argv) {
APP app;

View File

@ -22,9 +22,13 @@
#include "db.h"
#define WU_NAME_MACRO "WU_NAME"
#define RESULT_NAME_MACRO "RESULT_NAME"
#define OUTFILE_MACRO "OUTFILE_"
#define WU_NAME_MACRO "<WU_NAME/>"
#define RESULT_NAME_MACRO "<RESULT_NAME/>"
#define OUTFILE_MACRO "<OUTFILE_"
#define UPLOAD_URL_MACRO "<UPLOAD_URL/>"
#define DOWNLOAD_URL_MACRO "<DOWNLOAD_URL/>"
#define UPLOAD_URL "http://localhost/upload/"
#define DOWNLOAD_URL "http://localhost/download/"
// replace OUTFILE_x with base_filename_x,
// WU_NAME with WU name
@ -33,8 +37,9 @@
int process_result_template(
char* out, char* base_filename, char* wu_name, char* result_name
) {
char* p;
char* p,*q;
char buf[MAX_BLOB_SIZE];
char num;
int i;
bool found;
@ -44,8 +49,25 @@ int process_result_template(
if (p) {
found = true;
i = atoi(p+strlen(OUTFILE_MACRO));
strcpy(buf, p+strlen(OUTFILE_MACRO));
q = p+strlen(OUTFILE_MACRO);
num = q[0];
strcpy(buf, p+strlen(OUTFILE_MACRO)+1+2);
strcpy(p, base_filename);
strncat(p, &num, 1);
strcat(p, buf);
}
p = strstr(out, UPLOAD_URL_MACRO);
if (p) {
found = true;
strcpy(buf, p+strlen(UPLOAD_URL_MACRO));
strcpy(p, UPLOAD_URL);
strcat(p, buf);
}
p = strstr(out, DOWNLOAD_URL_MACRO);
if (p) {
found = true;
strcpy(buf, p+strlen(DOWNLOAD_URL_MACRO));
strcpy(p, DOWNLOAD_URL);
strcat(p, buf);
}
p = strstr(out, WU_NAME_MACRO);