diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2014-01-20 21:34:33 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2014-01-20 21:34:33 +0000 |
commit | f6715155e783b3619e3f1b9439bad94d9e83cb87 (patch) | |
tree | bf6da2763496bb94aa4715776944e1eddc12ebaa /app | |
parent | 2d6c7336611ee172bf61009451f9682a6453b432 (diff) |
constify and rename some confusing variables around cmdq.
Diffstat (limited to 'app')
-rw-r--r-- | app/cwm/calmwm.h | 15 | ||||
-rw-r--r-- | app/cwm/conf.c | 20 | ||||
-rw-r--r-- | app/cwm/kbfunc.c | 6 | ||||
-rw-r--r-- | app/cwm/mousefunc.c | 6 | ||||
-rw-r--r-- | app/cwm/parse.y | 4 |
5 files changed, 26 insertions, 25 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index bc34b58ed..5fcdc3769 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.242 2014/01/20 19:06:04 okan Exp $ + * $OpenBSD: calmwm.h,v 1.243 2014/01/20 21:34:32 okan Exp $ */ #ifndef _CALMWM_H_ @@ -267,9 +267,9 @@ TAILQ_HEAD(mousebinding_q, mousebinding); struct cmd { TAILQ_ENTRY(cmd) entry; - char image[MAXPATHLEN]; -#define CMD_MAXLABELLEN 256 - char label[CMD_MAXLABELLEN]; +#define CMD_MAXNAMELEN 256 + char name[CMD_MAXNAMELEN]; + char path[MAXPATHLEN]; }; TAILQ_HEAD(cmd_q, cmd); @@ -514,19 +514,20 @@ void menuq_clear(struct menu_q *); int parse_config(const char *, struct conf *); void conf_atoms(void); -void conf_autogroup(struct conf *, int, char *); +void conf_autogroup(struct conf *, int, const char *); int conf_bind_kbd(struct conf *, const char *, const char *); int conf_bind_mouse(struct conf *, const char *, const char *); void conf_clear(struct conf *); void conf_client(struct client_ctx *); -void conf_cmd_add(struct conf *, char *, char *); +void conf_cmd_add(struct conf *, const char *, + const char *); void conf_cursor(struct conf *); void conf_grab_kbd(Window); void conf_grab_mouse(Window); void conf_init(struct conf *); -void conf_ignore(struct conf *, char *); +void conf_ignore(struct conf *, const char *); void conf_screen(struct screen_ctx *); void xev_loop(void); diff --git a/app/cwm/conf.c b/app/cwm/conf.c index 83db44405..efffc1355 100644 --- a/app/cwm/conf.c +++ b/app/cwm/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: conf.c,v 1.156 2014/01/20 19:06:04 okan Exp $ + * $OpenBSD: conf.c,v 1.157 2014/01/20 21:34:32 okan Exp $ */ #include <sys/param.h> @@ -37,23 +37,23 @@ static void conf_unbind_mouse(struct conf *, struct mousebinding *); /* Add an command menu entry to the end of the menu */ void -conf_cmd_add(struct conf *c, char *image, char *label) +conf_cmd_add(struct conf *c, const char *name, const char *path) { /* "term" and "lock" have special meanings. */ - if (strcmp(label, "term") == 0) - (void)strlcpy(c->termpath, image, sizeof(c->termpath)); - else if (strcmp(label, "lock") == 0) - (void)strlcpy(c->lockpath, image, sizeof(c->lockpath)); + if (strcmp(name, "term") == 0) + (void)strlcpy(c->termpath, path, sizeof(c->termpath)); + else if (strcmp(name, "lock") == 0) + (void)strlcpy(c->lockpath, path, sizeof(c->lockpath)); else { struct cmd *cmd = xmalloc(sizeof(*cmd)); - (void)strlcpy(cmd->image, image, sizeof(cmd->image)); - (void)strlcpy(cmd->label, label, sizeof(cmd->label)); + (void)strlcpy(cmd->name, name, sizeof(cmd->name)); + (void)strlcpy(cmd->path, path, sizeof(cmd->path)); TAILQ_INSERT_TAIL(&c->cmdq, cmd, entry); } } void -conf_autogroup(struct conf *c, int no, char *val) +conf_autogroup(struct conf *c, int no, const char *val) { struct autogroupwin *aw; char *p; @@ -74,7 +74,7 @@ conf_autogroup(struct conf *c, int no, char *val) } void -conf_ignore(struct conf *c, char *val) +conf_ignore(struct conf *c, const char *val) { struct winmatch *wm; diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index 191bf2221..ec6008d59 100644 --- a/app/cwm/kbfunc.c +++ b/app/cwm/kbfunc.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.87 2014/01/20 18:58:03 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.88 2014/01/20 21:34:32 okan Exp $ */ #include <sys/param.h> @@ -178,11 +178,11 @@ kbfunc_menu_search(struct client_ctx *cc, union arg *arg) TAILQ_INIT(&menuq); TAILQ_FOREACH(cmd, &Conf.cmdq, entry) - menuq_add(&menuq, cmd, "%s", cmd->label); + menuq_add(&menuq, cmd, "%s", cmd->name); if ((mi = menu_filter(sc, &menuq, "application", NULL, 0, search_match_text, NULL)) != NULL) - u_spawn(((struct cmd *)mi->ctx)->image); + u_spawn(((struct cmd *)mi->ctx)->path); menuq_clear(&menuq); } diff --git a/app/cwm/mousefunc.c b/app/cwm/mousefunc.c index 3c33aed82..fc4399407 100644 --- a/app/cwm/mousefunc.c +++ b/app/cwm/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: mousefunc.c,v 1.66 2014/01/20 18:58:03 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.67 2014/01/20 21:34:32 okan Exp $ */ #include <sys/param.h> @@ -265,13 +265,13 @@ mousefunc_menu_cmd(struct client_ctx *cc, union arg *arg) TAILQ_INIT(&menuq); TAILQ_FOREACH(cmd, &Conf.cmdq, entry) - menuq_add(&menuq, cmd, "%s", cmd->label); + menuq_add(&menuq, cmd, "%s", cmd->name); if (TAILQ_EMPTY(&menuq)) return; mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL); if (mi != NULL) - u_spawn(((struct cmd *)mi->ctx)->image); + u_spawn(((struct cmd *)mi->ctx)->path); menuq_clear(&menuq); } diff --git a/app/cwm/parse.y b/app/cwm/parse.y index 6700a010f..48c283681 100644 --- a/app/cwm/parse.y +++ b/app/cwm/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.50 2014/01/20 19:06:04 okan Exp $ */ +/* $OpenBSD: parse.y,v 1.51 2014/01/20 21:34:32 okan Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -137,7 +137,7 @@ main : FONTNAME STRING { conf->snapdist = $2; } | COMMAND STRING string { - conf_cmd_add(conf, $3, $2); + conf_cmd_add(conf, $2, $3); free($2); free($3); } |