Merge branch 'obsd-master'

Conflicts:
	Makefile
	tmux.1
	window.c
This commit is contained in:
Thomas Adam
2014-04-23 11:26:11 +01:00
49 changed files with 431 additions and 489 deletions

View File

@ -17,13 +17,11 @@
*/
#include <sys/types.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <pwd.h>
#include <signal.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
@ -309,8 +307,8 @@ window_create1(u_int sx, u_int sy)
}
struct window *
window_create(const char *name, const char *cmd, const char *shell,
int cwd, struct environ *env, struct termios *tio,
window_create(const char *name, const char *cmd, const char *path,
const char *shell, int cwd, struct environ *env, struct termios *tio,
u_int sx, u_int sy, u_int hlimit, char **cause)
{
struct window *w;
@ -320,7 +318,8 @@ window_create(const char *name, const char *cmd, const char *shell,
wp = window_add_pane(w, hlimit);
layout_init(w, wp);
if (window_pane_spawn(wp, cmd, shell, cwd, env, tio, cause) != 0) {
if (window_pane_spawn(wp, cmd, path, shell, cwd, env, tio,
cause) != 0) {
window_destroy(w);
return (NULL);
}
@ -588,7 +587,7 @@ window_add_pane(struct window *w, u_int hlimit)
}
void
window_remove_pane(struct window *w, struct window_pane *wp)
window_lost_pane(struct window *w, struct window_pane *wp)
{
if (wp == w->active) {
w->active = w->last;
@ -600,6 +599,12 @@ window_remove_pane(struct window *w, struct window_pane *wp)
}
} else if (wp == w->last)
w->last = NULL;
}
void
window_remove_pane(struct window *w, struct window_pane *wp)
{
window_lost_pane(w, wp);
TAILQ_REMOVE(&w->panes, wp, entry);
window_pane_destroy(wp);
@ -696,8 +701,6 @@ window_printable_flags(struct session *s, struct winlink *wl)
flags[pos++] = '#';
if (wl->flags & WINLINK_BELL)
flags[pos++] = '!';
if (wl->flags & WINLINK_CONTENT)
flags[pos++] = '+';
if (wl->flags & WINLINK_SILENCE)
flags[pos++] = '~';
if (wl == s->curw)
@ -810,8 +813,9 @@ window_pane_destroy(struct window_pane *wp)
}
int
window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
int cwd, struct environ *env, struct termios *tio, char **cause)
window_pane_spawn(struct window_pane *wp, const char *cmd, const char *path,
const char *shell, int cwd, struct environ *env, struct termios *tio,
char **cause)
{
struct winsize ws;
char *argv0, paneid[16];
@ -867,6 +871,8 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
closefrom(STDERR_FILENO + 1);
if (path != NULL)
environ_set(env, "PATH", path);
xsnprintf(paneid, sizeof paneid, "%%%u", wp->id);
environ_set(env, "TMUX_PANE", paneid);
environ_push(env);
@ -1170,7 +1176,8 @@ window_pane_visible(struct window_pane *wp)
}
char *
window_pane_search(struct window_pane *wp, const char *searchstr, u_int *lineno)
window_pane_search(struct window_pane *wp, const char *searchstr,
u_int *lineno)
{
struct screen *s = &wp->base;
char *newsearchstr, *line, *msg;