ipc: Ignore whitespace only command lines

Avoiding error dialog.
This commit is contained in:
Kim Woelders 2023-12-23 09:20:44 +01:00
parent d094c7d925
commit 33d89e9b07
1 changed files with 10 additions and 6 deletions

View File

@ -1882,15 +1882,19 @@ IpcExec(const char *params)
if (EDebug(EDBUG_TYPE_IPC))
Eprintf("%s: '%s'\n", __func__, params);
cmd[0] = 0;
cmd[0] = '\0';
num = 0;
if (params)
sscanf(params, "%100s %n", cmd, &num);
prm = (num > 0 && params[num]) ? params + num : NULL;
ok = 1;
if (cmd[0] == '\0')
goto done; /* Accept empty input */
lst = IPC_GetList(&num);
ok = 0;
for (i = 0; i < num; i++)
{
ipc = lst[i];
@ -1899,16 +1903,16 @@ IpcExec(const char *params)
ipc->func(prm);
ok = 1;
break;
goto done;
}
if (!ok && params)
ok = IPC_Compat(params);
/* Commmand not found - check the legacy ones */
ok = IPC_Compat(params);
if (!ok)
IpcPrintf("Unknown command: '%s'\n", params);
done:
return ok;
}