mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Cleaned up redundant inline comments in the exec plugin’s command execution path (pipe creation, buffer termination, per-line announce handling, sleep loop, and trailing newline output) without changing behavior.
This commit is contained in:
@@ -71,7 +71,7 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
|||||||
strcat (commandLine, word_eol[2]);
|
strcat (commandLine, word_eol[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePipe (&readPipe, &writePipe, &secattr, 0); /* might be replaced with MyCreatePipeEx */
|
CreatePipe (&readPipe, &writePipe, &secattr, 0);
|
||||||
|
|
||||||
ZeroMemory (&sInfo, sizeof (sInfo));
|
ZeroMemory (&sInfo, sizeof (sInfo));
|
||||||
ZeroMemory (&pInfo, sizeof (pInfo));
|
ZeroMemory (&pInfo, sizeof (pInfo));
|
||||||
@@ -91,12 +91,10 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
|||||||
{
|
{
|
||||||
if (ReadFile (readPipe, buffer, sizeof (buffer) - 1, &dwRead, NULL) && dwRead != 0 )
|
if (ReadFile (readPipe, buffer, sizeof (buffer) - 1, &dwRead, NULL) && dwRead != 0 )
|
||||||
{
|
{
|
||||||
/* avoid garbage */
|
|
||||||
buffer[dwRead] = '\0';
|
buffer[dwRead] = '\0';
|
||||||
|
|
||||||
if (announce)
|
if (announce)
|
||||||
{
|
{
|
||||||
/* Say each line seperately, TODO: improve... */
|
|
||||||
token = strtok_s (buffer, "\n", &context);
|
token = strtok_s (buffer, "\n", &context);
|
||||||
while (token != NULL)
|
while (token != NULL)
|
||||||
{
|
{
|
||||||
@@ -110,13 +108,11 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* this way we'll more likely get full lines */
|
|
||||||
SleepEx (100, TRUE);
|
SleepEx (100, TRUE);
|
||||||
}
|
}
|
||||||
timeElapsed = difftime (time (0), start);
|
timeElapsed = difftime (time (0), start);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* display a newline to separate things */
|
|
||||||
if (!announce)
|
if (!announce)
|
||||||
zoitechat_printf (ph, "\n");
|
zoitechat_printf (ph, "\n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user