mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-23 00:23:08 +01:00
Rename all feature flags to HAVE_* and move out of makefiles into a configure
script which must be run before building. Still two makefiles but they are a hell of a lot simpler. HAVE_* also will make it easier to move to $buildsystem if necessary later.
This commit is contained in:
parent
e1b4a37722
commit
c8cf438d44
127
GNUmakefile
127
GNUmakefile
@ -1,132 +1,49 @@
|
||||
# $Id: GNUmakefile,v 1.94 2009-05-13 22:26:11 nicm Exp $
|
||||
# $Id: GNUmakefile,v 1.95 2009-05-13 23:26:59 nicm Exp $
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
PROG= tmux
|
||||
VERSION= 0.9
|
||||
|
||||
DATE= $(shell date +%Y%m%d-%H%M)
|
||||
|
||||
FDEBUG= 1
|
||||
|
||||
SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
|
||||
xmalloc.c xmalloc-debug.c input.c input-keys.c \
|
||||
screen.c screen-write.c screen-redraw.c \
|
||||
grid.c grid-view.c \
|
||||
window.c session.c log.c client.c client-msg.c client-fn.c cfg.c \
|
||||
layout.c key-string.c key-bindings.c resize.c arg.c mode-key.c \
|
||||
cmd.c cmd-generic.c cmd-string.c cmd-list.c \
|
||||
cmd-detach-client.c cmd-list-sessions.c cmd-new-window.c cmd-bind-key.c \
|
||||
cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
|
||||
cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
|
||||
cmd-list-windows.c cmd-attach-session.c cmd-send-prefix.c \
|
||||
cmd-refresh-client.c cmd-kill-window.c cmd-list-clients.c \
|
||||
cmd-link-window.c cmd-unlink-window.c cmd-next-window.c cmd-send-keys.c \
|
||||
cmd-swap-window.c cmd-rename-session.c cmd-kill-session.c \
|
||||
cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \
|
||||
cmd-paste-buffer.c cmd-new-session.c cmd-start-server.c \
|
||||
cmd-kill-server.c cmd-set-window-option.c cmd-show-options.c \
|
||||
cmd-show-window-options.c cmd-command-prompt.c cmd-set-buffer.c \
|
||||
cmd-show-buffer.c cmd-list-buffers.c cmd-delete-buffer.c \
|
||||
cmd-list-commands.c cmd-move-window.c cmd-select-prompt.c \
|
||||
cmd-respawn-window.c cmd-source-file.c cmd-server-info.c cmd-down-pane.c \
|
||||
cmd-clock-mode.c cmd-lock-server.c cmd-set-password.c cmd-up-pane.c \
|
||||
cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c cmd-kill-pane.c \
|
||||
cmd-resize-pane.c cmd-choose-window.c cmd-choose-session.c \
|
||||
cmd-suspend-client.c cmd-find-window.c cmd-load-buffer.c \
|
||||
cmd-copy-buffer.c cmd-break-pane.c cmd-swap-pane.c cmd-rotate-window.c \
|
||||
cmd-confirm-before.c cmd-next-layout.c cmd-previous-layout.c \
|
||||
window-clock.c window-scroll.c window-more.c window-copy.c \
|
||||
window-choose.c \
|
||||
options.c options-cmd.c paste.c colour.c utf8.c clock.c \
|
||||
tty.c tty-term.c tty-keys.c tty-write.c util.c names.c attributes.c
|
||||
|
||||
CC?= gcc
|
||||
INCDIRS+= -I. -I-
|
||||
CFLAGS+= -DBUILD="\"$(VERSION) ($(DATE))\""
|
||||
CFLAGS+= -DBUILD="\"$(VERSION)\""
|
||||
CPPFLAGS:= -I. -I- $(CPPFLAGS)
|
||||
LDFLAGS+= -L/usr/local/lib
|
||||
LIBS+= -lncurses
|
||||
|
||||
ifdef FDEBUG
|
||||
CFLAGS+= -g -ggdb -DDEBUG
|
||||
LDFLAGS+= -rdynamic
|
||||
CFLAGS+= -g -ggdb -DDEBUG
|
||||
LIBS+= -ldl
|
||||
endif
|
||||
ifeq (${CC},gcc)
|
||||
ifeq ($(CC),gcc)
|
||||
CFLAGS+= -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
|
||||
CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
|
||||
CFLAGS+= -Wwrite-strings -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
|
||||
CFLAGS+= -Wundef -Wbad-function-cast -Winline -Wcast-align
|
||||
endif
|
||||
|
||||
LDFLAGS+=
|
||||
LIBS+= -lncurses
|
||||
endif
|
||||
|
||||
PREFIX?= /usr/local
|
||||
INSTALLDIR= install -d
|
||||
INSTALLBIN= install -g bin -o root -m 555
|
||||
INSTALLMAN= install -g bin -o root -m 444
|
||||
|
||||
ifeq ($(shell uname),AIX)
|
||||
INCDIRS+= -I/usr/local/include/ncurses -Icompat
|
||||
SRCS+= compat/strlcpy.c compat/strlcat.c compat/strtonum.c \
|
||||
compat/fgetln.c compat/asprintf.c compat/daemon.c compat/forkpty-aix.c \
|
||||
compat/getopt.c compat/bsd-poll.c
|
||||
CFLAGS+= -DNO_TREE_H -DNO_ASPRINTF -DNO_QUEUE_H -DNO_VSYSLOG \
|
||||
-DNO_PROGNAME -DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM \
|
||||
-DNO_SETPROCTITLE -DNO_QUEUE_H -DNO_TREE_H -DNO_FORKPTY -DNO_FGETLN \
|
||||
-DBROKEN_GETOPT -DBROKEN_POLL -DNO_PATHS_H
|
||||
LDFLAGS+= -L/usr/local/lib
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname),SunOS)
|
||||
INCDIRS+= -Icompat -I/usr/include/ncurses
|
||||
SRCS+= compat/strtonum.c compat/daemon.c compat/forkpty-sunos.c \
|
||||
compat/asprintf.c compat/fgetln.c compat/getopt.c
|
||||
CFLAGS+= -DNO_STRTONUM -DNO_TREE_H -DNO_PATHS_H -DNO_SETPROCTITLE \
|
||||
-DNO_DAEMON -DNO_FORKPTY -DNO_PROGNAME -DNO_ASPRINTF -DNO_FGETLN \
|
||||
-DBROKEN_GETOPT -DNO_QUEUE_H
|
||||
LDFLAGS+= -L/usr/gnu/lib
|
||||
LIBS+= -lsocket -lnsl
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname),Darwin)
|
||||
INCDIRS+= -Icompat
|
||||
SRCS+= compat/strtonum.c compat/bsd-poll.c
|
||||
CFLAGS+= -DNO_STRTONUM -DNO_SETPROCTITLE -DNO_QUEUE_H -DNO_TREE_H -DBROKEN_POLL
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname),Linux)
|
||||
INCDIRS+= -Icompat
|
||||
SRCS+= compat/strlcpy.c compat/strlcat.c compat/strtonum.c \
|
||||
compat/fgetln.c compat/getopt.c
|
||||
CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \
|
||||
-DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM -DNO_SETPROCTITLE \
|
||||
-DNO_QUEUE_H -DNO_TREE_H -DUSE_PTY_H -DNO_FGETLN \
|
||||
-DBROKEN_GETOPT -std=c99
|
||||
LIBS+= -lcrypt -lutil
|
||||
endif
|
||||
|
||||
LCOS= $(shell uname|tr '[:upper:]' '[:lower:]')
|
||||
OSDEP= $(shell [ -f osdep-$(LCOS).c ] && echo $(LCOS) || echo unknown)
|
||||
SRCS+= osdep-$(OSDEP).c
|
||||
|
||||
SRCS= $(shell echo *.c|sed 's|osdep-[a-z0-9]*.c||g')
|
||||
include config.mk
|
||||
OBJS= $(patsubst %.c,%.o,$(SRCS))
|
||||
|
||||
CLEANFILES= ${PROG} *.o .depend *~ ${PROG}.core *.log compat/*.o index.html
|
||||
all: $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $+ $(LIBS)
|
||||
|
||||
CPPFLAGS:= ${INCDIRS} ${CPPFLAGS}
|
||||
|
||||
all: $(PROG)
|
||||
|
||||
$(PROG): $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $+ $(LIBS)
|
||||
|
||||
depend: $(SRCS)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -MM $(SRCS) > .depend
|
||||
|
||||
install:
|
||||
$(INSTALLDIR) $(DESTDIR)$(PREFIX)/bin
|
||||
$(INSTALLBIN) $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG)
|
||||
$(INSTALLDIR) $(DESTDIR)$(PREFIX)/man/man1
|
||||
$(INSTALLMAN) $(PROG).1 $(DESTDIR)$(PREFIX)/man/man1/$(PROG).1
|
||||
depend: $(SRCS)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -MM $(SRCS) > .depend
|
||||
|
||||
clean:
|
||||
rm -f $(CLEANFILES)
|
||||
rm -f tmux *.o .depend *~ *.core *.log compat/*.o
|
||||
|
||||
install:
|
||||
$(INSTALLDIR) $(DESTDIR)$(PREFIX)/bin
|
||||
$(INSTALLBIN) $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG)
|
||||
$(INSTALLDIR) $(DESTDIR)$(PREFIX)/man/man1
|
||||
$(INSTALLMAN) $(PROG).1 $(DESTDIR)$(PREFIX)/man/man1/$(PROG).1
|
||||
|
144
Makefile
144
Makefile
@ -1,154 +1,50 @@
|
||||
# $Id: Makefile,v 1.131 2009-05-13 22:10:39 nicm Exp $
|
||||
# $Id: Makefile,v 1.132 2009-05-13 23:27:00 nicm Exp $
|
||||
|
||||
.SUFFIXES: .c .o .y .h
|
||||
.PHONY: clean update-index.html upload-index.html
|
||||
.SUFFIXES: .c .o
|
||||
.PHONY: clean
|
||||
|
||||
PROG= tmux
|
||||
VERSION= 0.9
|
||||
|
||||
OS!= uname
|
||||
REL!= uname -r
|
||||
DATE!= date +%Y%m%d-%H%M
|
||||
|
||||
FDEBUG= 1
|
||||
|
||||
SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
|
||||
xmalloc.c xmalloc-debug.c input.c input-keys.c \
|
||||
screen.c screen-write.c screen-redraw.c \
|
||||
grid.c grid-view.c \
|
||||
window.c session.c log.c client.c client-msg.c client-fn.c cfg.c \
|
||||
layout.c key-string.c key-bindings.c resize.c arg.c mode-key.c \
|
||||
cmd.c cmd-generic.c cmd-string.c cmd-list.c \
|
||||
cmd-detach-client.c cmd-list-sessions.c cmd-new-window.c cmd-bind-key.c \
|
||||
cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
|
||||
cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
|
||||
cmd-list-windows.c cmd-attach-session.c cmd-send-prefix.c \
|
||||
cmd-refresh-client.c cmd-kill-window.c cmd-list-clients.c \
|
||||
cmd-link-window.c cmd-unlink-window.c cmd-next-window.c cmd-send-keys.c \
|
||||
cmd-swap-window.c cmd-rename-session.c cmd-kill-session.c \
|
||||
cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \
|
||||
cmd-paste-buffer.c cmd-new-session.c cmd-start-server.c \
|
||||
cmd-kill-server.c cmd-set-window-option.c cmd-show-options.c \
|
||||
cmd-show-window-options.c cmd-command-prompt.c cmd-set-buffer.c \
|
||||
cmd-show-buffer.c cmd-list-buffers.c cmd-delete-buffer.c \
|
||||
cmd-list-commands.c cmd-move-window.c cmd-select-prompt.c \
|
||||
cmd-respawn-window.c cmd-source-file.c cmd-server-info.c cmd-down-pane.c \
|
||||
cmd-clock-mode.c cmd-lock-server.c cmd-set-password.c cmd-up-pane.c \
|
||||
cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c cmd-kill-pane.c \
|
||||
cmd-resize-pane.c cmd-choose-window.c cmd-choose-session.c \
|
||||
cmd-suspend-client.c cmd-find-window.c cmd-load-buffer.c \
|
||||
cmd-copy-buffer.c cmd-break-pane.c cmd-swap-pane.c cmd-rotate-window.c \
|
||||
cmd-confirm-before.c cmd-next-layout.c cmd-previous-layout.c \
|
||||
window-clock.c window-scroll.c window-more.c window-copy.c \
|
||||
window-choose.c \
|
||||
options.c options-cmd.c paste.c colour.c utf8.c clock.c \
|
||||
tty.c tty-term.c tty-keys.c tty-write.c util.c names.c attributes.c
|
||||
|
||||
CC?= c
|
||||
INCDIRS+= -I. -I- -I/usr/local/include
|
||||
.ifdef PROFILE
|
||||
# Don't use ccache
|
||||
CC= /usr/bin/gcc
|
||||
CFLAGS+= -pg -DPROFILE -O0
|
||||
.endif
|
||||
.ifdef FDEBUG
|
||||
CFLAGS+= -g -ggdb -DDEBUG
|
||||
LDFLAGS+= -Wl,-E
|
||||
CFLAGS+= -DBUILD="\"$(VERSION) ($(DATE))\""
|
||||
.else
|
||||
CC?= cc
|
||||
CFLAGS+= -DBUILD="\"$(VERSION)\""
|
||||
.endif
|
||||
#CFLAGS+= -pedantic -std=c99
|
||||
CPPFLAGS:= -I. -I- -I/usr/local/include ${CPPFLAGS}
|
||||
LDFLAGS+= -L/usr/local/lib
|
||||
LIBS+= -lutil -lncurses
|
||||
|
||||
.ifdef FDEBUG
|
||||
LDFLAGS+= -Wl,-E
|
||||
CFLAGS+= -g -ggdb -DDEBUG
|
||||
CFLAGS+= -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
|
||||
CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
|
||||
CFLAGS+= -Wwrite-strings -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
|
||||
CFLAGS+= -Wundef -Wbad-function-cast -Winline -Wcast-align
|
||||
.endif
|
||||
|
||||
PREFIX?= /usr/local
|
||||
INSTALLDIR= install -d
|
||||
INSTALLBIN= install -g bin -o root -m 555
|
||||
INSTALLMAN= install -g bin -o root -m 444
|
||||
|
||||
LDFLAGS+= -L/usr/local/lib
|
||||
.ifdef PROFILE
|
||||
LDFLAGS+= -pg
|
||||
.endif
|
||||
LIBS+= -lutil -lncurses
|
||||
|
||||
# FreeBSD and DragonFly
|
||||
.if ${OS} == "FreeBSD" || ${OS} == "DragonFly"
|
||||
INCDIRS+= -Icompat
|
||||
CFLAGS+= -DUSE_LIBUTIL_H -DNO_QUEUE_H -DNO_TREE_H
|
||||
LIBS+= -lcrypt
|
||||
.endif
|
||||
|
||||
# NetBSD
|
||||
.if ${OS} == "NetBSD"
|
||||
INCDIRS+= -Icompat
|
||||
SRCS+= compat/strtonum.c
|
||||
LIBS+= -lcrypt
|
||||
CFLAGS+=-DNO_STRTONUM -DNO_QUEUE_H
|
||||
.endif
|
||||
|
||||
OSDEP!= [ -f osdep-${OS:L}.c ] && echo ${OS:L} || echo unknown
|
||||
SRCS+= osdep-${OSDEP}.c
|
||||
|
||||
OBJS= ${SRCS:S/.c/.o/:S/.y/.o/}
|
||||
|
||||
DISTDIR= ${PROG}-${VERSION}
|
||||
DISTFILES= *.[chyl] Makefile GNUmakefile *.[1-9] NOTES TODO CHANGES FAQ \
|
||||
`find examples compat -type f -and ! -path '*CVS*'`
|
||||
|
||||
CLEANFILES= ${PROG} *.o .depend *~ ${PROG}.core *.log compat/*.o index.html
|
||||
|
||||
CPPFLAGS:= ${INCDIRS} ${CPPFLAGS}
|
||||
SRCS!= echo *.c|sed 's|osdep-[a-z0-9]*.c||g'
|
||||
.include "config.mk"
|
||||
OBJS= ${SRCS:S/.c/.o/}
|
||||
|
||||
.c.o:
|
||||
${CC} ${CPPFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
||||
|
||||
.y.o:
|
||||
${YACC} ${.IMPSRC}
|
||||
${CC} ${CPPFLAGS} ${CFLAGS} -c y.tab.c -o ${.TARGET}
|
||||
|
||||
all: ${PROG}
|
||||
|
||||
${PROG}: ${OBJS}
|
||||
${CC} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBS}
|
||||
all: ${OBJS}
|
||||
${CC} ${LDFLAGS} -o tmux ${OBJS} ${LIBS}
|
||||
|
||||
depend:
|
||||
mkdep ${CPPFLAGS} ${CFLAGS} ${SRCS:M*.c}
|
||||
|
||||
dist: clean
|
||||
grep '^#FDEBUG=' Makefile
|
||||
grep '^#FDEBUG=' GNUmakefile
|
||||
[ "`(grep '^VERSION' Makefile; grep '^VERSION' GNUmakefile)| \
|
||||
uniq -u`" = "" ]
|
||||
tar -zc \
|
||||
-s '/.*/${DISTDIR}\/\0/' \
|
||||
-f ${DISTDIR}.tar.gz ${DISTFILES}
|
||||
|
||||
lint:
|
||||
lint -chvx ${CFLAGS:M-D*} ${SRCS:M*.c}
|
||||
|
||||
clean:
|
||||
rm -f ${CLEANFILES}
|
||||
|
||||
upload-index.html: update-index.html
|
||||
scp index.html images/*.png \
|
||||
nicm,tmux@web.sf.net:/home/groups/t/tm/tmux/htdocs
|
||||
rm -f images/small-*
|
||||
|
||||
update-index.html:
|
||||
(cd images && \
|
||||
rm -f small-* && \
|
||||
for i in *.png; do \
|
||||
convert "$$i" -resize 200x150 "small-$$i"; \
|
||||
done \
|
||||
)
|
||||
sed "s/%%VERSION%%/${VERSION}/g" index.html.in >index.html
|
||||
rm -f tmux *.o .depend *~ *.core *.log compat/*.o
|
||||
|
||||
install: all
|
||||
${INSTALLDIR} ${DESTDIR}${PREFIX}/bin
|
||||
${INSTALLBIN} ${PROG} ${DESTDIR}${PREFIX}/bin/
|
||||
${INSTALLBIN} tmux ${DESTDIR}${PREFIX}/bin/
|
||||
${INSTALLDIR} ${DESTDIR}${PREFIX}/man/man1
|
||||
${INSTALLMAN} ${PROG}.1 ${DESTDIR}${PREFIX}/man/man1/
|
||||
${INSTALLMAN} tmux.1 ${DESTDIR}${PREFIX}/man/man1/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: buffer-poll.c,v 1.10 2008-09-09 22:16:36 nicm Exp $ */
|
||||
/* $Id: buffer-poll.c,v 1.11 2009-05-13 23:27:00 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -46,7 +46,7 @@ buffer_poll(struct pollfd *pfd, struct buffer *in, struct buffer *out)
|
||||
pfd->fd, pfd->revents, BUFFER_USED(out), BUFFER_USED(in));
|
||||
#endif
|
||||
|
||||
#ifndef BROKEN_POLL
|
||||
#ifdef HAVE_POLL
|
||||
if (pfd->revents & (POLLERR|POLLNVAL|POLLHUP))
|
||||
return (-1);
|
||||
#endif
|
||||
|
4
client.c
4
client.c
@ -1,4 +1,4 @@
|
||||
/* $Id: client.c,v 1.47 2009-05-04 17:58:25 nicm Exp $ */
|
||||
/* $Id: client.c,v 1.48 2009-05-13 23:27:00 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -135,7 +135,7 @@ client_main(struct client_ctx *cctx)
|
||||
siginit();
|
||||
|
||||
logfile("client");
|
||||
#ifndef NO_SETPROCTITLE
|
||||
#ifdef HAVE_SETPROCTITLE
|
||||
setproctitle("client");
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
/* OPENBSD ORIGINAL: sys/sys/poll.h */
|
||||
|
||||
#if !defined(HAVE_POLL) && !defined(HAVE_POLL_H)
|
||||
#ifndef _COMPAT_POLL_H_
|
||||
#define _COMPAT_POLL_H_
|
||||
|
||||
@ -58,4 +57,3 @@ typedef unsigned int nfds_t;
|
||||
|
||||
int poll(struct pollfd *, nfds_t, int);
|
||||
#endif /* !_COMPAT_POLL_H_ */
|
||||
#endif /* !HAVE_POLL_H */
|
||||
|
175
configure
vendored
Executable file
175
configure
vendored
Executable file
@ -0,0 +1,175 @@
|
||||
#!/bin/sh
|
||||
# $Id: configure,v 1.1 2009-05-13 23:27:00 nicm Exp $
|
||||
|
||||
CONFIG_H=config.h
|
||||
CONFIG_MK=config.mk
|
||||
|
||||
echo "/* `uname` */" >$CONFIG_H
|
||||
echo "# `uname`" >$CONFIG_MK
|
||||
|
||||
case `uname` in
|
||||
# ------------------------------------------------------------------------------
|
||||
OpenBSD)
|
||||
cat <<EOF >>$CONFIG_H
|
||||
#define HAVE_ASPRINTF
|
||||
#define HAVE_DAEMON
|
||||
#define HAVE_FGETLN
|
||||
#define HAVE_FORKPTY
|
||||
#define HAVE_GETOPT
|
||||
#define HAVE_PATHS_H
|
||||
#define HAVE_POLL
|
||||
#define HAVE_PROGNAME
|
||||
#define HAVE_QUEUE_H
|
||||
#define HAVE_SETPROCTITLE
|
||||
#define HAVE_STRLCAT
|
||||
#define HAVE_STRLCPY
|
||||
#define HAVE_STRTONUM
|
||||
#define HAVE_TREE_H
|
||||
#define HAVE_UTIL_H
|
||||
#define HAVE_VSNPRINTF
|
||||
#define HAVE_VSYSLOG
|
||||
EOF
|
||||
cat <<EOF >>$CONFIG_MK
|
||||
SRCS+= osdep-openbsd.c
|
||||
EOF
|
||||
;;
|
||||
# ------------------------------------------------------------------------------
|
||||
Linux)
|
||||
cat <<EOF >>$CONFIG_H
|
||||
#define HAVE_ASPRINTF
|
||||
#define HAVE_DAEMON
|
||||
#define HAVE_FORKPTY
|
||||
#define HAVE_PATHS_H
|
||||
#define HAVE_POLL
|
||||
#define HAVE_PROGNAME
|
||||
#define HAVE_PTY_H
|
||||
#define HAVE_VSNPRINTF
|
||||
#define HAVE_VSYSLOG
|
||||
EOF
|
||||
cat <<EOF >>$CONFIG_MK
|
||||
SRCS+= osdep-linux.c \
|
||||
compat/fgetln.c \
|
||||
compat/strlcat.c \
|
||||
compat/strlcpy.c \
|
||||
compat/strtonum.c \
|
||||
compat/getopt.c
|
||||
CFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE
|
||||
LIBS+= -lcrypt -lutil
|
||||
EOF
|
||||
;;
|
||||
# ------------------------------------------------------------------------------
|
||||
AIX)
|
||||
cat <<EOF >>$CONFIG_H
|
||||
#define HAVE_DAEMON
|
||||
#define HAVE_VSNPRINTF
|
||||
EOF
|
||||
cat <<EOF >>$CONFIG_MK
|
||||
CPPFLAGS+= -I/usr/local/include/ncurses
|
||||
SRCS+= osdep-unknown.c \
|
||||
compat/asprintf.c \
|
||||
compat/bsd-poll.c \
|
||||
compat/daemon.c \
|
||||
compat/forkpty-aix.c \
|
||||
compat/strlcat.c \
|
||||
compat/strlcpy.c \
|
||||
compat/strtonum.c \
|
||||
compat/fgetln.c \
|
||||
compat/getopt.c
|
||||
EOF
|
||||
;;
|
||||
# ------------------------------------------------------------------------------
|
||||
SunOS)
|
||||
cat <<EOF >>$CONFIG_H
|
||||
#define HAVE_POLL
|
||||
#define HAVE_STRLCAT
|
||||
#define HAVE_STRLCPY
|
||||
#define HAVE_VSNPRINTF
|
||||
#define HAVE_VSYSLOG
|
||||
EOF
|
||||
cat <<EOF >>$CONFIG_MK
|
||||
CPPFLAGS+= -I/usr/local/include/ncurses
|
||||
LDFLAGS+= -L/usr/gnu/lib
|
||||
LIBS+= -lsocket -lnsl
|
||||
SRCS+= osdep-unknown.c \
|
||||
compat/asprintf.c \
|
||||
compat/daemon.c \
|
||||
compat/fgetln.c \
|
||||
compat/forkpty-sunos.c \
|
||||
compat/getopt.c \
|
||||
compat/strtonum.c
|
||||
EOF
|
||||
;;
|
||||
# ------------------------------------------------------------------------------
|
||||
Darwin)
|
||||
cat <<EOF >>$CONFIG_H
|
||||
#define HAVE_ASPRINTF
|
||||
#define HAVE_DAEMON
|
||||
#define HAVE_FGETLN
|
||||
#define HAVE_FORKPTY
|
||||
#define HAVE_GETOPT
|
||||
#define HAVE_PATHS_H
|
||||
#define HAVE_PROGNAME
|
||||
#define HAVE_STRLCAT
|
||||
#define HAVE_STRLCPY
|
||||
#define HAVE_UTIL_H
|
||||
#define HAVE_VSNPRINTF
|
||||
#define HAVE_VSYSLOG
|
||||
EOF
|
||||
cat <<EOF >>$CONFIG_MK
|
||||
SRCS+= osdep-darwin.c \
|
||||
compat/bsd-poll.c \
|
||||
compat/strtonum.c
|
||||
EOF
|
||||
;;
|
||||
# ------------------------------------------------------------------------------
|
||||
FreeBSD|DragonFly)
|
||||
cat <<EOF >>$CONFIG_H
|
||||
#define HAVE_ASPRINTF
|
||||
#define HAVE_DAEMON
|
||||
#define HAVE_FGETLN
|
||||
#define HAVE_FORKPTY
|
||||
#define HAVE_GETOPT
|
||||
#define HAVE_PATHS_H
|
||||
#define HAVE_POLL
|
||||
#define HAVE_PROGNAME
|
||||
#define HAVE_SETPROCTITLE
|
||||
#define HAVE_STRLCAT
|
||||
#define HAVE_STRLCPY
|
||||
#define HAVE_STRTONUM
|
||||
#define HAVE_LIBUTIL_H
|
||||
#define HAVE_VSNPRINTF
|
||||
#define HAVE_VSYSLOG
|
||||
EOF
|
||||
cat <<EOF >>$CONFIG_MK
|
||||
SRCS+= osdep-openbsd.c
|
||||
LIBS+= -lcrypt
|
||||
EOF
|
||||
;;
|
||||
# ------------------------------------------------------------------------------
|
||||
NetBSD)
|
||||
cat <<EOF >>$CONFIG_H
|
||||
#define HAVE_ASPRINTF
|
||||
#define HAVE_DAEMON
|
||||
#define HAVE_FGETLN
|
||||
#define HAVE_FORKPTY
|
||||
#define HAVE_GETOPT
|
||||
#define HAVE_PATHS_H
|
||||
#define HAVE_POLL
|
||||
#define HAVE_PROGNAME
|
||||
#define HAVE_SETPROCTITLE
|
||||
#define HAVE_STRLCAT
|
||||
#define HAVE_STRLCPY
|
||||
#define HAVE_TREE_H
|
||||
#define HAVE_UTIL_H
|
||||
#define HAVE_VSNPRINTF
|
||||
#define HAVE_VSYSLOG
|
||||
EOF
|
||||
cat <<EOF >>$CONFIG_MK
|
||||
SRCS+= osdep-openbsd.c
|
||||
LIBS+= -lcrypt
|
||||
EOF
|
||||
;;
|
||||
# ------------------------------------------------------------------------------
|
||||
esac
|
||||
|
||||
echo Configured for `uname`
|
6
log.c
6
log.c
@ -1,4 +1,4 @@
|
||||
/* $Id: log.c,v 1.11 2009-03-31 21:22:10 nicm Exp $ */
|
||||
/* $Id: log.c,v 1.12 2009-05-13 23:27:00 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -111,9 +111,7 @@ log_vwrite(int pri, const char *msg, va_list ap)
|
||||
|
||||
switch (log_type) {
|
||||
case LOG_TYPE_SYSLOG:
|
||||
#ifdef NO_VSYSLOG
|
||||
/* XXX */
|
||||
#else
|
||||
#ifdef HAVE_VSYSLOG
|
||||
vsyslog(pri, msg, ap);
|
||||
#endif
|
||||
break;
|
||||
|
8
server.c
8
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.140 2009-05-04 17:58:27 nicm Exp $ */
|
||||
/* $Id: server.c,v 1.141 2009-05-13 23:27:00 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -129,7 +129,7 @@ server_start(char *path)
|
||||
mode_t mask;
|
||||
int n, fd, pair[2], mode;
|
||||
char *cause;
|
||||
#ifndef NO_SETPROCTITLE
|
||||
#ifdef HAVE_SETPROCTITLE
|
||||
char rpathbuf[MAXPATHLEN];
|
||||
#endif
|
||||
|
||||
@ -181,7 +181,7 @@ server_start(char *path)
|
||||
log_debug("server started, pid %ld", (long) getpid());
|
||||
log_debug("socket path %s", socket_path);
|
||||
|
||||
#ifndef NO_SETPROCTITLE
|
||||
#ifdef HAVE_SETPROCTITLE
|
||||
if (realpath(socket_path, rpathbuf) == NULL)
|
||||
strlcpy(rpathbuf, socket_path, sizeof rpathbuf);
|
||||
setproctitle("server (%s)", rpathbuf);
|
||||
@ -284,7 +284,7 @@ server_main(int srv_fd)
|
||||
pfd = pfds;
|
||||
|
||||
/* Handle server socket. */
|
||||
#ifndef BROKEN_POLL
|
||||
#ifdef HAVE_POLL
|
||||
if (pfd->revents & (POLLERR|POLLNVAL|POLLHUP))
|
||||
fatalx("lost server socket");
|
||||
#endif
|
||||
|
4
status.c
4
status.c
@ -1,4 +1,4 @@
|
||||
/* $Id: status.c,v 1.77 2009-04-27 17:27:36 nicm Exp $ */
|
||||
/* $Id: status.c,v 1.78 2009-05-13 23:27:00 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -439,7 +439,7 @@ out:
|
||||
size_t
|
||||
status_width(struct winlink *wl)
|
||||
{
|
||||
#ifndef BROKEN_VSNPRINTF
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
return (xsnprintf(NULL, 0, "%d:%s ", wl->idx, wl->window->name));
|
||||
#else
|
||||
char *s;
|
||||
|
10
tmux.c
10
tmux.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.c,v 1.115 2009-05-13 22:10:39 nicm Exp $ */
|
||||
/* $Id: tmux.c,v 1.116 2009-05-13 23:27:00 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -27,12 +27,12 @@
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef NO_PATHS_H
|
||||
#include "tmux.h"
|
||||
|
||||
#ifdef HAVE_PATHS_H
|
||||
#include <paths.h>
|
||||
#endif
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
/* DragonFly uses an OpenBSD-like malloc() since 1.6 */
|
||||
#if defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
@ -64,7 +64,7 @@ char *socket_path;
|
||||
__dead void usage(void);
|
||||
char *makesockpath(const char *);
|
||||
|
||||
#ifdef NO_PROGNAME
|
||||
#ifndef HAVE_PROGNAME
|
||||
const char *__progname = "tmux";
|
||||
#endif
|
||||
|
||||
|
31
tmux.h
31
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.313 2009-05-13 22:20:47 nicm Exp $ */
|
||||
/* $Id: tmux.h,v 1.314 2009-05-13 23:27:00 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -19,6 +19,8 @@
|
||||
#ifndef TMUX_H
|
||||
#define TMUX_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define PROTOCOL_VERSION -12
|
||||
|
||||
/* Shut up gcc warnings about empty if bodies. */
|
||||
@ -27,26 +29,25 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifndef NO_QUEUE_H
|
||||
#ifdef HAVE_QUEUE_H
|
||||
#include <sys/queue.h>
|
||||
#else
|
||||
#include "compat/queue.h"
|
||||
#endif
|
||||
|
||||
#ifndef NO_TREE_H
|
||||
#ifdef HAVE_TREE_H
|
||||
#include <sys/tree.h>
|
||||
#else
|
||||
#include "compat/tree.h"
|
||||
#endif
|
||||
|
||||
#ifndef BROKEN_POLL
|
||||
#ifdef HAVE_POLL
|
||||
#include <poll.h>
|
||||
#else
|
||||
#undef HAVE_POLL
|
||||
#include "compat/bsd-poll.h"
|
||||
#endif
|
||||
|
||||
#ifndef BROKEN_GETOPT
|
||||
#ifdef HAVE_GETOPT
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
@ -103,7 +104,7 @@ extern const char *__progname;
|
||||
#define TTY_NAME_MAX 32
|
||||
#endif
|
||||
|
||||
#ifdef NO_PATHS_H
|
||||
#ifndef HAVE_PATHS_H
|
||||
#define _PATH_BSHELL "/bin/sh"
|
||||
#define _PATH_TMP "/tmp/"
|
||||
#define _PATH_DEVNULL "/dev/null"
|
||||
@ -1001,43 +1002,43 @@ extern const struct set_option_entry set_window_option_table[];
|
||||
#define NSETOPTION 24
|
||||
#define NSETWINDOWOPTION 17
|
||||
|
||||
#ifdef NO_STRTONUM
|
||||
#ifndef HAVE_STRTONUM
|
||||
/* strtonum.c */
|
||||
long long strtonum(const char *, long long, long long, const char **);
|
||||
#endif
|
||||
|
||||
#ifdef NO_STRLCPY
|
||||
#ifndef HAVE_STRLCPY
|
||||
/* strlcpy.c */
|
||||
size_t strlcpy(char *, const char *, size_t);
|
||||
#endif
|
||||
|
||||
#ifdef NO_STRLCAT
|
||||
#ifndef HAVE_STRLCAT
|
||||
/* strlcat.c */
|
||||
size_t strlcat(char *, const char *, size_t);
|
||||
#endif
|
||||
|
||||
#ifdef NO_DAEMON
|
||||
#ifndef HAVE_DAEMON
|
||||
/* daemon.c */
|
||||
int daemon(int, int);
|
||||
#endif
|
||||
|
||||
#ifdef NO_FORKPTY
|
||||
#ifndef HAVE_FORKPTY
|
||||
/* forkpty.c */
|
||||
pid_t forkpty(int *, char *, struct termios *, struct winsize *);
|
||||
#endif
|
||||
|
||||
#ifdef NO_ASPRINTF
|
||||
#ifndef HAVE_ASPRINTF
|
||||
/* asprintf.c */
|
||||
int asprintf(char **, const char *, ...);
|
||||
int vasprintf(char **, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#ifdef NO_FGETLN
|
||||
#ifndef HAVE_FGETLN
|
||||
/* fgetln.c */
|
||||
char *fgetln(FILE *, size_t *);
|
||||
#endif
|
||||
|
||||
#ifdef BROKEN_GETOPT
|
||||
#ifndef HAVE_GETOPT
|
||||
/* getopt.c */
|
||||
extern int BSDopterr;
|
||||
extern int BSDoptind;
|
||||
|
18
window.c
18
window.c
@ -1,4 +1,4 @@
|
||||
/* $Id: window.c,v 1.73 2009-05-04 17:58:27 nicm Exp $ */
|
||||
/* $Id: window.c,v 1.74 2009-05-13 23:27:00 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -28,23 +28,23 @@
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef NO_PATHS_H
|
||||
#include "tmux.h"
|
||||
|
||||
#ifdef HAVE_PATHS_H
|
||||
#include <paths.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIBUTIL_H
|
||||
#ifdef HAVE_FORKPTY
|
||||
#ifdef HAVE_LIBUTIL_H
|
||||
#include <libutil.h>
|
||||
#else
|
||||
#endif
|
||||
#ifdef USE_PTY_H
|
||||
#include <pty.h>
|
||||
#else
|
||||
#ifndef NO_FORKPTY
|
||||
#endif
|
||||
#ifdef HAVE_UTIL_H
|
||||
#include <util.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
/*
|
||||
* Each window is attached to one or two panes, each of which is a pty. This
|
||||
|
Loading…
Reference in New Issue
Block a user