Commit Graph

82 Commits

Author SHA1 Message Date
Thomas Adam
35ffd093d7 Merge branch 'obsd-master'
Conflicts:
	Makefile
	cmd-link-window.c
	cmd-unlink-window.c
2014-10-29 12:51:21 +00:00
nicm
b496b1fe11 Move cfg_causes local into cfg.c and remove struct causelist. 2014-10-27 22:23:47 +00:00
Thomas Adam
92997b781a Add compat/fparseln() for non-BSD systems
Linux and friends don't natively have fparseln() so add it to compat/ and
ensure autotools can pick it up.
2014-08-09 20:31:48 +01:00
Thomas Adam
a131b82e95 Merge branch 'obsd-master'
Conflicts:
	client.c
2014-08-09 20:31:36 +01:00
tobias
1aae53596d Handle escaped back slashes and missing new lines at end of line by using
fparseln instead of reimplementing it on our own.

with input by and ok nicm@
2014-06-25 19:17:27 +00:00
Thomas Adam
953c3ef47a Merge branch 'obsd-master'
Conflicts:
	Makefile
	tmux.1
	window.c
2014-04-23 11:26:11 +01:00
nicm
bce952777a Remove some unnecessary includes and fix a typo. 2014-04-17 11:38:35 +00:00
Thomas Adam
3e498cdb49 Merge branch 'obsd-master' 2013-11-14 07:51:26 +00:00
nicm
bf35441608 Do not run any command line command from the client which starts the
server until after the configuration file completes. This prevents it
racing against run-shell or if-shell in .tmux.conf that run in the
background.
2013-10-20 17:28:43 +00:00
Nicholas Marriott
ebd9c615c8 Add some additional debug logging. 2013-03-25 10:06:13 +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
2243cfbe75 Need to set clients in context before changing their reference count. 2013-03-22 15:54:29 +00:00
Nicholas Marriott
0ff9275ad7 load_cfg can actually use the same context now they are reference counted. 2013-03-22 15:50:13 +00:00
Nicholas Marriott
8c545bbfa8 Don't try to print unterminated strings when loading configuration file. 2013-03-22 10:41:57 +00:00
Nicholas Marriott
8d59b189cc No more lint means no more ARGSUSED. 2013-03-22 10:31:22 +00:00
Nicholas Marriott
51ac2a3202 Fix a couple of memory leaks, from Romain Francoise. 2013-03-21 16:54:37 +00:00
Nicholas Marriott
f8c86a9515 Add some additional debug logging. 2013-03-05 17:17:59 +00:00
Nicholas Marriott
3964309c67 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-02-23 22:25:58 +00:00
Nicholas Marriott
afd5e978cf Need to set clients in context before changing their reference count. 2013-02-20 10:25:15 +00:00
Nicholas Marriott
5a5e285be8 Don't try to print unterminated strings when loading configuration file. 2013-02-19 17:28:21 +00:00
Nicholas Marriott
255a4f8ce3 load_cfg can actually use the same context now they are reference counted. 2013-02-18 23:35:54 +00:00
Nicholas Marriott
293e331d69 Add functions to allocate and free command contexts rather than doing it all on
the stack.
2013-02-18 23:20:21 +00:00
Nicholas Marriott
9d165df18a No more lint means no more ARGSUSED. 2013-02-17 23:15:38 +00:00
Nicholas Marriott
77a2174685 Fix a couple of memory leaks, from Romain Francoise. 2013-02-16 19:35:49 +00:00
Thomas Adam
675c6b3773 Merge branch 'obsd-master'
Sync from OpenBSD.
2012-12-31 18:50:37 +00:00
Nicholas Marriott
9714880283 Change load_cfg to fix a crash reported by jasper. 2012-12-13 15:36:16 +00:00
Thomas Adam
fb83914bd7 Merge branch 'obsd-master'
Sync from OpenBSD.
2012-12-08 20:29:37 +00:00
Nicholas Marriott
8600fe054b Use strlcat not strncat in load_cfg and some other trivial tidying from
Tiago Cunha.
2012-12-06 13:06:05 +00:00
Nicholas Marriott
8264e92b37 Fix return value of load_cfg, from Thomas Adam. 2012-11-27 22:59:34 +00:00
Thomas Adam
39631edb98 Merge branch 'obsd-master'
Sync from OpenBSD.
2012-11-27 18:12:04 +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
Thomas Adam
c04aa90207 Merge branch 'obsd-master'
Sync from OpenBSD.

