Commit Graph

153 Commits

Author SHA1 Message Date
nicm
01a2ddf3f8 Add getpw to pledge, makes tmux work in YP environments, discovered by
matthieu, ok deraadt
2015-11-22 19:41:19 +00:00
nicm
fce56c56ef Instead of separate tables for different types of options, give each
option a scope type (server, session, window) in one table.
2015-11-20 12:01:19 +00:00
nicm
a582b62287 Accidentally turned off pledge, turn it back on. 2015-11-15 14:32:48 +00:00
nicm
c56b81a2ce Push stdout and stderr to clients more aggressively, and add an event to
continue if the send fails.
2015-11-14 09:41:06 +00:00
nicm
0cc812ae34 tmux is UTF-8, so if $TMUX is set (tmux running in tmux), the client is
UTF-8. Also try to make the existing checks more readable.
2015-11-12 11:24:08 +00:00
nicm
1b86f520ea Nuke the utf8 and status-utf8 options and make tmux only a UTF-8
terminal. We still support non-UTF-8 terminals outside tmux, but inside
it is always UTF-8 (as when the utf8 and status-utf8 options were on).
2015-11-12 11:09:11 +00:00
nicm
00c34df186 Drop mouse-utf8 option and always turn on UTF-8 mouse if the client says
it supports UTF-8.
2015-11-11 23:23:33 +00:00
nicm
bf9c933cae Like options, move the environ struct into environ.c. 2015-10-28 09:51:55 +00:00
nicm
44657bf932 Move struct options into options.c. 2015-10-27 15:58:42 +00:00
nicm
07b0ea03c3 Break the common process set up, event loop and imsg dispatch code
between server and client out into a separate internal API. This will
make it easier to add another process.
2015-10-27 13:23:24 +00:00
deraadt
3034a71488 Let's see if anyone screams about not being able to specify $TMPDIR
for their tmux sockets.

(Over the years, I have seen $TMPDIR set up worse than /tmp many times,
and don't know how this practice infected other parts of the system.
Nothing uses tmpdir(3), nor a huge-temporary-file program like sort.)
ok nicm
2015-10-25 07:48:16 +00:00
nicm
5383b047d1 tmux can call pledge() in main with large set and then reduce it
slightly in the server to "stdio rpath wpath cpath fattr unix recvfd
proc exec tty ps".
2015-10-23 16:07:29 +00:00
nicm
216ddf3da5 Move tzset() from log_open to main. 2015-09-14 12:12:24 +00:00
nicm
82326dcbe2 A couple of style nits. 2015-09-03 14:30:23 +00:00
nicm
952ba84611 Work out config file when needed not at startup. 2015-09-01 10:10:59 +00:00
nicm
6a539c00df Path from $TMUX does not need to be global anymore. 2015-08-30 22:56:36 +00:00
nicm
c6e9160c67 Login shell can be a client flag, and move the exec code into client.c. 2015-08-30 22:40:25 +00:00
nicm
dd92b6e83d Event base does not need to be global. 2015-08-30 22:19:07 +00:00
nicm
b87dc608d9 Some style nits and dead assignments. 2015-08-30 15:43:40 +00:00
nicm
92af3766ec Add an option (history-file) for a file to save/restore command prompt
history, from Olof-Joachim Frahm.
2015-07-20 15:50:04 +00:00
jmc
dc0d34e137 tweak SYNOPSIS and usage(); 2015-06-04 20:34:22 +00:00
nicm
d451502676 Make a tmux-%u directory under TMUX_TMPDIR, like TMPDIR. 2015-01-19 09:58:34 +00:00
nicm
900f6fc17e Tidy up some includes. 2014-10-20 23:27:14 +00:00
nicm
2740490e27 Remove the "info" message mechanism, this was only used for about five
mostly useless and annoying messages. Change those commands to silence
on success like all the others. Still accept the -q command line flag
and "quiet" server option for now.
2014-04-17 07:55:43 +00:00
nicm
48478ea0a9 Remove log_debug2 as well and simplify log.c. 2014-03-31 21:42:45 +00:00
nicm
81db6bab91 Leftovers from removing 88 colour support, from Theo Buehler. 2014-02-16 12:45:17 +00:00
nicm
938768ed3d Do not attempt to read .tmux.conf if we can't figure out a home
directory, from Tiago Cunha.
2014-01-15 11:46:28 +00:00
nicm
adc1f21eae Three small changes from Tiago Cunha:
- Check for truncation when copying path.
- Don't need to use a temporary buffer in screen_set_title.
- Include strerror in output when connecting to server fails.
2014-01-09 14:05:55 +00:00
nicm
c1ccefc62d We accidentally haven't been using $TMUX to work out the session for a
while and in fact it is less useful that using the client ttyname. So
don't bother and don't pass it from the client. If we need it in future
it is in c->environ.
2013-10-10 12:29:35 +00:00
nicm
282c5f9644 Alter how tmux handles the working directory to internally use file
descriptors rather than strings.

- Each session still has a current working directory.

- New sessions still get their working directory from the client that
  created them or its attached session if any.

- New windows are created by default in the session working directory.

