OpenBSD CVS

CVS log for src/usr.bin/tmux/arguments.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.64 / (download) - annotate - [select for diffs], Mon May 13 11:45:05 2024 UTC (5 days, 16 hours ago) by nicm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.63: +5 -3 lines
Diff to previous 1.63 (colored)

Fix memory leak, from Fadi Afani.

Revision 1.63 / (download) - annotate - [select for diffs], Mon Apr 15 08:19:55 2024 UTC (4 weeks, 5 days ago) by nicm
Branch: MAIN
Changes since 1.62: +5 -1 lines
Diff to previous 1.62 (colored)

Fixes for memory leaks reported by Lu Ming Yin, fixes from Howard Chu.

Revision 1.62 / (download) - annotate - [select for diffs], Tue Nov 14 20:01:11 2023 UTC (6 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.61: +3 -2 lines
Diff to previous 1.61 (colored)

Don't strdup NULL filename.

Revision 1.61 / (download) - annotate - [select for diffs], Tue Nov 14 15:59:49 2023 UTC (6 months ago) by nicm
Branch: MAIN
Changes since 1.60: +5 -2 lines
Diff to previous 1.60 (colored)

Handle NULL client (in config file) when showing a status message; also
copy the file when processing if-shell since it may be freed. GitHub
issue 3746.

Revision 1.60 / (download) - annotate - [select for diffs], Fri Jun 30 21:55:08 2023 UTC (10 months, 2 weeks ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.59: +2 -2 lines
Diff to previous 1.59 (colored)

Change a few types to fix warnings, from Thomas Klausner.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Mar 15 08:15:39 2023 UTC (14 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.58: +21 -3 lines
Diff to previous 1.58 (colored)

Fix command prompt not to always append argument but only if there has
actually been expansion. GitHub issue 3493.

Revision 1.58 / (download) - annotate - [select for diffs], Sun Jan 8 23:34:46 2023 UTC (16 months, 1 week ago) by nicm
Branch: MAIN
Changes since 1.57: +3 -5 lines
Diff to previous 1.57 (colored)

Fix parsing of optional arguments so that and accept a - starting an
argument.

Revision 1.57 / (download) - annotate - [select for diffs], Fri Dec 16 08:13:40 2022 UTC (17 months ago) by nicm
Branch: MAIN
Changes since 1.56: +128 -77 lines
Diff to previous 1.56 (colored)

Add send-keys -K to handle keys directly as if typed (so look up in key
table). GitHub issue 3361.

Revision 1.56 / (download) - annotate - [select for diffs], Tue Aug 2 09:23:34 2022 UTC (21 months, 2 weeks ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.55: +13 -1 lines
Diff to previous 1.55 (colored)

Fix validation of missing percentage arguments.

Revision 1.55 / (download) - annotate - [select for diffs], Tue Jun 7 10:02:19 2022 UTC (23 months, 1 week ago) by nicm
Branch: MAIN
Changes since 1.54: +103 -1 lines
Diff to previous 1.54 (colored)

Expand arguments to some commands where it makes sense, GitHub issue
3204 from Anindya Mukherjee.

Revision 1.54 / (download) - annotate - [select for diffs], Mon May 30 13:04:24 2022 UTC (23 months, 2 weeks ago) by nicm
Branch: MAIN
Changes since 1.53: +7 -1 lines
Diff to previous 1.53 (colored)

Check if args_strtonum argument is NULL or not a string, from Anindya
Mukherjee.

Revision 1.53 / (download) - annotate - [select for diffs], Thu Mar 3 08:24:12 2022 UTC (2 years, 2 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.52: +14 -4 lines
Diff to previous 1.52 (colored)

Allow optional arguments.

Revision 1.52 / (download) - annotate - [select for diffs], Tue Nov 2 10:57:04 2021 UTC (2 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.51: +3 -1 lines
Diff to previous 1.51 (colored)

fatalx on unknown enum members in a couple of places, from Ben Boeckel.

Revision 1.51 / (download) - annotate - [select for diffs], Thu Sep 9 21:55:03 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.50: +5 -1 lines
Diff to previous 1.50 (colored)

Keep -? as usage.

Revision 1.50 / (download) - annotate - [select for diffs], Thu Sep 9 13:38:32 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.49: +4 -3 lines
Diff to previous 1.49 (colored)

Expand argument to run-shell again.

Revision 1.49 / (download) - annotate - [select for diffs], Thu Sep 2 07:11:03 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.48: +8 -3 lines
Diff to previous 1.48 (colored)

Change copying arguments to that flags without arguments are inserted
correctly and empty arguments lists do not crash. Fixes crash reported
by & ok mpi@.

Revision 1.48 / (download) - annotate - [select for diffs], Fri Aug 27 17:25:55 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.47: +104 -13 lines
Diff to previous 1.47 (colored)

Replace %% in command lists (by copying them) for template arguments ,
this means they can be used with {} as well. Also make argument
processing from an existing vector preserve commands. GitHub issue 2858.

Revision 1.47 / (download) - annotate - [select for diffs], Wed Aug 25 08:51:55 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.46: +79 -10 lines
Diff to previous 1.46 (colored)

Validate command argument types (string or command list) and give more
useful error messages.

Revision 1.46 / (download) - annotate - [select for diffs], Mon Aug 23 17:05:43 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.45: +5 -3 lines
Diff to previous 1.45 (colored)

args_make_commands_now needs to take an extra reference to the returned
command list since it will be freed already.

Revision 1.45 / (download) - annotate - [select for diffs], Mon Aug 23 12:33:55 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.44: +138 -1 lines
Diff to previous 1.44 (colored)

Move command argument parsing common functions and don't bother to parse
again if given a command rather than a string.

Revision 1.44 / (download) - annotate - [select for diffs], Sat Aug 21 20:57:52 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.43: +4 -4 lines
Diff to previous 1.43 (colored)

Free value properly.

Revision 1.43 / (download) - annotate - [select for diffs], Sat Aug 21 20:46:43 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.42: +92 -49 lines
Diff to previous 1.42 (colored)

Preserve argument type in command and convert to string on demand.

Revision 1.42 / (download) - annotate - [select for diffs], Sat Aug 21 18:39:07 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.41: +105 -24 lines
Diff to previous 1.41 (colored)

Pass typed arguments out of the parser into the arguments list and let
it convert them into strings.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Aug 21 10:28:05 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.40: +7 -7 lines
Diff to previous 1.40 (colored)

Rename a member to match what it will be in future.

Revision 1.40 / (download) - annotate - [select for diffs], Sat Aug 21 08:44:59 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.39: +6 -5 lines
Diff to previous 1.39 (colored)

Wrap command argument definitions in their own struct.

Revision 1.39 / (download) - annotate - [select for diffs], Fri Aug 20 20:08:30 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.38: +5 -5 lines
Diff to previous 1.38 (colored)

A couple more spacing fixes.

Revision 1.38 / (download) - annotate - [select for diffs], Fri Aug 20 19:50:16 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.37: +43 -21 lines
Diff to previous 1.37 (colored)

Hide struct args behind a couple of accessor functions.

Revision 1.37 / (download) - annotate - [select for diffs], Fri Aug 20 18:59:53 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.36: +7 -20 lines
Diff to previous 1.36 (colored)

Expose args_value struct (will be needed soon) and add some missing frees.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Aug 20 17:53:54 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.35: +13 -3 lines
Diff to previous 1.35 (colored)

Add a way to create an empty arguments set.

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jun 12 07:10:43 2020 UTC (3 years, 11 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.34: +15 -12 lines
Diff to previous 1.34 (colored)

Fix quoting with newlines and single quotes.

Revision 1.34 / (download) - annotate - [select for diffs], Thu Jun 4 07:12:05 2020 UTC (3 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.33: +6 -1 lines
Diff to previous 1.33 (colored)

Instead of using a custom parse function to process {}, treat it as a
set of statements and parse with yacc, then convert back to a string as
the last step. This means the rules are consistent inside and outside
{}, %if and friends work at the right time, and the final result isn't
littered with unnecessary newlines.

Revision 1.33 / (download) - annotate - [select for diffs], Mon May 25 18:17:14 2020 UTC (3 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

Fix some error strings, from Kris Katterjohn.

Revision 1.32 / (download) - annotate - [select for diffs], Sat May 16 15:40:04 2020 UTC (4 years ago) by nicm
Branch: MAIN
Changes since 1.31: +39 -17 lines
Diff to previous 1.31 (colored)

Add formats for after hook command arguments.

Revision 1.31 / (download) - annotate - [select for diffs], Wed Apr 22 06:57:13 2020 UTC (4 years ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.30: +18 -11 lines
Diff to previous 1.30 (colored)

Change so main-pane-width and height can be given as a percentage.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Apr 12 20:54:28 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.29: +5 -3 lines
Diff to previous 1.29 (colored)

Print empty arguments properly.

Revision 1.29 / (download) - annotate - [select for diffs], Sat Mar 21 13:16:15 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.28: +51 -1 lines
Diff to previous 1.28 (colored)

Break code to convert an argument as a percentage into a common function.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Mar 17 16:02:38 2020 UTC (4 years, 2 months ago) by nicm
Branch: MAIN
Changes since 1.27: +3 -1 lines
Diff to previous 1.27 (colored)

getopt is not required to set optarg to NULL when there is no argument
and some do not, so set it explicitly each time.

Revision 1.27 / (download) - annotate - [select for diffs], Tue Jul 9 14:03:12 2019 UTC (4 years, 10 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.26: +14 -4 lines
Diff to previous 1.26 (colored)

Add a -H flag to send-keys to send literal keys given as hex numbers
(needed for control clients to send mouse sequences). Also add some
format flags for UTF-8 and SGR mouse mode. Requested by Bradley Smith in
GitHub issues 1832 and 1833.

Revision 1.26 / (download) - annotate - [select for diffs], Thu Jun 20 07:10:56 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.25: +4 -2 lines
Diff to previous 1.25 (colored)

Add a -A flag to show-options to show parent options as well.

Revision 1.25 / (download) - annotate - [select for diffs], Wed May 29 20:05:14 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

Use VIS_CSTYLE for the arguments and add the missing escapes it can
generate to the parser.

Revision 1.24 / (download) - annotate - [select for diffs], Tue May 28 18:30:30 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.23: +3 -1 lines
Diff to previous 1.23 (colored)

Do not read past the end of the argument string if it is empty.

Revision 1.23 / (download) - annotate - [select for diffs], Mon May 27 12:16:27 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

Add an additional {} syntax for defining strings in the configuration
file, making it much tidier to define commands that contain other tmux
or shell commands (like if-shell). Also tweak bind-key to expect a
string if it is only given one argument, so {} can be used with it as
well. From Avi Halachmi.

Revision 1.22 / (download) - annotate - [select for diffs], Thu May 23 14:03:44 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.21: +40 -23 lines
Diff to previous 1.21 (colored)

Break the argument escaping code into a separate function and use it to
escape key bindings in list-keys. Also escape ~ and ; and $ properly.

Revision 1.21 / (download) - annotate - [select for diffs], Sun Apr 28 20:05:50 2019 UTC (5 years ago) by nicm
Branch: MAIN
Changes since 1.20: +111 -48 lines
Diff to previous 1.20 (colored)

Support multiple occurances of the same argument. Use this for a new
flag -e to new-window, split-window, respawn-window, respawn-pane to
pass environment variables into the newly created process. From Steffen
Christgau in GitHub issue 1697.

Revision 1.20 / (download) - annotate - [select for diffs], Wed Aug 23 09:14:21 2017 UTC (6 years, 8 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

Run alert hooks based on the options rather than unconditionally, from
Brad Town.

Revision 1.19 / (download) - annotate - [select for diffs], Tue May 30 21:44:59 2017 UTC (6 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.18: +2 -3 lines
Diff to previous 1.18 (colored)

Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.

Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.

Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:

- each mode has a preview pane: for buffers this is the buffer content
  (very useful), for others it is a preview of the pane;

- items may be sorted in different ways ('O' key);

- multiple items may be tagged and an operation applied to all of them
  (for example, to delete multiple buffers at once);

- in tree mode a command may be run on the selected item (session,
  window, pane) or on tagged items (key ':');

- displayed items may be filtered in tree mode by using a format (this
  is used to implement find-window) (key 'f');

- the custom format (-F) for the display is no longer available;

- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
  with keys used for other uses to 0-9, M-a to M-z.

Now that the code is simpler, other improvements will come later.

Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).

Parts written by Thomas Adam.

Revision 1.18 / (download) - annotate - [select for diffs], Sat Apr 22 12:08:41 2017 UTC (7 years ago) by nicm
Branch: MAIN
Changes since 1.17: +1 -2 lines
Diff to previous 1.17 (colored)

Do not need getopt.h.

Revision 1.17 / (download) - annotate - [select for diffs], Wed Jan 18 10:08:05 2017 UTC (7 years, 4 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.16: +3 -3 lines
Diff to previous 1.16 (colored)

Plain stravis() because it will mangle UTF-8 characters, so add
utf8_stravis() which calls our existing utf8_strvis() and use it instead

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jan 18 10:00:50 2017 UTC (7 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.15: +23 -9 lines
Diff to previous 1.15 (colored)

Run arguments through vis() as well when printing them.

Revision 1.15 / (download) - annotate - [select for diffs], Tue Oct 11 13:21:59 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.14: +3 -26 lines
Diff to previous 1.14 (colored)

Add static in window-*.c and move some internal functions out of tmux.h.

Revision 1.14 / (download) - annotate - [select for diffs], Mon Oct 10 13:54:47 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.13: +6 -5 lines
Diff to previous 1.13 (colored)

Some more static.

Revision 1.13 / (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.12: +2 -2 lines
Diff to previous 1.12 (colored)

I no longer use my SourceForge address so replace it.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Nov 27 15:06:43 2015 UTC (8 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.11: +40 -44 lines
Diff to previous 1.11 (colored)

Do not set a limit on the length of commands when printing them.

Revision 1.11 / (download) - annotate - [select for diffs], Sat Aug 29 23:19:52 2015 UTC (8 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.10: +7 -1 lines
Diff to previous 1.10 (colored)

struct args_entry can go into arguments.c.

Revision 1.10 / (download) - annotate - [select for diffs], Mon Oct 20 23:27:14 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.9: +2 -1 lines
Diff to previous 1.9 (colored)

Tidy up some includes.

Revision 1.9 / (download) - annotate - [select for diffs], Fri Apr 11 19:35:54 2014 UTC (10 years, 1 month ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.8: +10 -4 lines
Diff to previous 1.8 (colored)

Don't blindly increase offsets by the return value of snprintf, if there
wasn't enough space this will go off the end. Instead clamp to the
available space. Fixes crash reported by Julien Rebetez.

Revision 1.8 / (download) - annotate - [select for diffs], Wed Jan 15 11:44:18 2014 UTC (10 years, 4 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.7: +2 -3 lines
Diff to previous 1.7 (colored)

Couple of fixes from cppcheck via Tiago Cunha.

Revision 1.7 / (download) - annotate - [select for diffs], Thu Jan 9 13:51:57 2014 UTC (10 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.6: +6 -10 lines
Diff to previous 1.6 (colored)

Simplify args_set, from Tiago Cunha.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Nov 17 20:19:36 2013 UTC (10 years, 6 months ago) by okan
Branch: MAIN
Changes since 1.5: +2 -1 lines
Diff to previous 1.5 (colored)

Include unistd.h as it is the standard location for getopt().

OK millert@

Revision 1.5 / (download) - annotate - [select for diffs], Fri May 31 12:19:34 2013 UTC (10 years, 11 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.4: +79 -43 lines
Diff to previous 1.4 (colored)

Instead of eating 1024 bytes or so for the arguments of each command,
save memory by using an RB tree. From Tiago Cunha.

Revision 1.4 / (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_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.3: +9 -13 lines
Diff to previous 1.3 (colored)

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

Revision 1.3 / (download) - annotate - [select for diffs], Sat Jul 9 01:36:42 2011 UTC (12 years, 10 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

Pass the right size to calloc (* not **).

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jan 30 12:09:30 2011 UTC (13 years, 3 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.1: +6 -5 lines
Diff to previous 1.1 (colored)

Free old argument even if setting to NULL.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Jan 4 00:42:46 2011 UTC (13 years, 4 months ago) by nicm
Branch: MAIN

Clean up and simplify tmux command argument parsing.

Originally, tmux commands were parsed in the client process into a
struct with the command data which was then serialised and sent to the
server to be executed. The parsing was later moved into the server (an
argv was sent from the client), but the parse step and intermediate
struct was kept.

This change removes that struct and the separate parse step. Argument
parsing and printing is now common to all commands (in arguments.c) with
each command left with just an optional check function (to validate the
arguments at parse time), the exec function and a function to set up any
key bindings (renamed from the old init function).

This is overall more simple and consistent.

There should be no changes to any commands behaviour or syntax although
as this touches every command please watch for any unexpected changes.

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.