version 1.3, 2009/06/25 22:09:20 |
version 1.4, 2009/07/22 21:58:56 |
|
|
void client_handle_winch(struct client_ctx *); |
void client_handle_winch(struct client_ctx *); |
|
|
int |
int |
client_init(char *path, struct client_ctx *cctx, int start_server, int flags) |
client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags) |
{ |
{ |
struct sockaddr_un sa; |
struct sockaddr_un sa; |
struct stat sb; |
struct stat sb; |
|
|
setproctitle("client (%s)", rpathbuf); |
setproctitle("client (%s)", rpathbuf); |
|
|
if (lstat(path, &sb) != 0) { |
if (lstat(path, &sb) != 0) { |
if (start_server && errno == ENOENT) { |
if (cmdflags & CMD_STARTSERVER && errno == ENOENT) { |
if ((cctx->srv_fd = server_start(path)) == -1) |
if ((cctx->srv_fd = server_start(path)) == -1) |
goto start_failed; |
goto start_failed; |
goto server_started; |
goto server_started; |
|
|
if (connect( |
if (connect( |
cctx->srv_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1) { |
cctx->srv_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1) { |
if (errno == ECONNREFUSED) { |
if (errno == ECONNREFUSED) { |
if (unlink(path) != 0 || !start_server) |
if (unlink(path) != 0 || !(cmdflags & CMD_STARTSERVER)) |
goto not_found; |
goto not_found; |
if ((cctx->srv_fd = server_start(path)) == -1) |
if ((cctx->srv_fd = server_start(path)) == -1) |
goto start_failed; |
goto start_failed; |