From 9aed9d93596cdc72e305338d82ccc0dcaf85c6e2 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Fri, 10 Mar 2017 23:41:24 -0500
Subject: UnGNUify the codebase

---
 sway/commands/assign.c                        |  1 +
 sway/commands/bar.c                           |  1 +
 sway/commands/bar/binding_mode_indicator.c    |  1 +
 sway/commands/bar/hidden_state.c              |  2 ++
 sway/commands/bar/id.c                        |  1 +
 sway/commands/bar/mode.c                      |  2 ++
 sway/commands/bar/output.c                    |  1 +
 sway/commands/bar/pango_markup.c              |  1 +
 sway/commands/bar/position.c                  |  1 +
 sway/commands/bar/separator_symbol.c          |  1 +
 sway/commands/bar/strip_workspace_numbers.c   |  1 +
 sway/commands/bar/tray_padding.c              |  1 +
 sway/commands/bar/workspace_buttons.c         |  1 +
 sway/commands/bar/wrap_scroll.c               |  1 +
 sway/commands/border.c                        |  1 +
 sway/commands/debuglog.c                      |  1 +
 sway/commands/exec_always.c                   |  1 +
 sway/commands/floating.c                      |  1 +
 sway/commands/floating_mod.c                  |  1 +
 sway/commands/floating_scroll.c               |  2 ++
 sway/commands/focus.c                         |  1 +
 sway/commands/focus_follows_mouse.c           |  1 +
 sway/commands/font.c                          |  1 +
 sway/commands/for_window.c                    |  1 +
 sway/commands/force_focus_wrapping.c          |  1 +
 sway/commands/gaps.c                          |  1 +
 sway/commands/hide_edge_borders.c             |  1 +
 sway/commands/input.c                         |  1 +
 sway/commands/input/accel_profile.c           |  1 +
 sway/commands/input/click_method.c            |  1 +
 sway/commands/input/drag_lock.c               |  1 +
 sway/commands/input/dwt.c                     |  1 +
 sway/commands/input/events.c                  |  1 +
 sway/commands/input/left_handed.c             |  1 +
 sway/commands/input/middle_emulation.c        |  1 +
 sway/commands/input/natural_scroll.c          |  1 +
 sway/commands/input/scroll_method.c           |  1 +
 sway/commands/input/tap.c                     |  1 +
 sway/commands/layout.c                        |  1 +
 sway/commands/log_colors.c                    |  1 +
 sway/commands/mode.c                          |  2 ++
 sway/commands/mouse_warping.c                 |  1 +
 sway/commands/move.c                          |  1 +
 sway/commands/new_float.c                     |  1 +
 sway/commands/new_window.c                    |  1 +
 sway/commands/orientation.c                   |  1 +
 sway/commands/output.c                        |  2 ++
 sway/commands/resize.c                        |  1 +
 sway/commands/scratchpad.c                    |  1 +
 sway/commands/seamless_mouse.c                |  1 +
 sway/commands/set.c                           | 12 +++++++-----
 sway/commands/smart_gaps.c                    |  1 +
 sway/commands/split.c                         |  1 +
 sway/commands/workspace.c                     |  2 ++
 sway/commands/workspace_auto_back_and_forth.c |  1 +
 sway/commands/workspace_layout.c              |  1 +
 56 files changed, 68 insertions(+), 5 deletions(-)

(limited to 'sway/commands')

diff --git a/sway/commands/assign.c b/sway/commands/assign.c
index 992b4692..ec262bb8 100644
--- a/sway/commands/assign.c
+++ b/sway/commands/assign.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 500
 #include <stdio.h>
 #include <string.h>
 #include "sway/commands.h"
diff --git a/sway/commands/bar.c b/sway/commands/bar.c
index e8d24084..04745a6e 100644
--- a/sway/commands/bar.c
+++ b/sway/commands/bar.c
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/config.h"
 #include "log.h"
