aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-02-08 18:29:32 +0000
committerTiago Cunha <tcunha@gmx.com>2010-02-08 18:29:32 +0000
commit36a80b2cd639fc82b8fc3d8c3672cc88ae00f1ac (patch)
tree433a4b1783d04085f0859b4fc6d7550ab7dd5913 /server.c
parentc6ba78137977bd7a447fd5f97b205544c2b41505 (diff)
downloadrtmux-36a80b2cd639fc82b8fc3d8c3672cc88ae00f1ac.tar.gz
rtmux-36a80b2cd639fc82b8fc3d8c3672cc88ae00f1ac.tar.bz2
rtmux-36a80b2cd639fc82b8fc3d8c3672cc88ae00f1ac.zip
Sync OpenBSD patchset 640:
Use the array.h code for the causes list.
Diffstat (limited to 'server.c')
-rw-r--r--server.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/server.c b/server.c
index d924a6c9..0b684268 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.234 2010-02-08 18:10:07 tcunha Exp $ */
+/* $Id: server.c,v 1.235 2010-02-08 18:29:32 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -114,6 +114,7 @@ server_start(char *path)
{
struct window_pane *wp;
int pair[2], retval;
+ char *cause;
struct timeval tv;
u_int i;
#ifdef HAVE_SETPROCTITLE
@@ -186,27 +187,27 @@ server_start(char *path)
retval = 0;
if (access(SYSTEM_CFG, R_OK) == 0)
- load_cfg(SYSTEM_CFG, NULL, &cfg_ncauses, &cfg_causes);
+ load_cfg(SYSTEM_CFG, NULL, &cfg_causes);
else if (errno != ENOENT) {
- cfg_add_cause(&cfg_ncauses, &cfg_causes,
- "%s: %s", strerror(errno), SYSTEM_CFG);
+ cfg_add_cause(
+ &cfg_causes, "%s: %s", strerror(errno), SYSTEM_CFG);
}
if (cfg_file != NULL)
- load_cfg(cfg_file, NULL, &cfg_ncauses, &cfg_causes);
+ load_cfg(cfg_file, NULL, &cfg_causes);
/*
* If there is a session already, put the current window and pane into
* more mode.
*/
- if (!ARRAY_EMPTY(&sessions) && cfg_ncauses != 0) {
+ if (!ARRAY_EMPTY(&sessions) && !ARRAY_EMPTY(&cfg_causes)) {
wp = ARRAY_FIRST(&sessions)->curw->window->active;
window_pane_set_mode(wp, &window_more_mode);
- for (i = 0; i < cfg_ncauses; i++) {
- window_more_add(wp, "%s", cfg_causes[i]);
- xfree(cfg_causes[i]);
+ for (i = 0; i < ARRAY_LENGTH(&cfg_causes); i++) {
+ cause = ARRAY_ITEM(&cfg_causes, i);
+ window_more_add(wp, "%s", cause);
+ xfree(cause);
}
- xfree(cfg_causes);
- cfg_ncauses = 0;
+ ARRAY_FREE(&cfg_causes);
}
cfg_finished = 1;