diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-10-13 13:15:27 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-10-13 13:15:27 +0000 |
commit | 425c25a1fad20be0bcdd4825c0ad514513d698aa (patch) | |
tree | 2e9f603d8532d56a36326ce8d447a0c2b055d5cc /usr.bin/tmux/client.c | |
parent | f0880ce97122e4508007259ee9cf76a7d8c15338 (diff) |
Do this in a better way - print messages when exiting with nonzero.
Also remove the login shell information from server-info, only the client
should care about it.
Diffstat (limited to 'usr.bin/tmux/client.c')
-rw-r--r-- | usr.bin/tmux/client.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c index 1d90031f996..129832d23d9 100644 --- a/usr.bin/tmux/client.c +++ b/usr.bin/tmux/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.23 2009/10/13 13:11:06 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.24 2009/10/13 13:15:26 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -216,32 +216,33 @@ out: * Print exit status message, unless running as a login shell where it * would either be pointless or irritating. */ - if (!login_shell) { - if (sigterm) { - printf("[terminated]\n"); + if (sigterm) { + printf("[terminated]\n"); + return (1); + } + switch (cctx->exittype) { + case CCTX_DIED: + printf("[lost server]\n"); + return (0); + case CCTX_SHUTDOWN: + if (!login_shell) + printf("[server exited]\n"); + return (0); + case CCTX_EXIT: + if (cctx->errstr != NULL) { + printf("[error: %s]\n", cctx->errstr); return (1); } - switch (cctx->exittype) { - case CCTX_DIED: - printf("[lost server]\n"); - return (0); - case CCTX_SHUTDOWN: - printf("[server exited]\n"); - return (0); - case CCTX_EXIT: - if (cctx->errstr != NULL) { - printf("[error: %s]\n", cctx->errstr); - return (1); - } + if (!login_shell) printf("[exited]\n"); - return (0); - case CCTX_DETACH: + return (0); + case CCTX_DETACH: + if (!login_shell) printf("[detached]\n"); - return (0); - default: - printf("[unknown error]\n"); - return (1); - } + return (0); + default: + printf("[unknown error]\n"); + return (1); } } |