diff --git a/sway/commands/bar/binding_mode_indicator.c b/sway/commands/bar/binding_mode_indicator.c
index 6f67e15d..64f5b84f 100644
--- a/sway/commands/bar/binding_mode_indicator.c
+++ b/sway/commands/bar/binding_mode_indicator.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 
diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c
index e52a123f..0b49aa6b 100644
--- a/sway/commands/bar/hidden_state.c
+++ b/sway/commands/bar/hidden_state.c
@@ -1,4 +1,6 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/config.h"
 #include "sway/ipc-server.h"
diff --git a/sway/commands/bar/id.c b/sway/commands/bar/id.c
index d62a0961..1221ebf6 100644
--- a/sway/commands/bar/id.c
+++ b/sway/commands/bar/id.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
 #include "sway/commands.h"
 #include "log.h"
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index 3fd6587f..36816b93 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -1,4 +1,6 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/config.h"
 #include "sway/ipc-server.h"
diff --git a/sway/commands/bar/output.c b/sway/commands/bar/output.c
index 01a23d9c..a5710bc0 100644
--- a/sway/commands/bar/output.c
+++ b/sway/commands/bar/output.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
 #include "sway/commands.h"
 #include "list.h"
diff --git a/sway/commands/bar/pango_markup.c b/sway/commands/bar/pango_markup.c
index 69213c7b..f69e882f 100644
--- a/sway/commands/bar/pango_markup.c
+++ b/sway/commands/bar/pango_markup.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 
diff --git a/sway/commands/bar/position.c b/sway/commands/bar/position.c
index 4d0171ba..50de58e2 100644
--- a/sway/commands/bar/position.c
+++ b/sway/commands/bar/position.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 
diff --git a/sway/commands/bar/separator_symbol.c b/sway/commands/bar/separator_symbol.c
index 2249da52..2766d8a2 100644
--- a/sway/commands/bar/separator_symbol.c
+++ b/sway/commands/bar/separator_symbol.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
 #include "sway/commands.h"
 #include "log.h"
diff --git a/sway/commands/bar/strip_workspace_numbers.c b/sway/commands/bar/strip_workspace_numbers.c
index 7cd19d60..9ac32482 100644
--- a/sway/commands/bar/strip_workspace_numbers.c
+++ b/sway/commands/bar/strip_workspace_numbers.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 
diff --git a/sway/commands/bar/tray_padding.c b/sway/commands/bar/tray_padding.c
index 32f8eeba..8c559f65 100644
--- a/sway/commands/bar/tray_padding.c
+++ b/sway/commands/bar/tray_padding.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 
diff --git a/sway/commands/bar/workspace_buttons.c b/sway/commands/bar/workspace_buttons.c
index a0e0549d..67dd2d31 100644
--- a/sway/commands/bar/workspace_buttons.c
+++ b/sway/commands/bar/workspace_buttons.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 
diff --git a/sway/commands/bar/wrap_scroll.c b/sway/commands/bar/wrap_scroll.c
index caa85660..4ed1f12a 100644
--- a/sway/commands/bar/wrap_scroll.c
+++ b/sway/commands/bar/wrap_scroll.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 
diff --git a/sway/commands/border.c b/sway/commands/border.c
index 68ae58a6..0211e40c 100644
--- a/sway/commands/border.c
+++ b/sway/commands/border.c
@@ -1,6 +1,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/container.h"
 #include "sway/focus.h"
diff --git a/sway/commands/debuglog.c b/sway/commands/debuglog.c
index 76192fb0..658d6165 100644
--- a/sway/commands/debuglog.c
+++ b/sway/commands/debuglog.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index 1d7cd494..ab2d8622 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
 #include <sys/wait.h>
 #include <unistd.h>
diff --git a/sway/commands/floating.c b/sway/commands/floating.c
index 612b8641..113c8b71 100644
--- a/sway/commands/floating.c
+++ b/sway/commands/floating.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/container.h"
 #include "sway/ipc-server.h"
