diff --git a/src/d_main.c b/src/d_main.c index d954fa4d1..ec63242b8 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -895,7 +895,7 @@ static void IdentifyVersion(void) { size_t i; - CONS_Printf("srb2:// connect links load game files from the SRB2 application's stored directory. Switching to "); + CONS_Printf("%s connect links load game files from the SRB2 application's stored directory. Switching to ", SERVER_URL_PROTOCOL); strlcpy(srb2path, myargv[0], sizeof(srb2path)); // Get just the directory, minus the EXE name diff --git a/src/doomdef.h b/src/doomdef.h index 71c885019..5a5c933e3 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -150,6 +150,9 @@ extern char logfilename[1024]; // Otherwise we can't force updates! #endif +/* A custom URL protocol for server links. */ +#define SERVER_URL_PROTOCOL "srb2://" + // Does this version require an added patch file? // Comment or uncomment this as necessary. #define USE_PATCH_DTA diff --git a/src/m_argv.c b/src/m_argv.c index d7d1f4463..7d43d96bc 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -41,12 +41,13 @@ static INT32 found; const char *M_GetUrlProtocolArg(void) { INT32 i; + const size_t len = strlen(SERVER_URL_PROTOCOL); for (i = 1; i < myargc; i++) { - if (!strnicmp(myargv[i], "srb2://", 7)) + if (strlen(myargv[i]) > len && !strnicmp(myargv[i], SERVER_URL_PROTOCOL, len)) { - return &myargv[i][7]; + return &myargv[i][len]; } }