summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/client.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-10-13 13:15:26 +0000
committernicm <nicm@openbsd.org>2009-10-13 13:15:26 +0000
commit734dfcbc993b29657c8a9a6365ddacb74b99f61c (patch)
tree9e06b64cea349346c7b0248a20d24144626df734 /usr.bin/tmux/client.c
parentDon't print exit messages when used as a login shell, requested by martynas@ a (diff)
downloadwireguard-openbsd-734dfcbc993b29657c8a9a6365ddacb74b99f61c.tar.xz
wireguard-openbsd-734dfcbc993b29657c8a9a6365ddacb74b99f61c.zip
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.c47
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);
}
}