diff --git a/sway/commands/floating_mod.c b/sway/commands/floating_mod.c
index b6360d9a..b8e81ab9 100644
--- a/sway/commands/floating_mod.c
+++ b/sway/commands/floating_mod.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input_state.h"
 #include "list.h"
diff --git a/sway/commands/floating_scroll.c b/sway/commands/floating_scroll.c
index 5705cfee..8c50c5bd 100644
--- a/sway/commands/floating_scroll.c
+++ b/sway/commands/floating_scroll.c
@@ -1,4 +1,6 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 #include "stringop.h"
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 0be442ca..12c5d02c 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include <wlc/wlc.h>
 #include "sway/commands.h"
 #include "sway/container.h"
diff --git a/sway/commands/focus_follows_mouse.c b/sway/commands/focus_follows_mouse.c
index 8ccefa59..7c9c2b13 100644
--- a/sway/commands/focus_follows_mouse.c
+++ b/sway/commands/focus_follows_mouse.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 
 struct cmd_results *cmd_focus_follows_mouse(int argc, char **argv) {
diff --git a/sway/commands/font.c b/sway/commands/font.c
index 1ee06396..32994f8a 100644
--- a/sway/commands/font.c
+++ b/sway/commands/font.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
 #include "sway/border.h"
 #include "sway/commands.h"
diff --git a/sway/commands/for_window.c b/sway/commands/for_window.c
index 8c5722fd..d1fd1641 100644
--- a/sway/commands/for_window.c
+++ b/sway/commands/for_window.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
 #include "sway/commands.h"
 #include "sway/criteria.h"
diff --git a/sway/commands/force_focus_wrapping.c b/sway/commands/force_focus_wrapping.c
index 23019cd3..f19dd163 100644
--- a/sway/commands/force_focus_wrapping.c
+++ b/sway/commands/force_focus_wrapping.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 
 struct cmd_results *cmd_force_focus_wrapping(int argc, char **argv) {
diff --git a/sway/commands/gaps.c b/sway/commands/gaps.c
index fe06add4..0a48592d 100644
--- a/sway/commands/gaps.c
+++ b/sway/commands/gaps.c
@@ -2,6 +2,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/container.h"
 #include "sway/focus.h"
diff --git a/sway/commands/hide_edge_borders.c b/sway/commands/hide_edge_borders.c
index cb4f052d..ee2a2644 100644
--- a/sway/commands/hide_edge_borders.c
+++ b/sway/commands/hide_edge_borders.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 
 struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
diff --git a/sway/commands/input.c b/sway/commands/input.c
index f584bb77..ad53d272 100644
--- a/sway/commands/input.c
+++ b/sway/commands/input.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 #include "log.h"
diff --git a/sway/commands/input/accel_profile.c b/sway/commands/input/accel_profile.c
index 290129f5..8288c1ad 100644
--- a/sway/commands/input/accel_profile.c
+++ b/sway/commands/input/accel_profile.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 
diff --git a/sway/commands/input/click_method.c b/sway/commands/input/click_method.c
index 0a7b7d23..5e9d3dcb 100644
--- a/sway/commands/input/click_method.c
+++ b/sway/commands/input/click_method.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 #include "log.h"
diff --git a/sway/commands/input/drag_lock.c b/sway/commands/input/drag_lock.c
index 0d100dd0..f5a7beb4 100644
--- a/sway/commands/input/drag_lock.c
+++ b/sway/commands/input/drag_lock.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 
diff --git a/sway/commands/input/dwt.c b/sway/commands/input/dwt.c
index 82013730..557b2207 100644
--- a/sway/commands/input/dwt.c
+++ b/sway/commands/input/dwt.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 
diff --git a/sway/commands/input/events.c b/sway/commands/input/events.c
index 2f13e30a..9d54287a 100644
--- a/sway/commands/input/events.c
+++ b/sway/commands/input/events.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 #include "log.h"
diff --git a/sway/commands/input/left_handed.c b/sway/commands/input/left_handed.c
index 3278bd33..6c913e70 100644
--- a/sway/commands/input/left_handed.c
+++ b/sway/commands/input/left_handed.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 
diff --git a/sway/commands/input/middle_emulation.c b/sway/commands/input/middle_emulation.c
index b2e55468..33cdd7d6 100644
--- a/sway/commands/input/middle_emulation.c
+++ b/sway/commands/input/middle_emulation.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 
diff --git a/sway/commands/input/natural_scroll.c b/sway/commands/input/natural_scroll.c
index ac8cec12..7bc8b8d0 100644
--- a/sway/commands/input/natural_scroll.c
+++ b/sway/commands/input/natural_scroll.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 
diff --git a/sway/commands/input/scroll_method.c b/sway/commands/input/scroll_method.c
index de032b64..5c6c3d7a 100644
--- a/sway/commands/input/scroll_method.c
+++ b/sway/commands/input/scroll_method.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 
diff --git a/sway/commands/input/tap.c b/sway/commands/input/tap.c
index 9b559447..9e3ca2af 100644
--- a/sway/commands/input/tap.c
+++ b/sway/commands/input/tap.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/input.h"
 #include "log.h"
diff --git a/sway/commands/layout.c b/sway/commands/layout.c
index d04bb4dc..570cd207 100644
--- a/sway/commands/layout.c
+++ b/sway/commands/layout.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/container.h"
 #include "sway/layout.h"
diff --git a/sway/commands/log_colors.c b/sway/commands/log_colors.c
index 6ef99da7..815d1942 100644
--- a/sway/commands/log_colors.c
+++ b/sway/commands/log_colors.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "log.h"
 
diff --git a/sway/commands/mode.c b/sway/commands/mode.c
index ed3f432f..d2985c54 100644
--- a/sway/commands/mode.c
+++ b/sway/commands/mode.c
@@ -1,5 +1,7 @@
+#define _XOPEN_SOURCE 500
 #include <stdbool.h>
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/config.h"
 #include "sway/ipc-server.h"
diff --git a/sway/commands/mouse_warping.c b/sway/commands/mouse_warping.c
index ef71d595..5596d483 100644
--- a/sway/commands/mouse_warping.c
+++ b/sway/commands/mouse_warping.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 
 struct cmd_results *cmd_mouse_warping(int argc, char **argv) {
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 1a8a321e..97e10f10 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include <wlc/wlc.h>
 #include "sway/commands.h"
 #include "sway/container.h"
diff --git a/sway/commands/new_float.c b/sway/commands/new_float.c
index 8e4e354f..432af436 100644
--- a/sway/commands/new_float.c
+++ b/sway/commands/new_float.c
@@ -1,5 +1,6 @@
 #include <errno.h>
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/container.h"
 
diff --git a/sway/commands/new_window.c b/sway/commands/new_window.c
index 423b5af0..722d7d75 100644
--- a/sway/commands/new_window.c
+++ b/sway/commands/new_window.c
@@ -1,5 +1,6 @@
 #include <errno.h>
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/container.h"
 
diff --git a/sway/commands/orientation.c b/sway/commands/orientation.c
index b6d7202e..e54b60ee 100644
--- a/sway/commands/orientation.c
+++ b/sway/commands/orientation.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 
 struct cmd_results *cmd_orientation(int argc, char **argv) {
diff --git a/sway/commands/output.c b/sway/commands/output.c
index 01ac9f4e..e5d4b317 100644
--- a/sway/commands/output.c
+++ b/sway/commands/output.c
@@ -1,7 +1,9 @@
+#define _XOPEN_SOURCE 500
 #include <ctype.h>
 #include <libgen.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <unistd.h>
 #include <wordexp.h>
 #include "sway/commands.h"
diff --git a/sway/commands/resize.c b/sway/commands/resize.c
index 28b20dc4..61af080c 100644
--- a/sway/commands/resize.c
+++ b/sway/commands/resize.c
@@ -3,6 +3,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <wlc/wlc.h>
 #include "sway/commands.h"
 #include "sway/layout.h"
diff --git a/sway/commands/scratchpad.c b/sway/commands/scratchpad.c
index d43ef82d..d5e888b8 100644
--- a/sway/commands/scratchpad.c
+++ b/sway/commands/scratchpad.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include <wlc/wlc.h>
 #include "sway/commands.h"
 #include "sway/container.h"
diff --git a/sway/commands/seamless_mouse.c b/sway/commands/seamless_mouse.c
index 4d4bcc02..7760e88d 100644
--- a/sway/commands/seamless_mouse.c
+++ b/sway/commands/seamless_mouse.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 
 struct cmd_results *cmd_seamless_mouse(int argc, char **argv) {
diff --git a/sway/commands/set.c b/sway/commands/set.c
index 8b293825..1d6bce04 100644
--- a/sway/commands/set.c
+++ b/sway/commands/set.c
@@ -1,5 +1,7 @@
+#define _XOPEN_SOURCE 500
 #include <stdio.h>
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/config.h"
 #include "list.h"
@@ -14,7 +16,6 @@ static int compare_set_qsort(const void *_l, const void *_r) {
 
 struct cmd_results *cmd_set(int argc, char **argv) {
 	char *tmp;
-	int size;
 	struct cmd_results *error = NULL;
 	if (!config->reading) return cmd_results_new(CMD_FAILURE, "set", "Can only be used in config file.");
 	if ((error = checkarg(argc, "set", EXPECTED_AT_LEAST, 2))) {
@@ -24,13 +25,14 @@ struct cmd_results *cmd_set(int argc, char **argv) {
 	if (argv[0][0] != '$') {
 		sway_log(L_INFO, "Warning: variable '%s' doesn't start with $", argv[0]);
 
-		size = asprintf(&tmp, "%s%s", "$", argv[0]);
-		if (size == -1) {
+		size_t size = snprintf(NULL, 0, "$%s", argv[0]);
+		tmp = malloc(size + 1);
+		if (!tmp) {
 			return cmd_results_new(CMD_FAILURE, "set", "Not possible to create variable $'%s'", argv[0]);
 		}
+		snprintf(tmp, size, "$%s", argv[0]);
 
-		argv[0] = strdup(tmp);
-		free(tmp);
+		argv[0] = tmp;
 	}
 
 	struct sway_variable *var = NULL;
diff --git a/sway/commands/smart_gaps.c b/sway/commands/smart_gaps.c
index bd50d6bc..815fc501 100644
--- a/sway/commands/smart_gaps.c
+++ b/sway/commands/smart_gaps.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 
 struct cmd_results *cmd_smart_gaps(int argc, char **argv) {
diff --git a/sway/commands/split.c b/sway/commands/split.c
index f3e58fbf..e7da93d7 100644
--- a/sway/commands/split.c
+++ b/sway/commands/split.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include <wlc/wlc-render.h>
 #include "sway/border.h"
 #include "sway/commands.h"
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c
index b49a3a69..c831bdfd 100644
--- a/sway/commands/workspace.c
+++ b/sway/commands/workspace.c
@@ -1,4 +1,6 @@
+#define _XOPEN_SOURCE 500
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 #include "sway/config.h"
 #include "sway/input_state.h"
diff --git a/sway/commands/workspace_auto_back_and_forth.c b/sway/commands/workspace_auto_back_and_forth.c
index 22a66678..d58ae5c8 100644
--- a/sway/commands/workspace_auto_back_and_forth.c
+++ b/sway/commands/workspace_auto_back_and_forth.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 
 struct cmd_results *cmd_ws_auto_back_and_forth(int argc, char **argv) {
diff --git a/sway/commands/workspace_layout.c b/sway/commands/workspace_layout.c
index c9305773..a2a1a5a2 100644
--- a/sway/commands/workspace_layout.c
+++ b/sway/commands/workspace_layout.c
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <strings.h>
 #include "sway/commands.h"
 
 struct cmd_results *cmd_workspace_layout(int argc, char **argv) {
-- 
cgit v1.2.3