summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-01-13 11:56:44 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-01-13 11:56:44 +0000
commitbf2d2fa8df4913d6d744a11c441e33c99c2c314b (patch)
tree7ec799b9f65adc2cc145a456e4acc69f10332c49
parentdf7669d613887e329e34f9e6ef5a3c076023990a (diff)
Make options_get_string return const string.
-rw-r--r--usr.bin/tmux/cmd-new-session.c8
-rw-r--r--usr.bin/tmux/names.c5
-rw-r--r--usr.bin/tmux/options.c4
-rw-r--r--usr.bin/tmux/server-client.c7
-rw-r--r--usr.bin/tmux/server-fn.c8
-rw-r--r--usr.bin/tmux/status.c27
-rw-r--r--usr.bin/tmux/tmux.h4
-rw-r--r--usr.bin/tmux/tty-term.c5
8 files changed, 35 insertions, 33 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index ab54ef01562..a122ca0d7c0 100644
--- a/usr.bin/tmux/cmd-new-session.c
+++ b/usr.bin/tmux/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-session.c,v 1.95 2016/11/16 11:37:16 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.96 2017/01/13 11:56:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -74,8 +74,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
struct environ *env;
struct termios tio, *tiop;
const char *newname, *target, *update, *errstr, *template;
- const char *path, *cwd, *to_free = NULL;
- char **argv, *cmd, *cause, *cp;
+ const char *path, *cmd, *cwd, *to_free = NULL;
+ char **argv, *cause, *cp;
int detached, already_attached, idx, argc;
u_int sx, sy;
struct format_tree *ft;
@@ -217,7 +217,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
cmd = options_get_string(global_s_options, "default-command");
if (cmd != NULL && *cmd != '\0') {
argc = 1;
- argv = &cmd;
+ argv = (char **)&cmd;
} else {
argc = 0;
argv = NULL;
diff --git a/usr.bin/tmux/names.c b/usr.bin/tmux/names.c
index 8e2a783fefd..24156a8355b 100644
--- a/usr.bin/tmux/names.c
+++ b/usr.bin/tmux/names.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: names.c,v 1.37 2016/10/11 13:21:59 nicm Exp $ */
+/* $OpenBSD: names.c,v 1.38 2017/01/13 11:56:43 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -121,7 +121,8 @@ static char *
format_window_name(struct window *w)
{
struct format_tree *ft;
- char *fmt, *name;
+ const char *fmt;
+ char *name;
ft = format_create(NULL, 0);
format_defaults_window(ft, w);
diff --git a/usr.bin/tmux/options.c b/usr.bin/tmux/options.c
index e31b6ba592e..9fe2735da0a 100644
--- a/usr.bin/tmux/options.c
+++ b/usr.bin/tmux/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.22 2017/01/12 15:36:35 nicm Exp $ */
+/* $OpenBSD: options.c,v 1.23 2017/01/13 11:56:43 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -162,7 +162,7 @@ options_set_string(struct options *oo, const char *name, int append,
return (o);
}
-char *
+const char *
options_get_string(struct options *oo, const char *name)
{
struct options_entry *o;
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 51a89a1b9b8..a035a1f6beb 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.207 2017/01/13 10:12:12 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.208 2017/01/13 11:56:43 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -296,12 +296,13 @@ server_client_detach(struct client *c, enum msgtype msgtype)
proc_send_s(c->peer, msgtype, s->name);
}
-/* Execute command to replace a client, */
+/* Execute command to replace a client. */
void
server_client_exec(struct client *c, const char *cmd)
{
struct session *s = c->session;
- char *msg, *shell;
+ char *msg;
+ const char *shell;
size_t cmdsize, shellsize;
if (*cmd == '\0')
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index ea924328615..03d409c6504 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.102 2016/10/16 22:06:40 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.103 2017/01/13 11:56:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -35,9 +35,9 @@ static void server_destroy_session_group(struct session *);
void
server_fill_environ(struct session *s, struct environ *env)
{
- char *term;
- u_int idx;
- long pid;
+ const char *term;
+ u_int idx;
+ long pid;
if (s != NULL) {
term = options_get_string(global_options, "default-terminal");
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index 2955e8b92c5..1a436d7cef0 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.158 2017/01/06 11:57:03 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.159 2017/01/13 11:56:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -278,18 +278,19 @@ status_get_window_at(struct client *c, u_int x)
int
status_redraw(struct client *c)
{
- struct screen_write_ctx ctx;
- struct session *s = c->session;
- struct winlink *wl;
- struct screen old_status, window_list;
- struct grid_cell stdgc, lgc, rgc, gc;
- struct options *oo;
- time_t t;
- char *left, *right, *sep;
- u_int offset, needed;
- u_int wlstart, wlwidth, wlavailable, wloffset, wlsize;
- size_t llen, rlen, seplen;
- int larrow, rarrow;
+ struct screen_write_ctx ctx;
+ struct session *s = c->session;
+ struct winlink *wl;
+ struct screen old_status, window_list;
+ struct grid_cell stdgc, lgc, rgc, gc;
+ struct options *oo;
+ time_t t;
+ char *left, *right;
+ const char *sep;
+ u_int offset, needed;
+ u_int wlstart, wlwidth, wlavailable, wloffset, wlsize;
+ size_t llen, rlen, seplen;
+ int larrow, rarrow;
/* No status line? */
if (c->tty.sy == 0 || !options_get_number(s->options, "status"))
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index daee5b2e96c..f6e6723b9e6 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.694 2017/01/13 10:12:12 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.695 2017/01/13 11:56:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1630,7 +1630,7 @@ struct options_entry *options_find(struct options *, const char *);
void options_remove(struct options *, const char *);
struct options_entry * printflike(4, 5) options_set_string(struct options *,
const char *, int, const char *, ...);
-char *options_get_string(struct options *, const char *);
+const char *options_get_string(struct options *, const char *);
struct options_entry *options_set_number(struct options *, const char *,
long long);
long long options_get_number(struct options *, const char *);
diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c
index 249d577c7eb..24cb5950e20 100644
--- a/usr.bin/tmux/tty-term.c
+++ b/usr.bin/tmux/tty-term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-term.c,v 1.47 2016/12/09 21:39:27 nicm Exp $ */
+/* $OpenBSD: tty-term.c,v 1.48 2017/01/13 11:56:43 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -385,8 +385,7 @@ tty_term_find(char *name, int fd, char **cause)
struct tty_code *code;
u_int i;
int n, error;
- char *s;
- const char *acs;
+ const char *s, *acs;
LIST_FOREACH(term, &tty_terms, entry) {
if (strcmp(term->name, name) == 0) {