From 79168e1254eb542dde16d97e070328fc7349ce05 Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Mon, 29 Feb 2016 04:56:37 +0100 Subject: [PATCH] wrapper: resolve "boinc_resolve(...)" phrases in command-line --- samples/wrapper/wrapper.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/samples/wrapper/wrapper.cpp b/samples/wrapper/wrapper.cpp index 2798811dee..97a12c5e27 100644 --- a/samples/wrapper/wrapper.cpp +++ b/samples/wrapper/wrapper.cpp @@ -645,6 +645,32 @@ int TASK::run(int argct, char** argvt) { } } + // resolve "boinc_resolve(...)" phrases in command-line + while (1) { + char lbuf[16384]; + char fname[1024]; + char *from, *to; + + strncpy (lbuf, command_line.c_str(), sizeof(lbuf)); + lbuf[sizeof(lbuf)-1] = '\0'; + from = strstr(lbuf, "boinc_resolve("); + if (!from) { + break; + } + to = strchr(from, ')'); + if (!to) { + fprintf(stderr, "missing ')' after 'boinc_resolve('\n"); + exit(1); + } + *to = 0; + boinc_resolve_filename(from + strlen("boinc_resolve("), fname, sizeof(fname)); +#ifdef _WIN32 + slash_to_backslash(fname); +#endif + *from = 0; + command_line = string(lbuf) + string(fname) + string(to+1); + } + fprintf(stderr, "%s wrapper: running %s (%s)\n", boinc_msg_prefix(buf, sizeof(buf)), app_path, command_line.c_str() );