16 static int server(Arguments &arguments)
19 Parsed_Logger logger(arguments);
21 std::string default_endpoint_path =
"joedb.sock";
22 for (
size_t i = 1; i < arguments.size(); i++)
24 const beman::cstring_view v = arguments[i];
25 if (v.ends_with(
".joedb"))
27 default_endpoint_path = std::string(v) +
".sock";
32 const std::string_view endpoint_path = arguments.get_string_option
36 default_endpoint_path.c_str()
39 const float timeout_seconds = arguments.get_option<
float>
48 Parsed_Client parsed_client
56 if (!parsed_client.get())
58 arguments.print_help(std::cerr) <<
'\n';
59 parsed_client.print_help(std::cerr);
63 Client &client = *parsed_client.get();
67 "creating server, endpoint_path = " + std::string(endpoint_path) +
68 "; timeout = " + std::to_string(timeout_seconds)
71 const int thread_count = 1;
76 logger.get_log_level(),
78 std::string(endpoint_path),
80 std::chrono::milliseconds(std::lround(timeout_seconds * 1000))
90int main(
int argc,
char **argv)
@ write_existing_or_create_new
either write_existing or create_new depending on whether the file exists. Racy in Posix,...
int main_wrapper(int(*main)(Arguments &), int argc, char **argv)
Process command-line arguments and catch exceptions from main.