#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
};
static bool
{
ssize_t r;
if (!item) {
fprintf(stderr, "ERROR: Could not allocate memory for an element\n");
goto err;
}
if (r < 0) {
fprintf(stderr, "ERROR: Failed in receiving the message\n");
goto err;
}
return true;
err:
return false;
}
static bool
{
int r = -1;
if (!item) {
fprintf(stderr, "ERROR: Could not take the vector's element\n");
return false;
}
if (r < 0) {
fprintf(stderr, "ERROR: Could not send data\n");
goto end;
}
r = 0;
end:
return (r < 0) ? false : true;
}
static void
{
static const struct option opts[] = {
{ "port", required_argument, NULL, 'p' },
{ "help", no_argument, NULL, 'h' },
{ 0, 0, 0, 0 }
};
},
};
};
while ((c = getopt_long(argc, argv, "p:h", opts, &opt_idx)) != -1) {
switch (c) {
case 'p':
addr.port = atoi(optarg);
break;
case 'h':
default:
fprintf(stderr,
"Usage:\n\t%s [-p <port to bind>]\n"
"\tIf any port is given a random port will be monitored\n", argv[0]);
return;
}
}
if (!sock) {
fprintf(stderr, "ERROR: Could not create the socket\n");
goto err;
}
if (c < 0) {
goto err;
}
return;
err:
}
static void
{
uint16_t i;
if (sock)
}
}