- The -c flag to new, neww, splitw allows the working directory to be
  overridden.

- The -c flag to attach let's the session working directory be changed.

- The default-path option has been removed.

To get the equivalent to default-path '.', do:

        bind c neww -c $PWD

To get the equivalent of default-path '~', do:

        bind c neww -c ~

This also changes the client identify protocol to be a set of messages rather
than one as well as some other changes that should make it easier to make
backwards-compatible protocol changes in future.
2013-10-10 12:26:34 +00:00
nicm
eb26dbd072 Merge IDENTIFY_* flags with CLIENT_* flags. 2013-10-10 12:12:08 +00:00
nicm
e4dc1568ce Don't treat TMUX_TMPDIR as a potential file
The point of setting TMUX_TMPDIR is to then make any labels from -L go
to that directory.  In the case of makesocketpath() with no TMUX_TMPDIR
set, would set both the path and the default socket to a file.  The
checking of the permissions on the file worked fine in that case, but
when TMUX_TMPDIR is set, won't work on a directory.

This fixes the problem by ensuring the check on the permissions is
performed on directories only.

By Thomas Adam.
2013-10-10 12:03:22 +00:00
nicm
9f330897a8 Fix previous not to leak fd on failure, whoops. 2013-10-05 10:40:49 +00:00
nicm
3d8a8ea0c6 Use open(".")/fchdir() to save and restore current directory rather than
getcwd()/chdir().
2013-10-05 08:12:39 +00:00
Nicholas Marriott
e323101ede Rename global configuration define. 2013-04-24 10:01:32 +00:00
Nicholas Marriott
7f9b225cc2 Call setlocale(LC_TIME) at startup. 2013-04-11 21:52:18 +00:00
Nicholas Marriott
7f63658709 Add TMUX_TMPDIR variable to put the socket directory outside
TMPDIR. From Ben Boeckel.
2013-03-27 11:24:18 +00:00
Nicholas Marriott
6fee3e9e4b Rename session idx to session id throughout and add $ prefix to targets
to use it, extended from a diff from George Nachman.
2013-03-25 10:11:45 +00:00
Nicholas Marriott
20636d956d Add a command queue to standardize and simplify commands that call other
commands and allow a command to block execution of subsequent
commands. This allows run-shell and if-shell to be synchronous which has
been much requested.

Each client has a default command queue and commands are consumed one at
a time from it. A command may suspend execution from the queue by
returning CMD_RETURN_WAIT and then resume it by calling cmd_continue() -
for example run-shell does this from the callback that is fired after
the job is freed.

When the command queue becomes empty, command clients are automatically
exited (unless attaching). A callback is also fired - this is used for
nested commands in, for example, if-shell which can block execution of
the client's cmdq until a new cmdq becomes empty.

Also merge all the old error/info/print functions together and lose the
old curclient/cmdclient distinction - a cmdq is bound to one client (or
none if in the configuration file), this is a command client if
c->session is NULL otherwise an attached client.
2013-03-24 09:54:10 +00:00
Nicholas Marriott
9b8998aeec Correctly aggregate together errors from nested config files (with
source-file). Fix by Thomas Adam, reported by Sam Livingstone-Gray
2012-11-27 16:12:29 +00:00
Nicholas Marriott
d762ced298 Call realpath earlier on the socket directory path rather than on the
socket file path because the latter may not exist yet and in that case
realpath is allowed to fail. From Romain Francoise.
2012-11-26 11:35:28 +00:00
Nicholas Marriott
df912e3540 xfree is not particularly helpful, remove it. From Thomas Adam. 2012-07-10 11:53:01 +00:00
Nicholas Marriott
2942eca895 Add a skeleton mode to tmux (called "control mode") that let's tmux
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-06-18 13:16:42 +00:00
Nicholas Marriott
021e95b09f Do not use stderr for log file and don't call log_close when not needed. 2012-05-30 15:01:21 +00:00
Nicholas Marriott
196710e2d3 Simplify logging and just fprintf(stderr, ...) for early errors. 2012-05-25 08:28:10 +00:00
Nicholas Marriott
535286c05a Drop the ability to have a list of keys in the prefix in favour of two
separate options, prefix and prefix2. This simplifies the code and gets
rid the data options type which was only used for this one option.

Also add a -2 flag to send-prefix to send the secondary prefix key,
fixing a cause of minor irritation.

People who want three prefix keys are out of luck :-).
2012-01-21 08:40:09 +00:00
Nicholas Marriott
7ff4cf9405 Try to resolve relative paths for loadb and saveb (first using client
working directory if any then default-path or session wd).
2011-10-23 08:34:01 +00:00
Nicholas Marriott
b32254acda Ignore LC_ALL and LC_CTYPE if they are empty as well as unset. 2011-10-23 08:03:27 +00:00
Nicholas Marriott
e6a59c4bee Reject $SHELL if it is not a full path. 2011-09-25 18:53:04 +00:00
Nicholas Marriott
d5ed5fb08f Two fixes by Micah Cowan: make mouse work properly beyond >127 on signed
char architectures and properly parse $TMUX by stopping the socket path
at the first comma.
2011-03-04 23:26:44 +00:00