summaryrefslogtreecommitdiffstats
path: root/client.c
AgeCommit message (Collapse)Author
2013-03-22No more lint means no more ARGSUSED.Nicholas Marriott
2012-09-03If stdin in the client is enable immediately, tmux will eat anythingNicholas Marriott
sent to stdin before it is needed, which can be inconvenient (eg pasting commands). Instead, start with stdin disabled and reuse MSG_STDIN from server->client to mean that stdin should be enabled. Based on a diff from Chris Johnsen.
2012-08-27Change a log to fprintf that was missed last time around, from Tiago Cunha.Nicholas Marriott
2012-07-10xfree is not particularly helpful, remove it. From Thomas Adam.Nicholas Marriott
2012-06-18Actually write all the data to stdout/stderr.Nicholas Marriott
2012-06-18Add a skeleton mode to tmux (called "control mode") that let's tmuxNicholas Marriott
commands be sent and output received on stdout. This can be used to integrate with other terminal emulators and should allow some other things to be made simpler later. More to come so doesn't do much yet and deliberately not documented.
2012-05-25Simplify logging and just fprintf(stderr, ...) for early errors.Nicholas Marriott
2012-05-21Instead of passing stdin/stdout/stderr file descriptors over imsg andNicholas Marriott
handling them in the server, handle them in the client and pass buffers over imsg. This is much tidier for some upcoming changes and the performance hit isn't critical. The tty fd is still passed to the server as before. This bumps the tmux protocol version so new clients and old servers are incompatible.
2012-04-23Add missing prototype.Nicholas Marriott
2012-04-23Use an enum for client exit reasons, from George Nachman.Nicholas Marriott
2012-03-24Add sys/file.h.Nicholas Marriott
2012-03-19Move MSG_IDENTIFY to the last sent by the client, this will be needed byNicholas Marriott
control clients and irrelevant for others.
2012-03-09Use a lock file and flock() to serialize server start, avoids problemsNicholas Marriott
when running a bunch of tmux from cron at the same time. Based on a diff from Tim Ruehsen.
2011-03-03Add a -P option to detach to HUP the client's parent process (usuallyNicholas Marriott
causing it to exit as well).
2011-01-08Move all calls to fcntl(...O_NONBLOCK) into a function and clear theNicholas Marriott
flag on the stdio file descriptors before closing them (fixes things like "tmux ls && cat").
2010-10-18Merge the before and after attach client code into one in client.cNicholas Marriott
(instead of two in tmux.c and client.c).
2010-10-16Trying to set FD_CLOEXEC on every fd is a lost cause, just useNicholas Marriott
closefrom() before exec.
2010-08-23Can't call event_del() without event_set() first - so call event_set()Nicholas Marriott
when setting up the client.
2010-08-22MSG_EXIT can now have a return code in the message, so check for thatNicholas Marriott
size as well. Stops the client fatal()ing on exit.
2010-06-28Send all three of stdin, stdout, stderr from the client to the server, so thatNicholas Marriott
commands can directly make use of them. This means that load-buffer and save-buffer can have "-" as the file to read from stdin or write to stdout. This is a protocol version bump so the tmux server will need to be restarted after upgrade (or an older client used).
2010-06-05Fix problems with window sizing seen by Raghavendra D Prabhu whenNicholas Marriott
starting tmux from .xinitrc. One of the very few things the server relies on the client for now is to pass through a message on SIGWINCH, but there is a condition where potentially a SIGWINCH may be lost during the transition from unattached (main.c) to attached (client.c). So trigger a size change immediately after the client installs its SIGWINCH handler. Also, when the terminal is resized, reset the scroll region and cursor position. Previously, we were clearing our saved idea of these, but in fact some terminals do not reset them on resize, so this caused problems during redraw. While here make a resize to the same size not cause a redraw and rename the tmux.out output log file to include the tmux PID.
2010-06-05This ioctl(TIOCGWINSZ) call is no longer necessary, the result is neverNicholas Marriott
used and the server now does it later on the tty fd directly.
2010-05-12Catch SIGHUP and terminate if running as a client. This prevents clientsJoel Sing
from being left hanging around when, for example, a SSH session is disconnected. ok nicm@
2010-05-04Put this back in with the initialisation in the right order.Nicholas Marriott
2010-05-04Revert last change, it appears to be broken somehow.Nicholas Marriott
2010-05-03Make signal handler setup/teardown two common functions instead of six,Nicholas Marriott
and reset SIGCHLD after fork to fix problems with some shells. From Romain Francois.
2009-12-03Massive spaces->tabs and trailing whitespace cleanup, hopefully for the lastNicholas Marriott
time now I've configured emacs to make them displayed in really annoying colours...
2009-11-26Remove a couple of unused arguments where possible, and add /* ARGSUSED */ toNicholas Marriott
the rest to reduce lint output.
2009-11-13imsg_read returns ssize_t not int, pointed out by lint via deraadt.Nicholas Marriott
2009-11-10Don't return 1 unless there was actually a problem (signal/lost server) ratherNicholas Marriott
than for all events (normal exit/detach/etc).
2009-11-04Move some common code into a function.Nicholas Marriott
2009-11-04Initial changes to move tmux to libevent.Nicholas Marriott
This moves the client-side loops are pretty much fully over to event-based only (tmux.c and client.c) but server-side (server.c and friends) treats libevent as a sort of clever poll, waking up after every event to run various things. Moving the server stuff over to bufferevents and timers and so on will come later.
2009-11-02Leftover unused variable :-/.Nicholas Marriott
2009-11-02There isn't much point in doing lstat before connect so instead just do connectNicholas Marriott
and handle ENOENT from it which is a little tidier.
2009-10-26Clear signal flags /before/ taking action and continue afterwards to reduceNicholas Marriott
chance of dropping signals. Pointed out by deraadt@.
2009-10-21Tidy identify message send into a separate function.Nicholas Marriott
2009-10-21Client tidying: get rid of client_ctx struct in favour of two variables inNicholas Marriott
client.c, and move the functions in client-fn.c into other files.
2009-10-13Do this in a better way - print messages when exiting with nonzero.Nicholas Marriott
Also remove the login shell information from server-info, only the client should care about it.
2009-10-13Don't print exit messages when used as a login shell, requested by martynas@ aNicholas Marriott
while back.
2009-09-23Support -c like sh(1) to execute a command, useful when tmux is a loginNicholas Marriott
shell. Suggested by halex@. This includes another protocol version increase (the last for now) so again restart the tmux server before upgrading.
2009-09-23Remove the internal tmux locking and instead detach each client and run theNicholas Marriott
command specified by a new option "lock-command" (by default "lock -np") in each client. This means each terminal has to be unlocked individually but simplifies the code and allows the system password to be used to unlock. Note that the set-password command is gone, so it will need to be removed from configuration files, and the -U command line flag has been removed. This is the third protocol version change so again it is best to stop the tmux server before upgrading.
2009-09-23Trim some code by moving the ioctl(TIOCGWINSZ) after SIGWINCH from the clientNicholas Marriott
into the server. This is another (the second of four) protocol version changes coming this morning, so again the server should be killed before upgrading.
2009-09-23Don't attempt to open() the tty path, rely on the client sending its stdin fdNicholas Marriott
with imsg and fatal if it doesn't, then set the FD_CLOEXEC flag in tty_init instead of tty_open to prevent them leaking into child processes if any are created between the two calls. This bumps the protocol version, so the tmux server should be killed before upgrading.
2009-09-20Regularise some fatal messages.Nicholas Marriott
2009-09-02Fix a race condition when asking a client to take over the terminal (switchingNicholas Marriott
to a different poll loop): If a MSG_READY was followed very quickly by a MSG_EXIT (for example if doing "tmux new 'exit'"), both messages could be read as part of the same imsg_read in the first client poll loop. The MSG_READY would then cause a switch to the second client loop, which would immediately call poll(2) again, causing the client to hang forever waiting for an exit message that it already had. Change to call imsg_get to process any existing messages before polling.
2009-09-02That was the wrong fix. MSG_ERROR should set the error and the client shouldNicholas Marriott
use the error and exit on MSG_EXIT (it was being handled in the default case). Undo the last change, move the errstr check into the MSG_EXIT case, and add a comment.
2009-09-02Set exittype for error exit as well as the error string.Nicholas Marriott
2009-08-12imsg closes the fd after sending, so dup() STDIN_FILENO before passing it toNicholas Marriott
the parent, otherwise TIOCGWINSZ will fail when the window is resized (that could actually be moved into the server but this is more future-proof and avoids breaking the protocol).
2009-08-11Have the client pass its stdin fd to the server when identifying itself andNicholas Marriott
have the server use that rather than reopening the tty. If the fd isn't given, use the old behaviour (so no need for a version change). This allows tmux to be used as the shell, so also change so that when working out the command to execute if default-command is empty (the default), tmux will try not execute itself.
2009-08-11Switch tmux to use imsg. This is the last major change to make theNicholas Marriott
client-server protocol more resilient and make the protocol versioning work properly. In future, the only things requiring a protocol version bump will be changes in the message structs, and (when both client and server have this change) mixing different versions should nicely report an error message. As a side effect this also makes the code tidier, fixes a problem with the way errors reported during server startup were handled, and supports fd passing (which will be used in future). Looked over by eric@, thanks. Please note that mixing a client with this change with an older server or vice versa may cause tmux to crash or hang - tmux should be completely exited before upgrading.