* obsd-master:
  Add halfpage commands to mode command string table (missed by accident), from Thomas Adam.
  Clarify some points about config files, notably that they are only read at server start. From Thomas Adam.
  Use a utility function for common code to show errors in config file, from Thomas Adam.
2012-11-22 13:24:14 +00:00
Nicholas Marriott
827b311c81 Use a utility function for common code to show errors in config file,
from Thomas Adam.
2012-11-19 10:38:06 +00:00
Tiago Cunha
1f5e6e35d5 Sync OpenBSD patchset 1151:
Make command exec functions return an enum rather than -1/0/1 values and
add a new value to mean "leave client running but don't attach" to fix
problems with using some commands in a command sequence. Most of the
work by Thomas Adam, problem reported by "jspenguin" on SF bug 3535531.
2012-07-11 19:37:32 +00:00
Tiago Cunha
a432fcd306 Sync OpenBSD patchset 1150:
xfree is not particularly helpful, remove it. From Thomas Adam.
2012-07-11 19:34:16 +00:00
Nicholas Marriott
ede8312d59 Make command exec functions return an enum rather than -1/0/1 values and
add a new value to mean "leave client running but don't attach" to fix
problems with using some commands in a command sequence. Most of the
work by Thomas Adam, problem reported by "jspenguin" on SF bug 3535531.
2012-07-11 07:10:15 +00:00
Nicholas Marriott
df912e3540 xfree is not particularly helpful, remove it. From Thomas Adam. 2012-07-10 11:53:01 +00:00
Tiago Cunha
04bf0d8efc Sync OpenBSD patchset 1113:
Ignore line continuation when escaped as \\, from Simon Nicolussi.
2012-05-22 20:50:51 +00:00
Nicholas Marriott
ac7e2f13e9 Ignore line continuation when escaped as \\, from Simon Nicolussi. 2012-05-17 21:21:31 +00:00
Tiago Cunha
4a01da19df Sync OpenBSD patchset 951:
Support \ for line continuation in the configuration file, from Julius
Plenz.
2011-08-25 21:14:23 +00:00
Nicholas Marriott
0588168a64 Support \ for line continuation in the configuration file, from Julius
Plenz.
2011-08-24 10:46:01 +00:00
Tiago Cunha
391f1f08c0 Expand the Id keyword. 2011-07-09 09:42:33 +00:00
Tiago Cunha
210b4553a5 Sync OpenBSD patchset 811:
Allow the config file parser and source-file to return "don't exit" to
the client to let attach work from configuration files.
2010-12-30 22:26:07 +00:00
Nicholas Marriott
230e39ec35 Allow the config file parser and source-file to return "don't exit" to
the client to let attach work from configuration files.
2010-12-29 21:28:32 +00:00
Tiago Cunha
0d6a64070c Sync OpenBSD patchset 704:
Fix an out-of-date comment.
2010-06-06 00:04:18 +00:00
Nicholas Marriott
608eef731a Fix an out-of-date comment. 2010-05-25 19:47:30 +00:00
Tiago Cunha
36a80b2cd6 Sync OpenBSD patchset 640:
Use the array.h code for the causes list.
2010-02-08 18:29:32 +00:00
Tiago Cunha
a32d095c97 Sync OpenBSD patchset 635:
Instead of bailing out on the first configuration file error, carry on,
collecting all the errors, then start with the active window in more mode
displaying them.
2010-02-08 18:10:07 +00:00
Nicholas Marriott
4651180503 Use the array.h code for the causes list. 2010-02-06 23:22:27 +00:00
Nicholas Marriott
8aba77b7be Instead of bailing out on the first configuration file error, carry on,
collecting all the errors, then start with the active window in more mode
displaying them.
2010-02-06 17:15:33 +00:00