Commit Graph

20 Commits

Author SHA1 Message Date
Jason
939c7b2d52 Amend typos 2019-11-23 11:48:31 +01:00
Brian Ashworth
2f858a1ada input_cmd_xkb_file: allow shell path expansion
This allows for shell path expansion for input_cmd_xkb_file. The logic
has been extracted from output_cmd_background
2019-11-21 10:36:15 -05:00
Matt Coffin
2b5bf78faf Fix segfaults caused by faulty command parsing
This patch fixes faulty command parsing introduced by
f0f5de9a9e. When that commit allowed
criteria reset on ';' delimeters in commands lists, it failed to account
for its inner ','-parsing loop eating threw the entire rest of the
string.

This patch refactors argsep to use a list of multiple separators, and
(optionally) return the separator that it matched against in this
iteration via a pointer. This allows it to hint at the command parser
which separator was used at the end of the last command, allowing it to
trigger a potential secondary read of the criteria.

Fixes #4239
2019-06-11 14:40:36 -04:00
Ian Fan
00570c139e stringop.c: refactor a few functions 2019-03-11 14:42:58 +01:00
Ian Fan
be1543d301 stringop.c: clean up headers 2019-03-11 14:42:58 +01:00
Ian Fan
5c8424c074 stringop.c: remove unused functions
The only use of `join_list` in swaybar/tray/icon.c has been rewritten.
2019-03-11 14:42:58 +01:00
Brian Ashworth
89afb761ba output_cmd_background: fix no file + valid mode
If output_cmd_background is given a valid mode as the first argument,
then there is no file given and an error should be returned.

join_args should not be called with an argc of zero since it sets the
last character to the null terminator. With an argc of zero, the length
is zero causing a heap buffer overflow when setting the byte before the
start of argv to '\0'. This probably will not ever generate a segfault,
but may cause data corruption to whatever is directly before it in
memory. To make other such cases easier to detect, this also adds a
sway_assert in join_args when argc is zero.
2019-02-05 14:13:27 -05:00
Ian Fan
5bef06adfd fixup! stringop.c: rewrite strip_whitespace 2019-01-02 18:47:22 +00:00
Ian Fan
967566e37f stringop.c: rewrite strip_whitespace 2019-01-01 09:01:24 +00:00
Ian Fan
19e831ed3d list.c: Remove list_foreach
Most occurrences have been replaced by `free_flat_list` which has been
moved from stringop.c to list.c. The rest have been replaced by for loops.
2018-12-09 00:37:50 +00:00
emersion
3a310f92ab
Replace _XOPEN_SOURCE with _POSIX_C_SOURCE
And make sure we don't define both in the same source file.
2018-11-25 17:19:43 +01:00
Ryan Dwyer
7e81e58e7d Allow reload command to exist anywhere in the command string
This fixes a crash if you have commands where reload appears in the
middle or at the end, such as `bindsym r mode default, reload`.
2018-09-01 11:45:48 +10:00
Ryan Dwyer
db38b9bbf3 Clean up container title functions
* Add and use lenient_strcat and lenient_strncat functions
* Rename `concatenate_child_titles` function as that's no longer what it
does
* Rename `container_notify_child_title_changed` because we only need to
notify that the tree structure has changed, not titles
* Don't notify parents when a child changes its title
* Update ancestor titles when changing a container's layout
	* Eg. create nested tabs and change the inner container to stacking
* No need to store tree presentation in both container->name and
formatted_title
2018-05-25 21:07:59 +10:00
johalun
7fef283044 FreeBSD fixes
Increase _POSIX_SOURCE value where needed.
Increase _XOPEN_SOURCE value where needed.
Conditionally link to libcap (only on Linux).
Possibly some trailing whitespace fixes (automatic).
2017-06-06 09:45:50 +02:00
Drew DeVault
9aed9d9359 UnGNUify the codebase 2017-03-10 23:41:24 -05:00
Daniel Lockyer
235cfd93b2 common/stringop.c: a premature decrement meant an element of argv was never released 2016-04-29 18:00:21 +01:00
Eric Engestrom
3e8081514d Fix spelling mistakes 2016-04-02 16:00:05 +01:00
Mikkel Oscar Lyderik
32ae26e519 Add quotes to multiword arguments.
This adds quotes around multiword arguments before they are passed to
`/bin/sh -c` in an exec command.

Example:

I connect to irc like this:

    exec termite -e "mosh server tmux a"

Without this patch the arguments are passed to sh as:

    termite -e mosh server tmux a

When it should be:

    termite -e "mosh server tmux a"

For the command to work.
2016-01-25 00:14:13 +01:00
Drew DeVault
5a369b3132 Only strip comments at the start of a line
This is necessary because i3 config files use CSS notation for colors
(i.e. #rrggbb).
2015-11-29 14:02:58 -05:00
Drew DeVault
9a15371ba3 Parse command line args for swaymsg 2015-11-26 14:31:29 -05:00