diff options
author | kraxel <kraxel> | 2007-08-21 16:28:49 +0000 |
---|---|---|
committer | kraxel <kraxel> | 2007-08-21 16:28:49 +0000 |
commit | 1407b1fba20dbe480bf8f4189417c233608a30f8 (patch) | |
tree | aa44392284b45cc28ae80b502556730e62666b7a | |
parent | db83190c043f8c65db8db8a51c5a49f8af91d92f (diff) | |
download | amtterm-1407b1fba20dbe480bf8f4189417c233608a30f8.tar.gz |
fix buffering bug; add desktop file
-rw-r--r-- | GNUmakefile | 8 | ||||
-rw-r--r-- | mk/Variables.mk | 7 | ||||
-rw-r--r-- | redir.c | 28 |
3 files changed, 34 insertions, 9 deletions
diff --git a/GNUmakefile b/GNUmakefile index a050cee..dfc16d2 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -8,6 +8,7 @@ CFLAGS += -Wall -Wno-pointer-sign CFLAGS += -DVERSION='"$(VERSION)"' TARGETS := amtterm +DESKTOP := $(wildcard *.desktop) all: build @@ -39,9 +40,10 @@ LDLIBS += $(shell test "$(pkglst)" != "" && pkg-config --libs $(pkglst)) build: $(TARGETS) install: build - mkdir -p $(bindir) - install -s $(TARGETS) $(bindir) - install amttool $(bindir) + $(INSTALL_DIR) $(bindir) $(appdir) + $(INSTALL_BINARY) $(TARGETS) $(bindir) + $(INSTALL_SCRIPT) amttool $(bindir) + $(INSTALL_DATA) $(DESKTOP) $(appdir) clean: rm -f *.o *~ diff --git a/mk/Variables.mk b/mk/Variables.mk index d1c7c5f..88844b4 100644 --- a/mk/Variables.mk +++ b/mk/Variables.mk @@ -6,8 +6,11 @@ DESTDIR = srcdir ?= . prefix ?= /usr/local bindir = $(DESTDIR)$(prefix)/bin -mandir = $(DESTDIR)$(prefix)/share/man -locdir = $(DESTDIR)$(prefix)/share/locale +libdir = $(DESTDIR)$(prefix)/$(LIB) +shrdir = $(DESTDIR)$(prefix)/share +mandir = $(shrdir)/man +locdir = $(shrdir)/locale +appdir = $(shrdir)/applications # package + version empty := @@ -257,6 +257,8 @@ int redir_sol_recv(struct redir *r) len -= count; while (len) { + if (r->trace) + fprintf(stderr, "in+: need %d more data bytes\n", len); count = sizeof(msg); if (count > len) count = len; @@ -284,14 +286,24 @@ int redir_data(struct redir *r) { int rc, bshift; + if (r->trace) { + fprintf(stderr, "in --\n"); + if (r->blen) + fprintf(stderr, "in : already have %d\n", r->blen); + } rc = read(r->sock, r->buf + r->blen, sizeof(r->buf) - r->blen); - if (rc <= 0) { + switch (rc) { + case -1: perror("read(sock)"); goto err; + case 0: + fprintf(stderr, "EOF from socket\n"); + goto err; + default: + if (r->trace) + hexdump("in ", r->buf + r->blen, rc); + r->blen += rc; } - if (r->trace) - hexdump("in ", r->buf + r->blen, rc); - r->blen += rc; for (;;) { if (r->blen < 4) @@ -344,6 +356,8 @@ int redir_data(struct redir *r) } break; case SOL_DATA_FROM_HOST: + if (r->blen < 10) /* header length */ + goto again; bshift = redir_sol_recv(r); if (bshift < 0) goto err; @@ -365,6 +379,8 @@ int redir_data(struct redir *r) } /* have more data, shift by bshift */ + if (r->trace) + fprintf(stderr, "in : shift by %d\n", bshift); memmove(r->buf, r->buf + bshift, r->blen - bshift); r->blen -= bshift; } @@ -372,9 +388,13 @@ int redir_data(struct redir *r) again: /* need more data, jump back into poll/select loop */ + if (r->trace) + fprintf(stderr, "in : need more data\n"); return 0; err: + if (r->trace) + fprintf(stderr, "in : ERROR\n"); redir_state(r, REDIR_ERROR); close(r->sock); return -1; |