OSD strtoken maintenance

git-svn-id: https://svn.eduke32.com/eduke32@7040 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-10-07 05:23:20 +00:00
parent d9be193392
commit 217849b2a3

View file

@ -708,7 +708,7 @@ void OSD_Init(void)
};
for (unsigned i=0; i<ARRAY_SIZE(cvars_osd); i++)
OSD_RegisterCvar(&cvars_osd[i], cvars_osd[i].flags & CVAR_FUNCPTR ? osdcmd_cvar_set_osd : osdcmd_cvar_set);
OSD_RegisterCvar(&cvars_osd[i], (cvars_osd[i].flags & CVAR_FUNCPTR) ? osdcmd_cvar_set_osd : osdcmd_cvar_set);
OSD_RegisterFunction("alias", "alias: creates an alias for calling multiple commands", osdfunc_alias);
OSD_RegisterFunction("clear", "clear: clears the console text buffer", osdfunc_clear);
@ -1471,7 +1471,7 @@ void OSD_Draw(void)
return;
if (osdrowscur == 0)
OSD_ShowDisplay(osd->flags & OSD_DRAW ? 0 : 1);
OSD_ShowDisplay((osd->flags & OSD_DRAW) ? 0 : 1);
if (osdrowscur == osd->draw.rows)
osd->draw.scrolling = 0;
@ -1725,20 +1725,18 @@ void OSD_DispatchQueued(void)
static char *strtoken(char *s, char **ptrptr, int32_t *restart)
{
char *p, *p2, *start;
*restart = 0;
if (!ptrptr) return NULL;
// if s != NULL, we process from the start of s, otherwise
// we just continue with where ptrptr points to
if (s) p = s;
else p = *ptrptr;
char *p = s ? s : *ptrptr;
if (!p) return NULL;
// eat up any leading whitespace
while (*p && *p == ' ') p++;
while (*p == ' ') p++;
// a semicolon is an end of statement delimiter like a \0 is, so we signal
// the caller to 'restart' for the rest of the string pointed at by *ptrptr
@ -1755,11 +1753,13 @@ static char *strtoken(char *s, char **ptrptr, int32_t *restart)
return NULL;
}
char *start;
if (*p == '\"')
{
// quoted string
start = ++p;
p2 = p;
char *p2 = p;
while (*p != 0)
{
if (*p == '\"')