mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
- luaclient: formatting code using astyle
This commit is contained in:
@@ -48,7 +48,8 @@ int main(int argc, char** argv)
|
|||||||
if (!strcmp(cmd, "luaclient"))
|
if (!strcmp(cmd, "luaclient"))
|
||||||
argv++, argc--;
|
argv++, argc--;
|
||||||
|
|
||||||
if (!*argv) {
|
if (!*argv)
|
||||||
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: luaclient [command [arguments ...]]\n"
|
"Usage: luaclient [command [arguments ...]]\n"
|
||||||
" or: command [arguments ...] (with command being a link to luaclient)\n");
|
" or: command [arguments ...] (with command being a link to luaclient)\n");
|
||||||
@@ -57,7 +58,8 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
size_t len[argc];
|
size_t len[argc];
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
len[i] = strlen(argv[i]) + 1;
|
len[i] = strlen(argv[i]) + 1;
|
||||||
size += len[i];
|
size += len[i];
|
||||||
}
|
}
|
||||||
@@ -67,7 +69,8 @@ int main(int argc, char** argv)
|
|||||||
memcpy(b, &size, sizeof(size));
|
memcpy(b, &size, sizeof(size));
|
||||||
size += sizeof(size);
|
size += sizeof(size);
|
||||||
b += sizeof(size);
|
b += sizeof(size);
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
memcpy(b, argv[i], len[i]);
|
memcpy(b, argv[i], len[i]);
|
||||||
b += len[i];
|
b += len[i];
|
||||||
}
|
}
|
||||||
@@ -78,23 +81,27 @@ int main(int argc, char** argv)
|
|||||||
char *resp = NULL;
|
char *resp = NULL;
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
|
|
||||||
if (!client.Send(data, size)) {
|
if (!client.Send(data, size))
|
||||||
|
{
|
||||||
fun = "Send failed";
|
fun = "Send failed";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (!client.Recv((char *)&size, sizeof(size))) {
|
if (!client.Recv((char *)&size, sizeof(size)))
|
||||||
|
{
|
||||||
fun = "Recv (1) failed";
|
fun = "Recv (1) failed";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (size)
|
if (size)
|
||||||
result = (char *) malloc(size);
|
result = (char *) malloc(size);
|
||||||
|
|
||||||
if (result && !client.Recv(result, size)) {
|
if (result && !client.Recv(result, size))
|
||||||
|
{
|
||||||
fun = "Recv (2) failed";
|
fun = "Recv (2) failed";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result[size - 1]) {
|
if (result[size - 1])
|
||||||
|
{
|
||||||
fun = "unterminated result";
|
fun = "unterminated result";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user