From 91f3165b2da17010fdb8d5d85e676fee442afcc4 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 23 Jun 2008 16:58:49 +0000 Subject: [PATCH] IRIX fixes thanks to Elias Pipping. --- GNUmakefile | 17 ++++++++++---- client.c | 4 +--- cmd-has-session.c | 4 ++-- compat/fgetln.c | 1 + input-keys.c | 56 +++++++++++++++++++++++------------------------ status.c | 4 ++-- tmux.c | 6 ++--- tty-keys.c | 8 +++---- tty.c | 12 +++++----- 9 files changed, 60 insertions(+), 52 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 1ad644e8..17cf030d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,4 +1,4 @@ -# $Id: GNUmakefile,v 1.30 2008-06-22 21:52:41 nicm Exp $ +# $Id: GNUmakefile,v 1.31 2008-06-23 16:58:49 nicm Exp $ .PHONY: clean @@ -53,6 +53,17 @@ INSTALLDIR= install -d INSTALLBIN= install -g bin -o root -m 555 INSTALLMAN= install -g bin -o root -m 444 +ifeq ($(shell uname),IRIX64) +INCDIRS+= -Icompat -I/usr/local/include/ncurses +SRCS+= compat/strlcpy.c compat/strtonum.c compat/daemon.c \ + compat/asprintf.c compat/fgetln.c +CFLAGS+= -DNO_STRLCPY -DNO_STRTONUM -DNO_TREE_H -DNO_SETPROCTITLE \ + -DNO_DAEMON -DNO_FORKPTY -DNO_PROGNAME -DNO_ASPRINTF -DNO_FGETLN \ + -D_SGI_SOURCE -std=c99 +LDFLAGS+= -L/usr/local/lib +LIBS+= -lgen +endif + ifeq ($(shell uname),SunOS) INCDIRS+= -Icompat -I/usr/local/include/ncurses SRCS+= compat/strtonum.c compat/daemon.c compat/forkpty-sunos.c \ @@ -75,10 +86,8 @@ INCDIRS+= -Icompat SRCS+= compat/strlcpy.c compat/strlcat.c compat/strtonum.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_QUEUE_H -DNO_TREE_H -DUSE_PTY_H -std=c99 LIBS+= -lrt -lutil -# Required for LLONG_MAX and friends -CFLAGS+= -std=c99 endif OBJS= $(patsubst %.c,%.o,$(SRCS)) diff --git a/client.c b/client.c index 918bd543..308c1067 100644 --- a/client.c +++ b/client.c @@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.32 2008-06-19 19:36:55 nicm Exp $ */ +/* $Id: client.c,v 1.33 2008-06-23 16:58:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -44,10 +44,8 @@ client_init(const char *path, struct client_ctx *cctx, int start_server) int mode; u_int retries; struct buffer *b; - pid_t pid; char *name; - pid = 0; retries = 0; retry: if (stat(path, &sb) != 0) { diff --git a/cmd-has-session.c b/cmd-has-session.c index 53e1c4d4..6c010002 100644 --- a/cmd-has-session.c +++ b/cmd-has-session.c @@ -1,4 +1,4 @@ -/* $Id: cmd-has-session.c,v 1.9 2008-06-05 21:25:00 nicm Exp $ */ +/* $Id: cmd-has-session.c,v 1.10 2008-06-23 16:58:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -45,7 +45,7 @@ cmd_has_session_exec(struct cmd *self, struct cmd_ctx *ctx) struct cmd_target_data *data = self->data; struct session *s; - if ((s = cmd_find_session(ctx, data->target)) == NULL) + if (cmd_find_session(ctx, data->target) == NULL) return; if (ctx->cmdclient != NULL) diff --git a/compat/fgetln.c b/compat/fgetln.c index 7f7154f9..a5bcf00c 100644 --- a/compat/fgetln.c +++ b/compat/fgetln.c @@ -36,6 +36,7 @@ #include #include +#include #include "tmux.h" diff --git a/input-keys.c b/input-keys.c index d1259d13..e53895e8 100644 --- a/input-keys.c +++ b/input-keys.c @@ -1,4 +1,4 @@ -/* $Id: input-keys.c,v 1.8 2008-06-18 22:21:51 nicm Exp $ */ +/* $Id: input-keys.c,v 1.9 2008-06-23 16:58:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -30,35 +30,35 @@ struct { } input_keys[] = { /* { KEYC_BACKSPACE, "\010" }, */ - { KEYC_DC, "\e[3~" }, - { KEYC_F1, "\eOP" }, - { KEYC_F10, "\e[21~" }, - { KEYC_F11, "\e[23~" }, - { KEYC_F12, "\e[24~" }, - { KEYC_F2, "\eOQ" }, - { KEYC_F3, "\eOR" }, - { KEYC_F4, "\eOS" }, - { KEYC_F5, "\e[15~" }, - { KEYC_F6, "\e[17~" }, - { KEYC_F7, "\e[18~" }, - { KEYC_F8, "\e[19~" }, - { KEYC_F9, "\e[20~" }, - { KEYC_FIND, "\e[1~" }, - { KEYC_IC, "\e[2~" }, - { KEYC_NPAGE, "\e[6~" }, - { KEYC_PPAGE, "\e[5~" }, - { KEYC_SELECT, "\e[4~" }, + { KEYC_DC, "\033[3~" }, + { KEYC_F1, "\033OP" }, + { KEYC_F10, "\033[21~" }, + { KEYC_F11, "\033[23~" }, + { KEYC_F12, "\033[24~" }, + { KEYC_F2, "\033OQ" }, + { KEYC_F3, "\033OR" }, + { KEYC_F4, "\033OS" }, + { KEYC_F5, "\033[15~" }, + { KEYC_F6, "\033[17~" }, + { KEYC_F7, "\033[18~" }, + { KEYC_F8, "\033[19~" }, + { KEYC_F9, "\033[20~" }, + { KEYC_FIND, "\033[1~" }, + { KEYC_IC, "\033[2~" }, + { KEYC_NPAGE, "\033[6~" }, + { KEYC_PPAGE, "\033[5~" }, + { KEYC_SELECT, "\033[4~" }, - { KEYC_UP, "\eOA" }, - { KEYC_DOWN, "\eOB" }, - { KEYC_LEFT, "\eOD" }, - { KEYC_RIGHT, "\eOC" }, + { KEYC_UP, "\033OA" }, + { KEYC_DOWN, "\033OB" }, + { KEYC_LEFT, "\033OD" }, + { KEYC_RIGHT, "\033OC" }, - { KEYC_A1, "\eOw" }, - { KEYC_A3, "\eOy" }, - { KEYC_B2, "\eOu" }, - { KEYC_C1, "\eOq" }, - { KEYC_C3, "\eOs" } + { KEYC_A1, "\033Ow" }, + { KEYC_A3, "\033Oy" }, + { KEYC_B2, "\033Ou" }, + { KEYC_C1, "\033Oq" }, + { KEYC_C3, "\033Os" } }; #define NINPUTKEYS (sizeof input_keys / sizeof input_keys[0]) diff --git a/status.c b/status.c index 0aaea394..1c82c9eb 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.38 2008-06-23 07:41:21 nicm Exp $ */ +/* $Id: status.c,v 1.39 2008-06-23 16:58:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -444,7 +444,7 @@ status_prompt_key(struct client *c, int key) break; } /* FALLTHROUGH */ - case '\e': /* escape */ + case '\033': /* escape */ c->prompt_callback(c->prompt_data, NULL); server_clear_client_prompt(c); break; diff --git a/tmux.c b/tmux.c index b9e6e2fc..70121f56 100644 --- a/tmux.c +++ b/tmux.c @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.67 2008-06-23 07:41:21 nicm Exp $ */ +/* $Id: tmux.c,v 1.68 2008-06-23 16:58:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -176,11 +176,11 @@ main(int argc, char **argv) struct hdr hdr; const char *shell; struct passwd *pw; - char *client, *path, *name, *cause, *home; + char *path, *cause, *home; char rpath[MAXPATHLEN]; int n, opt; - client = path = name = NULL; + path = NULL; while ((opt = getopt(argc, argv, "f:qS:Vv")) != EOF) { switch (opt) { case 'f': diff --git a/tty-keys.c b/tty-keys.c index ea5f46ae..5fcbdf26 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -1,4 +1,4 @@ -/* $Id: tty-keys.c,v 1.3 2008-06-06 17:20:30 nicm Exp $ */ +/* $Id: tty-keys.c,v 1.4 2008-06-23 16:58:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -201,7 +201,7 @@ tty_keys_init(struct tty *tty) s = tigetstr(tty_keys[i].name); if (s == (char *) -1 || s == (char *) 0) continue; - if (s[0] != '\e' || s[1] == '\0') + if (s[0] != '\033' || s[1] == '\0') continue; tk = xmalloc(sizeof *tk); @@ -240,7 +240,7 @@ tty_keys_next(struct tty *tty, int *code) return (1); log_debug("keys have %zu bytes", BUFFER_USED(tty->in)); - if (*BUFFER_OUT(tty->in) != '\e') { + if (*BUFFER_OUT(tty->in) != '\033') { *code = buffer_read8(tty->in); return (0); } @@ -268,7 +268,7 @@ tty_keys_next(struct tty *tty, int *code) /* * XXX Pass through unchanged. */ - *code = '\e'; + *code = '\033'; buffer_remove(tty->in, 1); return (0); } diff --git a/tty.c b/tty.c index 9e066f2b..84c5dfae 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.34 2008-06-22 16:54:08 nicm Exp $ */ +/* $Id: tty.c,v 1.35 2008-06-23 16:58:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -387,7 +387,7 @@ tty_set_title(struct tty *tty, const char *title) strcmp(tty->termname, "screen") != 0) return; - tty_puts(tty, "\e]0;"); + tty_puts(tty, "\033]0;"); tty_puts(tty, title); tty_putc(tty, '\007'); } @@ -591,11 +591,11 @@ tty_vwrite(struct tty *tty, struct screen *s, int cmd, va_list ap) #endif case TTY_MOUSEOFF: if (key_mouse != NULL) - tty_puts(tty, "\e[?1000l"); + tty_puts(tty, "\033[?1000l"); break; case TTY_MOUSEON: if (key_mouse != NULL) - tty_puts(tty, "\e[?1000h"); + tty_puts(tty, "\033[?1000h"); break; case TTY_ATTRIBUTES: ua = va_arg(ap, u_int); @@ -650,7 +650,7 @@ tty_attributes(struct tty *tty, u_char attr, u_char colr) fg = 7; if (fg == 8) - tty_puts(tty, "\e[39m"); + tty_puts(tty, "\033[39m"); else if (set_a_foreground != NULL) tty_puts(tty, tparm(set_a_foreground, fg)); } @@ -661,7 +661,7 @@ tty_attributes(struct tty *tty, u_char attr, u_char colr) bg = 0; if (bg == 8) - tty_puts(tty, "\e[49m"); + tty_puts(tty, "\033[49m"); else if (set_a_background != NULL) tty_puts(tty, tparm(set_a_background, bg)); }