diff --git a/tools/backend_lib.C b/tools/backend_lib.C
index 50c09d4bac..907e450a05 100644
--- a/tools/backend_lib.C
+++ b/tools/backend_lib.C
@@ -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 ""
+#define RESULT_NAME_MACRO ""
+#define OUTFILE_MACRO ""
+#define DOWNLOAD_URL_MACRO ""
+#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);
}
diff --git a/tools/create_work.C b/tools/create_work.C
index 5b1d173abc..4e4640a522 100644
--- a/tools/create_work.C
+++ b/tools/create_work.C
@@ -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;
diff --git a/tools/process_result_template.C b/tools/process_result_template.C
index 5ae4cd2d77..f2563e95d9 100644
--- a/tools/process_result_template.C
+++ b/tools/process_result_template.C
@@ -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 ""
+#define RESULT_NAME_MACRO ""
+#define OUTFILE_MACRO ""
+#define DOWNLOAD_URL_MACRO ""
+#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);