OpenBSD CVS

CVS log for src/usr.bin/tmux/Attic/cmd-string.c


[BACK] Up to [local] / src / usr.bin / tmux

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.32, Thu May 23 11:13:30 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.31: +1 -1 lines
FILE REMOVED

Replace the split parser code (cfg.c and cmd-string.c) with a single
parser using yacc(1). This is a major change but is clearer and simpler
and allows some edge cases to be made more consistent, as well as
tidying up how aliases are handled. It will also allow some further
improvements later.

Entirely the same parser is now used for parsing the configuration file
and for string commands. This means that constructs previously only
available in .tmux.conf, such as %if, can now be used in string commands
(for example, those given to if-shell - not commands invoked from the
shell, they are still parsed by the shell itself).

The only syntax change I am aware of is that #{} outside quotes or a
comment is now considered a format and not a comment, so #{ is now a
syntax error (notably, if it is at the start of a line).

This also adds two new sections to the man page documenting the syntax
and outlining how parsing and command execution works.

Thanks to everyone who sent me test configs (they still all parse
without errors - but this doesn't mean they still work as intended!).

Thanks to Avi Halachmi for testing and man page improvements, also to
jmc@ for reviewing the man page changes.

Revision 1.31 / (download) - annotate - [select for diffs], Fri Apr 26 11:38:51 2019 UTC (5 years ago) by nicm
Branch: MAIN
Changes since 1.30: +5 -2 lines
Diff to previous 1.30 (colored)

Merge hooks into options and make each one an array option. This allows
multiple commands to be easily bound to one hook. set-hook and
show-hooks remain but they are now variants of set-option and
show-options. show-options now has a -H flag to show hooks (by default
they are not shown).

Revision 1.30 / (download) - annotate - [select for diffs], Sun Aug 19 19:03:46 2018 UTC (5 years, 9 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.29: +34 -7 lines
Diff to previous 1.29 (colored)

Expand \u and \U escape sequences in command strings, from Christopher
Hunt in GitHub issue 1443.

Revision 1.29 / (download) - annotate - [select for diffs], Wed Jun 14 07:42:41 2017 UTC (6 years, 11 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.28: +6 -8 lines
Diff to previous 1.28 (colored)

Don't overwrite error message when it is available in
cmd_string_parse. Reported by Jimi Damon in GitHub issue 975.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jan 24 19:53:37 2017 UTC (7 years, 3 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.27: +53 -31 lines
Diff to previous 1.27 (colored)

Add support for custom command aliases, this is an array option which
contains items of the form "alias=command". This is consulted when an
unknown command is parsed.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jan 16 14:52:25 2017 UTC (7 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.26: +30 -52 lines
Diff to previous 1.26 (colored)

Revert WIP parts of previous I didn't mean to commit yet.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Jan 16 14:49:14 2017 UTC (7 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.25: +53 -31 lines
Diff to previous 1.25 (colored)

getopt() has a struct option so just return to using options_entry.

Revision 1.25 / (download) - annotate - [select for diffs], Sun Jan 15 22:00:56 2017 UTC (7 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.24: +11 -31 lines
Diff to previous 1.24 (colored)

It is silly for cmd_list_parse to return an integer error when it could
just return NULL.

Revision 1.24 / (download) - annotate - [select for diffs], Fri Oct 14 22:14:22 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.23: +3 -2 lines
Diff to previous 1.23 (colored)

Add CMD_AFTERHOOK flag to the easy commands that don't need any special handling.

Revision 1.23 / (download) - annotate - [select for diffs], Mon Oct 10 21:51:39 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.22: +17 -14 lines
Diff to previous 1.22 (colored)

Add static in cmd-* and fix a few other nits.

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jan 19 15:59:12 2016 UTC (8 years, 4 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

I no longer use my SourceForge address so replace it.

Revision 1.21 / (download) - annotate - [select for diffs], Wed Oct 28 09:51:55 2015 UTC (8 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.20: +4 -4 lines
Diff to previous 1.20 (colored)

Like options, move the environ struct into environ.c.

Revision 1.20 / (download) - annotate - [select for diffs], Wed Oct 8 17:35:58 2014 UTC (9 years, 7 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.19: +11 -10 lines
Diff to previous 1.19 (colored)

Add xreallocarray and remove nmemb argument from xrealloc.

Revision 1.19 / (download) - annotate - [select for diffs], Thu Oct 10 12:14:09 2013 UTC (10 years, 7 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.18: +23 -8 lines
Diff to previous 1.18 (colored)

Make tilde expansion in command strings work even if it isn't terminated by /.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Mar 24 09:54:10 2013 UTC (11 years, 1 month ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.17: +4 -3 lines
Diff to previous 1.17 (colored)

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.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Dec 6 12:47:48 2012 UTC (11 years, 5 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.16: +28 -27 lines
Diff to previous 1.16 (colored)

Simplify command string parsing with a helper function from Tiago Cunha.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Jul 10 11:53:01 2012 UTC (11 years, 10 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.15: +13 -16 lines
Diff to previous 1.15 (colored)

xfree is not particularly helpful, remove it. From Thomas Adam.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Dec 13 22:53:14 2010 UTC (13 years, 5 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.14: +17 -15 lines
Diff to previous 1.14 (colored)

Read ${X} environment variables in strings and $HOME from the global
environment rather than getenv, this allows them to be updated during
the configuration file.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Feb 19 17:14:23 2010 UTC (14 years, 3 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.13: +4 -16 lines
Diff to previous 1.13 (colored)

have_arg matches buf so it is no longer necessary, spotted by Tim van der
Molen.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Jan 31 18:47:03 2010 UTC (14 years, 3 months ago) by nicm
Branch: MAIN
Changes since 1.12: +2 -3 lines
Diff to previous 1.12 (colored)

Remove unnecessary comparison, pointed out by Tiago Cunha.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Dec 3 22:50:10 2009 UTC (14 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last
time now I've configured emacs to make them displayed in really annoying
colours...

Revision 1.11 / (download) - annotate - [select for diffs], Thu Nov 26 21:14:30 2009 UTC (14 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.10: +9 -7 lines
Diff to previous 1.10 (colored)

Get a u_char from the string, otherwise it isn't possible to enter \0377 as it
is mistaken for EOF (doh).

Also drop an unused argument.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Nov 21 17:52:18 2009 UTC (14 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

Use home from struct passwd if HOME is empty as well as if it is NULL, and fix
a style nit. Both from Tiago Cunha.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Nov 16 11:15:44 2009 UTC (14 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.8: +2 -6 lines
Diff to previous 1.8 (colored)

I made a complete horlicks of the last change, fix it so it doesn't either lead
to a double free or free the item after the end of the array.

Revision 1.8 / (download) - annotate - [select for diffs], Wed Nov 11 18:56:07 2009 UTC (14 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.7: +10 -11 lines
Diff to previous 1.7 (colored)

Rewrite a confusing loop when freeing the arg array on exit and move the check
for argv being NULL, prompted by parfait via deraadt.

Also fix some definite brokenness when assigning multiple environment variables
in arguments (such as "X=1 Y=2").

Revision 1.7 / (download) - annotate - [select for diffs], Mon Oct 26 21:42:04 2009 UTC (14 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.6: +21 -21 lines
Diff to previous 1.6 (colored)

tabs are better; ok nicm

Revision 1.6 / (download) - annotate - [select for diffs], Sat Aug 8 21:52:43 2009 UTC (14 years, 9 months ago) by nicm
Branch: MAIN
Changes since 1.5: +16 -14 lines
Diff to previous 1.5 (colored)

Infrastructure and commands to manage the environment for processes started
within tmux.

There is a global environment, copied from the external environment when the
server is started and each sesssion has an (initially empty) session
environment which overrides it.

New commands set-environment and show-environment manipulate or display the
environments.

A new session option, update-environment, is a space-separated list of
variables which are updated from the external environment into the session
environment every time a new session is created - the default is DISPLAY.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Aug 3 14:10:54 2009 UTC (14 years, 9 months ago) by nicm
Branch: MAIN
Changes since 1.4: +4 -1 lines
Diff to previous 1.4 (colored)

Add a terminal-overrides session option allowing individual terminfo(5) entries
to be overridden. The 88col/256col checks are now moved into the default
setting and out of the code.

Also remove a couple of old workarounds for xterm and rxvt which are no longer
necessary (tmux can emulate them if missing).

Revision 1.4 / (download) - annotate - [select for diffs], Mon Jul 13 18:49:36 2009 UTC (14 years, 10 months ago) by nicm
Branch: MAIN
Changes since 1.3: +43 -1 lines
Diff to previous 1.3 (colored)

Expand leading tildes in arguments, from Tiage Cunha.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jul 8 16:04:56 2009 UTC (14 years, 10 months ago) by nicm
Branch: MAIN
Changes since 1.2: +3 -1 lines
Diff to previous 1.2 (colored)

Fix two memory leaks when assigning shell variables in configuration
file/command prompt. From Tiago Cunha.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Jun 5 07:18:37 2009 UTC (14 years, 11 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

strdup the input to putenv to avoid in one case passing a string that is later
freed and in the other const strings.

looks sane to millert, ok ray

Revision 1.1 / (download) - annotate - [select for diffs], Mon Jun 1 22:58:49 2009 UTC (14 years, 11 months ago) by nicm
Branch: MAIN

Import tmux, a terminal multiplexor allowing (among other things) a single
terminal to be switched between several different windows and programs
displayed on one terminal be detached from one terminal and moved to another.

ok deraadt pirofti

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.