modify main-s.c to act as both server and client
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
93200c9936
commit
e14b8e1e04
35
bin/main-s.c
35
bin/main-s.c
@ -498,7 +498,7 @@ static int handle_incpath (hcl_server_t* server, const char* str)
|
|||||||
#define MIN_WORKER_STACK_SIZE 512000ul
|
#define MIN_WORKER_STACK_SIZE 512000ul
|
||||||
#define MIN_ACTOR_HEAP_SIZE 512000ul
|
#define MIN_ACTOR_HEAP_SIZE 512000ul
|
||||||
|
|
||||||
int main (int argc, char* argv[])
|
int server_main (const char* outer, int argc, char* argv[])
|
||||||
{
|
{
|
||||||
hcl_bci_t c;
|
hcl_bci_t c;
|
||||||
static hcl_bopt_lng_t lopt[] =
|
static hcl_bopt_lng_t lopt[] =
|
||||||
@ -674,3 +674,36 @@ oops:
|
|||||||
if (server) hcl_server_close (server);
|
if (server) hcl_server_close (server);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static void print_main_usage (const char* argv0)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "USAGE: %s server|client\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (int argc, char* argv[])
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
print_main_usage (argv[0]);
|
||||||
|
n = -1;
|
||||||
|
}
|
||||||
|
else if (strcmp(argv[1], "server") == 0)
|
||||||
|
{
|
||||||
|
n = server_main(argv[0], argc -1, &argv[1]);
|
||||||
|
}
|
||||||
|
else if (strcmp(argv[1], "client") == 0)
|
||||||
|
{
|
||||||
|
n = client_main(argv[0], argc -1, &argv[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print_main_usage (argv[0]);
|
||||||
|
n = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user