mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
More Sun OS crap.
This commit is contained in:
parent
0d5ad358ae
commit
be53d7f298
10
GNUmakefile
10
GNUmakefile
@ -1,4 +1,4 @@
|
|||||||
# $Id: GNUmakefile,v 1.23 2008-06-18 19:52:29 nicm Exp $
|
# $Id: GNUmakefile,v 1.24 2008-06-18 20:11:25 nicm Exp $
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ VERSION= 0.4
|
|||||||
|
|
||||||
DATE= $(shell date +%Y%m%d-%H%M)
|
DATE= $(shell date +%Y%m%d-%H%M)
|
||||||
|
|
||||||
DEBUG= 1
|
#DEBUG= 1
|
||||||
|
|
||||||
META?= \002
|
META?= \002
|
||||||
|
|
||||||
@ -55,7 +55,9 @@ ifeq ($(shell uname),SunOS)
|
|||||||
INCDIRS+= -Icompat
|
INCDIRS+= -Icompat
|
||||||
SRCS+= compat/strtonum.c compat/daemon.c compat/forkpty-sunos.c
|
SRCS+= compat/strtonum.c compat/daemon.c compat/forkpty-sunos.c
|
||||||
CFLAGS+= -DNO_STRTONUM -DNO_TREE_H -DNO_PATHS_H -DNO_SETPROCTITLE \
|
CFLAGS+= -DNO_STRTONUM -DNO_TREE_H -DNO_PATHS_H -DNO_SETPROCTITLE \
|
||||||
-DNO_DAEMON -DNO_FORKPTY
|
-DNO_DAEMON -DNO_FORKPTY -DNO_PROGNAME
|
||||||
|
LDFLAGS+= -L/opt/csw/lib
|
||||||
|
LIBS+= -lsocket -lnsl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(shell uname),Darwin)
|
ifeq ($(shell uname),Darwin)
|
||||||
@ -71,7 +73,7 @@ SRCS+= compat/strlcpy.c compat/strlcat.c compat/strtonum.c
|
|||||||
CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \
|
CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \
|
||||||
-DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM -DNO_SETPROCTITLE \
|
-DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM -DNO_SETPROCTITLE \
|
||||||
-DNO_QUEUE_H -DNO_TREE_H -DUSE_PTY_H
|
-DNO_QUEUE_H -DNO_TREE_H -DUSE_PTY_H
|
||||||
LDFLAGS+= -lrt -lutil
|
LIBS+= -lrt -lutil
|
||||||
# Required for LLONG_MAX and friends
|
# Required for LLONG_MAX and friends
|
||||||
CFLAGS+= -std=c99
|
CFLAGS+= -std=c99
|
||||||
endif
|
endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: buffer-poll.c,v 1.5 2008-05-31 20:04:15 nicm Exp $ */
|
/* $Id: buffer-poll.c,v 1.6 2008-06-18 20:11:25 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -42,7 +42,8 @@ buffer_poll(struct pollfd *pfd, struct buffer *in, struct buffer *out)
|
|||||||
ssize_t n;
|
ssize_t n;
|
||||||
|
|
||||||
log_debug("buffer_poll (%d): fd=%d, revents=%d; out=%zu in=%zu",
|
log_debug("buffer_poll (%d): fd=%d, revents=%d; out=%zu in=%zu",
|
||||||
getpid(), pfd->fd, pfd->revents, BUFFER_USED(out), BUFFER_USED(in));
|
(int) getpid(),
|
||||||
|
pfd->fd, pfd->revents, BUFFER_USED(out), BUFFER_USED(in));
|
||||||
|
|
||||||
if (pfd->revents & (POLLERR|POLLNVAL|POLLHUP))
|
if (pfd->revents & (POLLERR|POLLNVAL|POLLHUP))
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-set-option.c,v 1.29 2008-06-18 18:52:44 nicm Exp $ */
|
/* $Id: cmd-set-option.c,v 1.30 2008-06-18 20:11:25 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -105,7 +105,7 @@ cmd_set_option_exec(struct cmd *self, unused struct cmd_ctx *ctx)
|
|||||||
struct options *oo;
|
struct options *oo;
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
u_int i;
|
u_int i;
|
||||||
int number, bool, key;
|
int number, flag, key;
|
||||||
u_char colour;
|
u_char colour;
|
||||||
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
@ -128,15 +128,15 @@ cmd_set_option_exec(struct cmd *self, unused struct cmd_ctx *ctx)
|
|||||||
if (errstr != NULL)
|
if (errstr != NULL)
|
||||||
number = 0;
|
number = 0;
|
||||||
|
|
||||||
bool = -1;
|
flag = -1;
|
||||||
if (number == 1 || strcasecmp(data->value, "on") == 0 ||
|
if (number == 1 || strcasecmp(data->value, "on") == 0 ||
|
||||||
strcasecmp(data->value, "yes") == 0)
|
strcasecmp(data->value, "yes") == 0)
|
||||||
bool = 1;
|
flag = 1;
|
||||||
else if (number == 0 || strcasecmp(data->value, "off") == 0 ||
|
else if (number == 0 || strcasecmp(data->value, "off") == 0 ||
|
||||||
strcasecmp(data->value, "no") == 0)
|
strcasecmp(data->value, "no") == 0)
|
||||||
bool = 0;
|
flag = 0;
|
||||||
} else
|
} else
|
||||||
bool = -2;
|
flag = -2;
|
||||||
|
|
||||||
if (strcmp(data->option, "prefix") == 0) {
|
if (strcmp(data->option, "prefix") == 0) {
|
||||||
if (data->value == NULL) {
|
if (data->value == NULL) {
|
||||||
@ -150,13 +150,13 @@ cmd_set_option_exec(struct cmd *self, unused struct cmd_ctx *ctx)
|
|||||||
}
|
}
|
||||||
options_set_key(oo, "prefix-key", key);
|
options_set_key(oo, "prefix-key", key);
|
||||||
} else if (strcmp(data->option, "status") == 0) {
|
} else if (strcmp(data->option, "status") == 0) {
|
||||||
if (bool == -1) {
|
if (flag == -1) {
|
||||||
ctx->error(ctx, "bad value: %s", data->value);
|
ctx->error(ctx, "bad value: %s", data->value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bool == -2)
|
if (flag == -2)
|
||||||
bool = !options_get_number(oo, "status-lines");
|
flag = !options_get_number(oo, "status-lines");
|
||||||
options_set_number(oo, "status-lines", bool);
|
options_set_number(oo, "status-lines", flag);
|
||||||
recalculate_sizes();
|
recalculate_sizes();
|
||||||
} else if (strcmp(data->option, "status-fg") == 0) {
|
} else if (strcmp(data->option, "status-fg") == 0) {
|
||||||
if (data->value == NULL) {
|
if (data->value == NULL) {
|
||||||
@ -273,13 +273,13 @@ cmd_set_option_exec(struct cmd *self, unused struct cmd_ctx *ctx)
|
|||||||
}
|
}
|
||||||
options_set_number(oo, "status-interval", number);
|
options_set_number(oo, "status-interval", number);
|
||||||
} else if (strcmp(data->option, "set-titles") == 0) {
|
} else if (strcmp(data->option, "set-titles") == 0) {
|
||||||
if (bool == -1) {
|
if (flag == -1) {
|
||||||
ctx->error(ctx, "bad value: %s", data->value);
|
ctx->error(ctx, "bad value: %s", data->value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bool == -2)
|
if (flag == -2)
|
||||||
bool = !options_get_number(oo, "set-titles");
|
flag = !options_get_number(oo, "set-titles");
|
||||||
options_set_number(oo, "set-titles", bool);
|
options_set_number(oo, "set-titles", flag);
|
||||||
} else {
|
} else {
|
||||||
ctx->error(ctx, "unknown option: %s", data->option);
|
ctx->error(ctx, "unknown option: %s", data->option);
|
||||||
return;
|
return;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-set-window-option.c,v 1.8 2008-06-16 17:35:40 nicm Exp $ */
|
/* $Id: cmd-set-window-option.c,v 1.9 2008-06-18 20:11:25 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -101,7 +101,7 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
int number, bool;
|
int number, flag;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
@ -120,26 +120,26 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
if (data->value != NULL) {
|
if (data->value != NULL) {
|
||||||
number = strtonum(data->value, 0, INT_MAX, &errstr);
|
number = strtonum(data->value, 0, INT_MAX, &errstr);
|
||||||
|
|
||||||
bool = -1;
|
flag = -1;
|
||||||
if (number == 1 || strcasecmp(data->value, "on") == 0 ||
|
if (number == 1 || strcasecmp(data->value, "on") == 0 ||
|
||||||
strcasecmp(data->value, "yes") == 0)
|
strcasecmp(data->value, "yes") == 0)
|
||||||
bool = 1;
|
flag = 1;
|
||||||
else if (number == 0 || strcasecmp(data->value, "off") == 0 ||
|
else if (number == 0 || strcasecmp(data->value, "off") == 0 ||
|
||||||
strcasecmp(data->value, "no") == 0)
|
strcasecmp(data->value, "no") == 0)
|
||||||
bool = 0;
|
flag = 0;
|
||||||
} else
|
} else
|
||||||
bool = -2;
|
flag = -2;
|
||||||
|
|
||||||
if (strcmp(data->option, "monitor-activity") == 0) {
|
if (strcmp(data->option, "monitor-activity") == 0) {
|
||||||
if (bool == -1) {
|
if (flag == -1) {
|
||||||
ctx->error(ctx, "bad value: %s", data->value);
|
ctx->error(ctx, "bad value: %s", data->value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bool == -2)
|
if (flag == -2)
|
||||||
wl->window->flags ^= WINDOW_MONITOR;
|
wl->window->flags ^= WINDOW_MONITOR;
|
||||||
else {
|
else {
|
||||||
if (bool)
|
if (flag)
|
||||||
wl->window->flags |= WINDOW_MONITOR;
|
wl->window->flags |= WINDOW_MONITOR;
|
||||||
else
|
else
|
||||||
wl->window->flags &= ~WINDOW_MONITOR;
|
wl->window->flags &= ~WINDOW_MONITOR;
|
||||||
@ -159,15 +159,15 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
session_alert_cancel(s, wl);
|
session_alert_cancel(s, wl);
|
||||||
}
|
}
|
||||||
} else if (strcmp(data->option, "aggressive-resize") == 0) {
|
} else if (strcmp(data->option, "aggressive-resize") == 0) {
|
||||||
if (bool == -1) {
|
if (flag == -1) {
|
||||||
ctx->error(ctx, "bad value: %s", data->value);
|
ctx->error(ctx, "bad value: %s", data->value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bool == -2)
|
if (flag == -2)
|
||||||
wl->window->flags ^= WINDOW_AGGRESSIVE;
|
wl->window->flags ^= WINDOW_AGGRESSIVE;
|
||||||
else {
|
else {
|
||||||
if (bool)
|
if (flag)
|
||||||
wl->window->flags |= WINDOW_AGGRESSIVE;
|
wl->window->flags |= WINDOW_AGGRESSIVE;
|
||||||
else
|
else
|
||||||
wl->window->flags &= ~WINDOW_AGGRESSIVE;
|
wl->window->flags &= ~WINDOW_AGGRESSIVE;
|
||||||
|
@ -29,10 +29,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <paths.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef NO_PATHS_H
|
||||||
|
#include <paths.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: forkpty-sunos.c,v 1.1 2008-06-18 19:52:29 nicm Exp $ */
|
/* $Id: forkpty-sunos.c,v 1.2 2008-06-18 20:11:25 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -18,15 +18,20 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stropts.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
forkpty(int *master, int *slave,
|
forkpty(int *master,
|
||||||
char *name, struct termios *tio, struct winsize *ws)
|
unused char *name, unused struct termios *tio, struct winsize *ws)
|
||||||
{
|
{
|
||||||
|
int slave;
|
||||||
char *path;
|
char *path;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
if ((*master = open("/dev/ptmx", O_RDWR)) == -1)
|
if ((*master = open("/dev/ptmx", O_RDWR)) == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -37,13 +42,16 @@ forkpty(int *master, int *slave,
|
|||||||
|
|
||||||
if ((path = ptsname(*master)) == NULL)
|
if ((path = ptsname(*master)) == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
if ((*slave = open(path, O_RDWR)) == -1)
|
if ((slave = open(path, O_RDWR)) == -1)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (ioctl(*slave, I_PUSH, "ptem") == -1)
|
if (ioctl(slave, I_PUSH, "ptem") == -1)
|
||||||
goto out;
|
fatal("ioctl failed");
|
||||||
if (ioctl(*slave, I_PUSH, "ldterm") == -1)
|
if (ioctl(slave, I_PUSH, "ldterm") == -1)
|
||||||
goto out;
|
fatal("ioctl failed");
|
||||||
|
|
||||||
|
if (ioctl(slave, TIOCSWINSZ, ws) == -1)
|
||||||
|
fatal("ioctl failed");
|
||||||
|
|
||||||
switch (pid = fork()) {
|
switch (pid = fork()) {
|
||||||
case -1:
|
case -1:
|
||||||
@ -53,13 +61,13 @@ forkpty(int *master, int *slave,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
close(*slave);
|
close(slave);
|
||||||
return (pid);
|
return (pid);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (*master != -1)
|
if (*master != -1)
|
||||||
close(*master);
|
close(*master);
|
||||||
if (*slave != -1)
|
if (slave != -1)
|
||||||
close(*slave);
|
close(slave);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
6
tmux.c
6
tmux.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.c,v 1.59 2008-06-18 19:34:50 nicm Exp $ */
|
/* $Id: tmux.c,v 1.60 2008-06-18 20:11:25 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -56,6 +56,10 @@ int be_quiet;
|
|||||||
void sighandler(int);
|
void sighandler(int);
|
||||||
__dead void usage(void);
|
__dead void usage(void);
|
||||||
|
|
||||||
|
#ifdef NO_PROGNAME
|
||||||
|
const char *__progname = "tmux";
|
||||||
|
#endif
|
||||||
|
|
||||||
__dead void
|
__dead void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
|
21
tmux.h
21
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.148 2008-06-18 19:52:29 nicm Exp $ */
|
/* $Id: tmux.h,v 1.149 2008-06-18 20:11:25 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -36,22 +36,31 @@
|
|||||||
#include "compat/tree.h"
|
#include "compat/tree.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <curses.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
|
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
|
|
||||||
extern char *__progname;
|
extern const char *__progname;
|
||||||
|
|
||||||
#ifndef INFTIM
|
#ifndef INFTIM
|
||||||
#define INFTIM -1
|
#define INFTIM -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WAIT_ANY
|
||||||
|
#define WAIT_ANY -1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SUN_LEN
|
||||||
|
#define SUN_LEN(sun) (sizeof (sun)->sun_path)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __dead
|
#ifndef __dead
|
||||||
#define __dead __attribute__ ((__noreturn__))
|
#define __dead __attribute__ ((__noreturn__))
|
||||||
#endif
|
#endif
|
||||||
@ -73,6 +82,7 @@ extern char *__progname;
|
|||||||
#ifdef NO_PATHS_H
|
#ifdef NO_PATHS_H
|
||||||
#define _PATH_BSHELL "/bin/sh"
|
#define _PATH_BSHELL "/bin/sh"
|
||||||
#define _PATH_TMP "/tmp/"
|
#define _PATH_TMP "/tmp/"
|
||||||
|
#define _PATH_DEVNULL "/dev/null"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Default configuration file. */
|
/* Default configuration file. */
|
||||||
@ -762,13 +772,12 @@ size_t strlcat(char *, const char *, size_t);
|
|||||||
|
|
||||||
#ifdef NO_DAEMON
|
#ifdef NO_DAEMON
|
||||||
/* daemon.c */
|
/* daemon.c */
|
||||||
size_t daemon(int, int);
|
int daemon(int, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NO_FORKPTY
|
#ifdef NO_FORKPTY
|
||||||
/* forkpty.c */
|
/* forkpty.c */
|
||||||
pid_t forkpty(
|
pid_t forkpty(int *, char *, struct termios *, struct winsize *);
|
||||||
int *, int *, char *, struct termios *, struct winsize *);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* tmux.c */
|
/* tmux.c */
|
||||||
|
6
window.c
6
window.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window.c,v 1.42 2008-06-18 19:34:50 nicm Exp $ */
|
/* $Id: window.c,v 1.43 2008-06-18 20:11:25 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -37,9 +37,11 @@
|
|||||||
#ifdef USE_PTY_H
|
#ifdef USE_PTY_H
|
||||||
#include <pty.h>
|
#include <pty.h>
|
||||||
#else
|
#else
|
||||||
|
#ifndef NO_FORKPTY
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
@ -185,7 +187,7 @@ window_create(const char *name,
|
|||||||
fatal("putenv failed");
|
fatal("putenv failed");
|
||||||
}
|
}
|
||||||
sigreset();
|
sigreset();
|
||||||
log_debug("started child: cmd=%s; pid=%d", cmd, getpid());
|
log_debug("started child: cmd=%s; pid=%d", cmd, (int) getpid());
|
||||||
log_close();
|
log_close();
|
||||||
|
|
||||||
execl(_PATH_BSHELL, "sh", "-c", cmd, (char *) NULL);
|
execl(_PATH_BSHELL, "sh", "-c", cmd, (char *) NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user