summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO8
-rw-r--r--cmd-kill-server.c4
-rw-r--r--cmd-list-sessions.c4
-rw-r--r--cmd-switch-client.c4
-rw-r--r--cmd.c19
-rw-r--r--session.c7
-rw-r--r--tmux.c4
-rw-r--r--tmux.h4
8 files changed, 26 insertions, 28 deletions
diff --git a/TODO b/TODO
index cab4ac12..c09b5668 100644
--- a/TODO
+++ b/TODO
@@ -39,10 +39,6 @@
buffer manip: clear, view etc (clear-buffer, show-buffer)
- function groups, bind-key ^W { select-window 0; send-key ^W } etc ***
- allow fnmatch for -c, so that you can, eg, detach all clients
-- session specification is all over the place. some things use -s before cmd,
- some -s after, some no -s, there are various uses of -n. the differences are
- sort of logical, but confusing. needs rethought
-- XXX should -i for win idx be before cmd too??
- bind non prefix keys
- stuff like rename would be nice to be able to do in-client like screen, if
it could be implemented in a non-icky way
@@ -67,8 +63,8 @@
- tobiasu says it is borken on Linux with aterm + TERM=rxvt
- poll(2) is broken on OS X/Darwin, a workaround for this would be nice
- different screen model? layers perhaps? hmm
-- cfg file improvements: * comments to EOL
-- select-window can become windowonly...
+- cfg file improvements
+- select-window can become windowonly (what about default?)
---
[18:20] *priteau* i found something in tmux that could be tweaked to be better
diff --git a/cmd-kill-server.c b/cmd-kill-server.c
index 279929da..c4b3f7a6 100644
--- a/cmd-kill-server.c
+++ b/cmd-kill-server.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-server.c,v 1.2 2008-06-03 05:35:50 nicm Exp $ */
+/* $Id: cmd-kill-server.c,v 1.3 2008-06-03 18:13:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,7 +44,7 @@ const struct cmd_entry cmd_kill_server_entry = {
void
cmd_kill_server_exec(unused void *ptr, struct cmd_ctx *ctx)
{
- kill(getpid(), SIGTERM);
+ sigterm = 1;
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c
index fab1064b..0b112e96 100644
--- a/cmd-list-sessions.c
+++ b/cmd-list-sessions.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-sessions.c,v 1.12 2008-06-03 05:35:51 nicm Exp $ */
+/* $Id: cmd-list-sessions.c,v 1.13 2008-06-03 18:13:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -56,7 +56,7 @@ cmd_list_sessions_exec(unused void *ptr, struct cmd_ctx *ctx)
n = 0;
RB_FOREACH(wl, winlinks, &s->windows)
n++;
- tim = ctime(&s->tim);
+ tim = ctime(&s->ts.tv_sec);
*strchr(tim, '\n') = '\0';
ctx->print(ctx, "%s: %u windows"
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index d823d8b9..63b34487 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-switch-client.c,v 1.5 2008-06-03 05:35:51 nicm Exp $ */
+/* $Id: cmd-switch-client.c,v 1.6 2008-06-03 18:13:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -41,7 +41,7 @@ struct cmd_switch_client_data {
const struct cmd_entry cmd_switch_client_entry = {
"switch-client", "switchc",
- "session-name",
+ "[-c client-tty] session-name",
0,
cmd_switch_client_parse,
cmd_switch_client_exec,
diff --git a/cmd.c b/cmd.c
index 2fb90069..430a2410 100644
--- a/cmd.c
+++ b/cmd.c
@@ -1,4 +1,4 @@
-/* $Id: cmd.c,v 1.39 2008-06-03 16:55:09 nicm Exp $ */
+/* $Id: cmd.c,v 1.40 2008-06-03 18:13:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -17,6 +17,7 @@
*/
#include <sys/types.h>
+#include <sys/time.h>
#include <fnmatch.h>
#include <getopt.h>
@@ -253,18 +254,18 @@ struct session *
cmd_lookup_session(const char *sname)
{
struct session *s, *newest = NULL;
- time_t tim;
+ struct timespec *ts;
u_int i;
- tim = 0;
+ ts = NULL;
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i);
if (s == NULL || fnmatch(sname, s->name, 0) != 0)
continue;
- if (s->tim > tim) {
+ if (ts == NULL || timespeccmp(&s->ts, ts, >)) {
newest = s;
- tim = s->tim;
+ ts = &s->ts;
}
}
@@ -305,7 +306,7 @@ cmd_find_session(struct cmd_ctx *ctx, const char *cname, const char *sname)
struct client *c;
struct msg_command_data *data = ctx->msgdata;
u_int i;
- time_t tim;
+ struct timespec *ts;
if (cname != NULL) {
if ((c = cmd_lookup_client(cname)) == NULL) {
@@ -342,12 +343,12 @@ cmd_find_session(struct cmd_ctx *ctx, const char *cname, const char *sname)
return (s);
}
- tim = 0;
+ ts = NULL;
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i);
- if (s != NULL && s->tim > tim) {
+ if (s != NULL && (ts == NULL || timespeccmp(&s->ts, ts, >))) {
newest = ARRAY_ITEM(&sessions, i);
- tim = s->tim;
+ ts = &s->ts;
}
}
if (newest == NULL)
diff --git a/session.c b/session.c
index dc2ddce8..4bc52b75 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $Id: session.c,v 1.31 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: session.c,v 1.32 2008-06-03 18:13:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -17,10 +17,10 @@
*/
#include <sys/types.h>
+#include <sys/time.h>
#include <string.h>
#include <stdlib.h>
-#include <time.h>
#include <unistd.h>
#include "tmux.h"
@@ -90,7 +90,8 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy)
u_int i;
s = xmalloc(sizeof *s);
- s->tim = time(NULL);
+ if (clock_gettime(CLOCK_REALTIME, &s->ts) != 0)
+ fatal("clock_gettime");
s->curw = s->lastw = NULL;
RB_INIT(&s->windows);
ARRAY_INIT(&s->bells);
diff --git a/tmux.c b/tmux.c
index 67ff2a58..2c61d01c 100644
--- a/tmux.c
+++ b/tmux.c
@@ -1,4 +1,4 @@
-/* $Id: tmux.c,v 1.49 2008-06-03 05:35:51 nicm Exp $ */
+/* $Id: tmux.c,v 1.50 2008-06-03 18:13:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -59,7 +59,7 @@ __dead void
usage(void)
{
fprintf(stderr,
- "usage: %s [-v] [-f file] [-S socket-path] [command [flags]]",
+ "usage: %s [-v] [-f file] [-S socket-path] [command [flags]]\n",
__progname);
exit(1);
}
diff --git a/tmux.h b/tmux.h
index 9d3a22f7..1e635289 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.123 2008-06-03 16:55:09 nicm Exp $ */
+/* $Id: tmux.h,v 1.124 2008-06-03 18:13:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -536,7 +536,7 @@ RB_HEAD(winlinks, winlink);
/* Client session. */
struct session {
char *name;
- time_t tim;
+ struct timespec ts;
u_int sx;
u_int sy;