summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2019-06-05 06:44:08 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2019-06-05 06:44:08 +0100
commite252984993fdfd57a1fdc1eaf393e42e8589d623 (patch)
tree0f4f7beda1288b2990d0fd6691985e120411c2a2
parent17bc11bd157db83fd90051824c289712fbac7eae (diff)
If only one of -x or -y is given, use the calculated size for the
other. Also fix some warnings. Pointed out by Ben Boeckel.
-rw-r--r--cmd-new-session.c7
-rw-r--r--cmd-parse.y1
-rw-r--r--cmd-queue.c2
-rw-r--r--format.c4
4 files changed, 9 insertions, 5 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 2fd13420..559c268c 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -242,8 +242,13 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
/* Create the new session. */
oo = options_create(global_s_options);
- if (args_has(args, 'x') || args_has(args, 'y'))
+ if (args_has(args, 'x') || args_has(args, 'y')) {
+ if (!args_has(args, 'x'))
+ dsx = sx;
+ if (!args_has(args, 'y'))
+ dsy = sy;
options_set_string(oo, "default-size", 0, "%ux%u", dsx, dsy);
+ }
env = environ_create();
if (c != NULL && !args_has(args, 'E'))
environ_update(global_s_options, c->environ, env);
diff --git a/cmd-parse.y b/cmd-parse.y
index d369dc4e..6feeb35a 100644
--- a/cmd-parse.y
+++ b/cmd-parse.y
@@ -23,6 +23,7 @@
#include <ctype.h>
#include <errno.h>
#include <pwd.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/cmd-queue.c b/cmd-queue.c
index 93dcaa53..1ee43508 100644
--- a/cmd-queue.c
+++ b/cmd-queue.c
@@ -202,7 +202,7 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current,
{
struct cmdq_item *item, *first = NULL, *last = NULL;
struct cmd *cmd;
- struct cmdq_shared *shared;
+ struct cmdq_shared *shared = NULL;
u_int group = 0;
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
diff --git a/format.c b/format.c
index 45479d5e..5ca970b7 100644
--- a/format.c
+++ b/format.c
@@ -1518,7 +1518,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
char **buf, size_t *len, size_t *off)
{
struct window_pane *wp = ft->wp;
- const char *errptr, *copy, *cp, *marker;
+ const char *errptr, *copy, *cp, *marker = NULL;
char *copy0, *condition, *found, *new;
char *value, *left, *right;
size_t valuelen;
@@ -1566,8 +1566,6 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
limit = 0;
if (fm->argc == 2 && fm->argv[1] != NULL)
marker = fm->argv[1];
- else
- marker = NULL;
break;
case 'l':
modifiers |= FORMAT_LITERAL;