diff options
Diffstat (limited to 'indra/win_updater/updater.cpp')
-rw-r--r-- | indra/win_updater/updater.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/indra/win_updater/updater.cpp b/indra/win_updater/updater.cpp index 96ffd5f66a..c139d2f55c 100644 --- a/indra/win_updater/updater.cpp +++ b/indra/win_updater/updater.cpp @@ -7,7 +7,7 @@ */ // -// Usage: updater -userserver <server> [-name <window_title>] [-program <program_name>] [-silent] +// Usage: updater -url <url> [-name <window_title>] [-program <program_name>] [-silent] // #include <windows.h> @@ -23,7 +23,7 @@ int gTotalBytesRead = 0; HWND gWindow = NULL; WCHAR gProgress[256]; -char* gUserServer; +char* gUpdateURL; char* gProgramName; char* gProductName; bool gIsSilent; @@ -254,28 +254,20 @@ LRESULT CALLBACK WinProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) } #define win_class_name L"FullScreen" -#define UPDATE_URIBASE L"http://secondlife.com/update.php?userserver=" int parse_args(int argc, char **argv) { - // Check for old-type arguments. - if (2 == argc) - { - gUserServer = argv[1]; - return 0; - } - int j; for (j = 1; j < argc; j++) { - if ((!strcmp(argv[j], "-userserver")) && (++j < argc)) + if ((!strcmp(argv[j], "-name")) && (++j < argc)) { - gUserServer = argv[j]; + gProductName = argv[j]; } - else if ((!strcmp(argv[j], "-name")) && (++j < argc)) + else if ((!strcmp(argv[j], "-url")) && (++j < argc)) { - gProductName = argv[j]; + gUpdateURL = argv[j]; } else if ((!strcmp(argv[j], "-program")) && (++j < argc)) { @@ -288,7 +280,7 @@ int parse_args(int argc, char **argv) } // If nothing was set, let the caller know. - if (!gUserServer && !gProductName && !gProgramName && !gIsSilent) + if (!gProductName && !gProgramName && !gIsSilent && !gUpdateURL) { return 1; } @@ -339,7 +331,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho } } - gUserServer = NULL; + gUpdateURL = NULL; gProgramName = NULL; gProductName = NULL; gIsSilent = false; @@ -373,7 +365,6 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho DEVMODE dev_mode = { 0 }; char update_exec_path[MAX_PATH]; /* Flawfinder: ignore */ char *ptr; - WCHAR update_uri[4096]; const int WINDOW_WIDTH = 250; const int WINDOW_HEIGHT = 100; @@ -408,15 +399,15 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho if (parse_args_result) { MessageBox(gWindow, - L"Usage: updater -userserver <server> [-name <window_title>] [-program <program_name>] [-silent]", + L"Usage: updater -url <url> [-name <window_title>] [-program <program_name>] [-silent]", L"Usage", MB_OK); return parse_args_result; } // Did we get a userserver to work with? - if (!gUserServer) + if (!gUpdateURL) { - MessageBox(gWindow, L"Please specify the IP address of the userserver on the command line", + MessageBox(gWindow, L"Please specify the download url from the command line", L"Error", MB_OK); return 1; } @@ -440,10 +431,9 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho *(ptr + 2) = 'x'; *(ptr + 3) = 'e'; *(ptr + 4) = 0; - wcscpy(update_uri, UPDATE_URIBASE); /* Flawfinder: ignore */ - WCHAR wcmdline[2048]; - mbstowcs(wcmdline, gUserServer, 2048); - wcscat(update_uri, wcmdline); /* Flawfinder: ignore */ + + WCHAR update_uri[4096]; + mbstowcs(update_uri, gUpdateURL, 4096); int success; int cancelled; |