--- tf-4.0s1.orig/src/history.c +++ tf-4.0s1/src/history.c @@ -38,18 +38,6 @@ #define LOCALSIZE 100 /* local history size */ #define INPUTSIZE 100 /* command history buffer size */ -typedef struct History { /* circular list of Alines, and logfile */ - struct Aline **alines; - int size; /* actual number of lines currently saved */ - int maxsize; /* maximum number of lines that can be saved */ - int first; /* position of first line in circular array */ - int last; /* position of last line in circular array */ - int index; /* current recall position */ - int total; /* total number of lines ever saved */ - TFILE *logfile; - CONST char *logname; -} History; - #define empty(hist) (!(hist)->alines || !(hist)->size) static void FDECL(alloc_history,(History *hist, int maxsize)); --- tf-4.0s1.orig/src/history.h +++ tf-4.0s1/src/history.h @@ -31,6 +31,18 @@ #define record_global(aline) recordline(globalhist, (aline)) #define record_local(aline) recordline(localhist, (aline)) +typedef struct History { /* circular list of Alines, and logfile */ + struct Aline **alines; + int size; /* actual number of lines currently saved */ + int maxsize; /* maximum number of lines that can be saved */ + int first; /* position of first line in circular array */ + int last; /* position of last line in circular array */ + int index; /* current recall position */ + int total; /* total number of lines ever saved */ + TFILE *logfile; + CONST char *logname; +} History; + extern struct History globalhist[], localhist[]; extern int log_count, norecord, nolog; --- tf-4.0s1.orig/src/rules.mak +++ tf-4.0s1/src/rules.mak @@ -50,6 +50,7 @@ variable.h tty.h $(BUILDERS) makehelp.$O: makehelp.c config.h port.h $(BUILDERS) malloc.$O: malloc.c config.h port.h signals.h malloc.h $(BUILDERS) +mccp.$O: mccp.c mccp.h output.$O: output.c config.h port.h dstring.h $(TF_H) util.h tfio.h socket.h \ output.h macro.h search.h tty.h variable.h expr.h $(BUILDERS) process.$O: process.c config.h port.h dstring.h $(TF_H) util.h tfio.h \ @@ -59,7 +60,7 @@ process.h tty.h output.h signals.h variable.h $(BUILDERS) socket.$O: socket.c config.h port.h dstring.h $(TF_H) util.h tfio.h tfselect.h \ history.h world.h socket.h output.h process.h macro.h keyboard.h \ - commands.h command.h signals.h search.h $(BUILDERS) + commands.h command.h signals.h search.h mccp.h $(BUILDERS) tfio.$O: tfio.c config.h port.h dstring.h $(TF_H) util.h tfio.h tfselect.h \ output.h macro.h history.h search.h signals.h variable.h $(BUILDERS) tty.$O: tty.c config.h port.h $(TF_H) dstring.h util.h tty.h output.h macro.h \ --- tf-4.0s1.orig/src/socket.c +++ tf-4.0s1/src/socket.c @@ -67,6 +67,10 @@ #include "search.h" #include "variable.h" /* set_var_by_*() */ +#ifdef MUDCOMPRESS +# include "mccp.h" +#endif + #ifdef _POSIX_VERSION # include #endif @@ -206,6 +210,9 @@ TIME_T time[2]; /* time of last receive/send */ char state; /* state of parser finite state automaton */ long pid; /* pid of name resolution process */ +#ifdef MUDCOMPRESS + mc_state *mccp; /* mud compression struct */ +#endif } Sock; @@ -806,6 +813,9 @@ tsock = *(tsock ? &tsock->next : &hsock) = xsock; xsock->activity = 0; Stringinit(xsock->buffer); +#ifdef MUDCOMPRESS + xsock->mccp = mudcompress_new(); +#endif xsock->prompt = NULL; init_queue(xsock->queue = (Queue *)XMALLOC(sizeof(Queue))); xsock->next = NULL; @@ -1297,6 +1307,9 @@ #endif /* NONBLOCKING_GETHOST */ } Stringfree(sock->buffer); +#ifdef MUDCOMPRESS + mudcompress_delete(sock->mccp); +#endif if (sock->prompt) free_aline(sock->prompt); while(sock->queue->head) free_aline((Aline*)unlist(sock->queue->head, sock->queue)); @@ -1728,8 +1741,25 @@ } do { /* while (n > 0 && !interrupted() && (received += count) < SPAM) */ - do count = recv(xsock->fd, buffer, sizeof(buffer), 0); - while (count < 0 && errno == EINTR); +#ifdef MUDCOMPRESS + if (!mudcompress_pending(xsock->mccp)) + { + do count = recv(xsock->fd, buffer, sizeof(buffer), 0); + while (count < 0 && errno == EINTR); + + if (count > 0) { + mudcompress_receive(xsock->mccp, buffer, count); + if (mudcompress_error(xsock->mccp)) { + count = -1; + errno = EIO; + } + } + } +#else + do count = recv(xsock->fd, buffer, sizeof(buffer), 0); + while (count < 0 && errno == EINTR); +#endif + if (count <= 0) { int err = errno; #ifdef SUNOS_5_4 @@ -1761,6 +1791,25 @@ return received; } + received += count; + +#ifdef MUDCOMPRESS + { + const char *resp; + + count = 0; + while (count < sizeof(buffer) + && mudcompress_pending(xsock->mccp)) { + count += mudcompress_get(xsock->mccp, buffer + count, + sizeof(buffer) - count); + } + + resp = mudcompress_response(xsock->mccp); + if (resp) + transmit(resp,strlen(resp)); + } +#endif + for (place = buffer; place - buffer < count; place++) { /* We always accept 8-bit data, even though RFCs 854 and 1123 @@ -1958,7 +2007,6 @@ } /* See if anything arrived while we were parsing */ - FD_ZERO(&readfds); FD_SET(xsock->fd, &readfds); tv.tv_sec = tv.tv_usec = 0; @@ -1976,7 +2024,13 @@ if (errno != EINTR) die("handle_socket_input: select", errno); } - } while (n > 0 && !interrupted() && (received += count) < SPAM); +#ifdef MUDCOMPRESS + if (mudcompress_pending(xsock->mccp)) { + n = 1; + } +#endif + + } while (n > 0 && !interrupted() && received < SPAM); /* If lpflag is on and we got a partial line from the fg world, * assume the line is a prompt. --- tf-4.0s1.orig/src/tf.1.catman +++ tf-4.0s1/src/tf.1.catman @@ -152,6 +152,8 @@ Recall previously received text. + Support for the Mud Client Compression Protocol version 1 and 2. + CCOONNFFIIGGUURRAATTIIOONN FFIILLEESS _T_F will attempt to read two files when starting. The --- tf-4.0s1.orig/src/tf.1.nroffman +++ tf-4.0s1/src/tf.1.nroffman @@ -112,6 +112,8 @@ Page output using a --More-- prompt. .sp Recall previously received text. +.sp +Support for Mud Client Compression Protocol versions 1 and 2. .SH "CONFIGURATION FILES" .PP --- tf-4.0s1.orig/src/util.c +++ tf-4.0s1/src/util.c @@ -887,7 +887,7 @@ CONST char *end; path = (TFMAILPATH && *TFMAILPATH) ? TFMAILPATH : MAIL; - while (*(name = stringarg(&path, &end))) { + while (path && *(name = stringarg(&path, &end))) { for (oldp = &maillist; *oldp; oldp = &(*oldp)->next) { if (strncmp(name, (*oldp)->name, end-name) == 0 && !(*oldp)->name[end-name]) --- tf-4.0s1.orig/src/vars.mak +++ tf-4.0s1/src/vars.mak @@ -15,14 +15,14 @@ # Predefined variables: # O - object file suffix (e.g., "o" or "obj") -TFVER=40s1 +TFVER=40s1-mccp SOURCE = command.c dstring.c expand.c help.c history.c keyboard.c \ macro.c main.c malloc.c output.c process.c search.c signals.c \ socket.c tfio.c tty.c util.c variable.c world.c OBJS = command.$O dstring.$O expand.$O expr.$O help.$O history.$O keyboard.$O \ - macro.$O main.$O malloc.$O output.$O process.$O search.$O signals.$O \ + macro.$O main.$O malloc.$O mccp.$O output.$O process.$O search.$O signals.$O \ socket.$O tfio.$O tty.$O util.$O variable.$O world.$O \ regexp.$O $(OTHER_OBJS) --- tf-4.0s1.orig/src/mccp.c +++ tf-4.0s1/src/mccp.c @@ -0,0 +1,426 @@ +/* + * Client decompression module for the mud client compression protocol. + * See http://homepages.ihug.co.nz/~icecube/compress/ for more details. + * + * mccpDecompress.c - module code. Link this with your client code. + * + * Oliver Jowett . Demangle address as needed. + * + * This code is placed in the public domain. + * + */ + +/* Modified: 20000530 */ + +/* See mccp.h for API information */ + +#include +#include +#include + +#include "config.h" +#ifdef MUDCOMPRESS + +#include + +#include "mccp.h" + +/* Telnet values we're interested in */ + +#define IAC 255 +#define DONT 254 +#define DO 253 +#define WONT 252 +#define WILL 251 +#define SB 250 +#define SE 240 + +#define TELOPT_COMPRESS 85 +#define TELOPT_COMPRESS2 86 + +/* We say DO COMPRESS2 to WILL COMPRESS2, then DONT COMPRESS to WILL COMPRESS + * -or- + * We say DO COMPRESS to WILL COMPRESS if it arrives before any COMPRESS2. + * + * Later the server sends IAC SB COMPRESS IAC SE (v2) or IAC SB COMPRESS WILL + * SE (v1), and immediately following + * that, begins compressing + * + * Compression ends on a Z_STREAM_END, no other marker is used + */ + +static char will_v1[] = { IAC, WILL, TELOPT_COMPRESS, 0 }; +static char do_v1[] = { IAC, DO, TELOPT_COMPRESS, 0 }; +static char dont_v1[] = { IAC, DONT, TELOPT_COMPRESS, 0 }; +static char on_v1[] = { IAC, SB, TELOPT_COMPRESS, WILL, SE, 0 }; + +static char will_v2[] = { IAC, WILL, TELOPT_COMPRESS2, 0 }; +static char do_v2[] = { IAC, DO, TELOPT_COMPRESS2, 0 }; +static char on_v2[] = { IAC, SB, TELOPT_COMPRESS2, IAC, SE, 0 }; + +/* "Opaque" state object */ + +struct mc_state_s { + z_stream *stream; /* stream we're using */ + + unsigned char *inbuf; /* input buffer (data from mud) */ + unsigned int insize; /* .. and how much is used */ + unsigned int inalloc; /* .. and how much is allocated */ + + unsigned char *outbuf; /* output buffer (data to user) */ + unsigned int outsize; /* .. and how much is used */ + unsigned int outalloc; /* .. and how much is allocated */ + + int error; + int resp_v1; /* waiting to send IAC DO/DONT COMPRESS */ + int resp_v2; /* waiting to send IAC DO COMPRESS2 */ + int got_v2; /* responded to a IAC WILL COMPRESS2 already */ + + unsigned long comp; + unsigned long uncomp; +}; + +/* Initialise a new state object */ +mc_state *mudcompress_new(void) +{ + mc_state *state; + + state = malloc(sizeof(*state)); + state->stream = NULL; /* Not decompressing */ + state->inalloc = 2048; + state->outalloc = 2048; + state->inbuf = malloc(state->inalloc); + state->outbuf = malloc(state->outalloc); + state->insize = 0; + state->outsize = 0; + state->error = 0; + state->comp = 0; + state->uncomp = 0; + state->resp_v1 = 0; + state->resp_v2 = 0; + state->got_v2 = 0; + + return state; +} + +/* Clean up a state object */ +void mudcompress_delete(mc_state *state) +{ + if (state->stream) { + inflateEnd(state->stream); + free(state->stream); + } + + free(state->inbuf); + free(state->outbuf); + free(state); +} + +/* zlib helpers */ + +static void *zlib_alloc(void *opaque, unsigned int items, unsigned int size) +{ + return calloc(items, size); +} + +static void zlib_free(void *opaque, void *address) +{ + free(address); +} + +static void grow_inbuf(mc_state *state, int needed) +{ + int old = state->inalloc; + + while (state->inalloc < state->insize + needed) + state->inalloc *= 2; + + if (old != state->inalloc) + state->inbuf = realloc(state->inbuf, state->inalloc); +} + +static void grow_outbuf(mc_state *state, int needed) +{ + int old = state->outalloc; + + while (state->outalloc < state->outsize + needed) + state->outalloc *= 2; + + if (old != state->outalloc) + state->outbuf = realloc(state->outbuf, state->outalloc); +} + +static void decompress_inbuf(mc_state *state) +{ + int status; + + /* We are now decompressing from inbuf to outbuf */ + + if (!state->insize) + return; /* nothing to decompress? */ + + state->stream->next_in = state->inbuf; + state->stream->next_out = state->outbuf + state->outsize; + state->stream->avail_in = state->insize; + state->stream->avail_out = state->outalloc - state->outsize; + + status = inflate(state->stream, Z_PARTIAL_FLUSH); + + if (status == Z_OK || status == Z_STREAM_END) { + /* Successful decompression */ + + /* Remove used data from inbuf */ + state->comp += state->insize - state->stream->avail_in; + state->uncomp += state->stream->next_out - state->outbuf; + + memmove(state->inbuf, state->stream->next_in, state->stream->avail_in); + state->insize = state->stream->avail_in; + + /* Update outbuf pointers */ + state->outsize = state->stream->next_out - state->outbuf; + + /* Done */ + + if (status == Z_STREAM_END) { + /* Turn off compression too */ + + grow_outbuf(state, state->insize); + + memcpy(state->outbuf + state->outsize, state->inbuf, state->insize); + state->outsize += state->insize; + state->insize = 0; + + inflateEnd(state->stream); + free(state->stream); + state->stream = NULL; + } + + return; + } + + if (status == Z_BUF_ERROR) { + /* Full buffers? Maybe we need more output space.. */ + + if (state->outsize * 2 > state->outalloc) { + grow_outbuf(state, state->outalloc); + decompress_inbuf(state); + } + + return; + } + + /* Error */ + state->error = 1; +} + +/* We received some data */ +void mudcompress_receive(mc_state *state, const char *data, unsigned len) +{ + int i; + + if (state->error) + return; + + if (!state->stream) { + int residual = -1; + int clen; + + /* Just copy to outbuf. Also copy any residual inbuf */ + + grow_outbuf(state, len + state->insize); + memcpy(state->outbuf + state->outsize, data, len); + state->outsize += len; + memcpy(state->outbuf + state->outsize, state->inbuf, state->insize); + state->outsize += state->insize; + state->insize = 0; + + /* Check for Magic Marker. ugh this is messy */ + for (i=0; i < state->outsize; i++) { + if (state->outbuf[i] == IAC) { + if (i + 1 < state->outsize && state->outbuf[i+1] == IAC) { + /* IAC IAC - ignore */ + i++; + continue; + } + + clen = (i + strlen(will_v1) < state->outsize) ? strlen(will_v1) : state->outsize - i; + + if (!memcmp(&state->outbuf[i], will_v1, clen)) { + if (clen != strlen(will_v1)) { + /* Partial match. Save it. */ + residual = i; + break; + } + + /* If we got WILL COMPRESS2 then refuse COMPRESS, otherwise + * accept it + */ + + if (state->got_v2) + state->resp_v1 = -1; + else + state->resp_v1 = 1; + + memmove(&state->outbuf[i], + &state->outbuf[i + strlen(will_v1)], + state->outsize - strlen(will_v1)); + state->outsize -= strlen(will_v1); + i--; + continue; + } + + if (!memcmp(&state->outbuf[i], will_v2, clen)) { + if (clen != strlen(will_v2)) { + /* Partial match. Save it. */ + residual = i; + break; + } + + state->resp_v2 = 1; + state->got_v2 = 1; + + memmove(&state->outbuf[i], + &state->outbuf[i + strlen(will_v2)], + state->outsize - strlen(will_v2)); + state->outsize -= strlen(will_v2); + i--; + continue; + } + + clen = (i + strlen(on_v1) < state->outsize) ? strlen(on_v1) : state->outsize - i; + + if ((!memcmp(&state->outbuf[i], on_v1, clen) && !state->got_v2) || + (!memcmp(&state->outbuf[i], on_v2, clen) && state->got_v2)) { + if (clen != strlen(on_v1)) { + /* Partial match. Save it. */ + residual = i; + break; + } + + /* Switch to compression */ + /* copy any compressible bits to our inbuf */ + + grow_inbuf(state, state->outsize - i - strlen(on_v1)); + + memcpy(state->inbuf, + state->outbuf + i + strlen(on_v1), + state->outsize - i - strlen(on_v1)); + + state->insize = state->outsize - i - strlen(on_v1); + + /* clean up our output buffer */ + state->outsize = i; + + /* init stream */ + state->stream = malloc(sizeof(z_stream)); + state->stream->zalloc = zlib_alloc; + state->stream->zfree = zlib_free; + state->stream->opaque = NULL; + + if (inflateInit(state->stream) != Z_OK) { + state->error = 1; + free(state->stream); + state->stream = NULL; + return; + } + + /* Continue with decompression */ + break; + } + } + } + + if (!state->stream) { /* didn't start decompressing? */ + /* We might have some residual, copy to inbuf for later checking */ + + if (residual != -1) { + grow_inbuf(state, state->outsize - residual); + memcpy(state->inbuf + state->insize, state->outbuf + residual, state->outsize - residual); + state->outsize = residual; + } + + return; + } + } else { + /* New data to decompress. Copy to inbuf */ + grow_inbuf(state, len); + memcpy(state->inbuf + state->insize, data, len); + state->insize += len; + } + + decompress_inbuf(state); +} + +/* How much data is available? */ +int mudcompress_pending(mc_state *state) +{ + return state->error ? 0 : state->outsize; +} + +/* Was there an error? */ +int mudcompress_error(mc_state *state) +{ + return state->error; +} + +/* Get some data */ +int mudcompress_get(mc_state *state, char *buf, int size) +{ + int copied; + + if (state->error || !state->outsize) + return 0; + + if (size > state->outsize) + copied = state->outsize; + else + copied = size; + + memcpy(buf, state->outbuf, copied); + state->outsize -= copied; + if (state->outsize) + memmove(state->outbuf, state->outbuf + copied, state->outsize); + + /* Do some more decompression */ + decompress_inbuf(state); + + return copied; +} + +void mudcompress_stats(mc_state *state, unsigned long *comp, unsigned long *uncomp) +{ + *comp = state->comp; + *uncomp = state->uncomp; +} + +const char *mudcompress_response(mc_state *state) +{ + if (state->resp_v1 == 1) { + state->resp_v1 = 0; + return do_v1; + } + + if (state->resp_v1 == -1) { + state->resp_v1 = 0; + return dont_v1; + } + + if (state->resp_v2) { + state->resp_v2 = 0; + return do_v2; + } + + return NULL; +} + +int mudcompress_compressing(mc_state *state) +{ + return (state->stream != NULL); +} + +int mudcompress_v2(mc_state *state) +{ + return (state->stream != NULL && state->got_v2); +} + +#endif /* MUDCOMPRESS */ --- tf-4.0s1.orig/src/mccp.h +++ tf-4.0s1/src/mccp.h @@ -0,0 +1,141 @@ +/* + * Client decompression module for the mud client compression protocol. + * See http://homepages.ihug.co.nz/~icecube/compress/ for more details. + * + * mccpDecompress.h - header definitions. #include this in your client code. + * + * Oliver Jowett . Demangle address as needed. + * + * This code is placed in the public domain. + * + */ + +/* Modified: 981203 */ + +/* + * + * mc_state is an opaque type representing the current compression state of + * a connection. You should include a (mc_state *) in the information you + * store for a server connection. + * + * Initialization / cleanup: + * + * When a connection is initiated, call mudcompress_new, and store the + * resulting pointer in your server connection information. This pointer is + * used as a handle for all other functions. This does NOT begin compression + * - it just initialises various internal structures. + * + * When a connection is terminated, call mudcompress_delete with the handle + * to delete all memory allocated by the decompressor for the connection. + * + * Reading / writing: + * + * Reading from the server connection must go through the decompressor at + * all times. The decompressor handles both negotiation and decompression + * transparently - it receives input directly from the server, then provides + * the main client code with decompressed data, hiding all protocol details. + * + * When data is received from the mud server, call mudcompress_receive, + * passing it the handle for the connection, a pointer to the data read, + * and the length of data read. It is VITAL that ALL data read is passed + * to the decompressor - including data with embedded NULs! + * + * After mudcompress_receive has been called, call mudcompress_pending() to + * see if any decompressed data is available. It returns the number of + * bytes pending. + * + * If there is pending data waiting, call mudcompress_get to retrieve it. + * This fills up to "size" bytes in the provided buffer "buf", and returns + * the number of bytes copied. Your client can now process this data as if + * it had been directly read from the server. + * + * Be sure to check mudcompress_pending again after calling mudcompress_get! + * Removing some data from the decompress buffer may have allowed the + * decompressor to decompress some more data - in which case, you want to + * process it immediately, rather than waiting for another read from the + * mud server. + * + * Regularly call mudcompress_response. If non-NULL, you need to write the + * returned string to the mud server. This is needed when the decompressor + * is negotiating compression with the server. When called, + * mudcompress_response clears any pending string, so be sure to save its + * return value! + * + * Status information: + * + * mudcompress_error returns non-0 if there has been a (fatal) decompression + * error. In this case, all you can do is tell the user that something went + * wrong and close the connection. + * + * mudcompress_stats fills in the two (unsigned long *) values passed, with + * the number of compressed bytes read, and the number of bytes that they + * decompressed to. + * + * mudcompress_compressing returns non-0 if the connection is currently + * using compression. + * + */ + +#ifndef MUDCOMPRESS_H +#define MUDCOMPRESS_H + +#ifdef __cplusplus +extern "C" { +#endif + + /* Opaque handle for a decompressor. Details defined in Compress.c - you + * should never need to see them externally. + */ + struct mc_state_s; + typedef struct mc_state_s mc_state; + + /* Create a new decompressor. Return a handle to it. + */ + mc_state *mudcompress_new(void); + + /* Deallocate a decompressor and associated data. 'state' is invalid + * afterthis call. + */ + void mudcompress_delete(mc_state *state); + + /* Perform decompression and negotiation on some received data. + * 'data' is a pointer to the received data, 'len' is its length. + */ + void mudcompress_receive(mc_state *state, const char *data, unsigned len); + + /* Return the number of pending decompressed bytes that can currently + * be read by mudcompress_get + */ + int mudcompress_pending(mc_state *state); + + /* Return true (non-0) if this decompressor encountered a fatal error. + */ + int mudcompress_error(mc_state *state); + + /* Read decompressed data from the decompressor into 'buf', up to a + * maximum of 'size' bytes. Returns the number of bytes actually copied. + */ + int mudcompress_get(mc_state *state, char *buf, int size); + + /* Set *comp to the number of compressed bytes read, and *uncomp to the + * number of bytes they expanded to, for this decompressor. + */ + void mudcompress_stats(mc_state *state, unsigned long *comp, unsigned long *uncomp); + + /* Check for a negotiation response. If this returns NULL, no output is + * needed. If it returns non-NULL, it points to a NUL-terminated string + * that should be sent to the mud server. Calling this function clears + * the pending string (so be sure to save the result). + */ + const char *mudcompress_response(mc_state *state); + + /* Return true (non-0) if this decompressor has successfully negotiated + * compression and is currently performing decompression. + */ + int mudcompress_compressing(mc_state *state); + +#ifdef __cplusplus +} +#endif + +#endif --- tf-4.0s1.orig/tf-lib/spell.tf +++ tf-4.0s1/tf-lib/spell.tf @@ -7,7 +7,7 @@ /def -i spell_line = \ /setenv ARGS=$(/recall -i 1)%; \ - /let _errs=$(/quote -S -decho !echo $$ARGS | spell)%; \ + /let _errs=$(/quote -S -decho !echo $$ARGS | ispell -l)%; \ /if ( _errs !~ "" ) \ /echo MISSPELLINGS: %_errs%; \ /else \ --- tf-4.0s1.orig/unix/Config +++ tf-4.0s1/unix/Config @@ -33,8 +33,8 @@ # even if an old version is currently in use. You can remove # the old version manually later when it is no longer in use. -# TF="/usr/local/bin/tf-${TFVER}" -# LIBDIR="/usr/local/lib/tf-${TFVER}-lib" +TF="/usr/games/tf" +LIBDIR="/usr/share/games/tf" # SYMLINK="/usr/local/bin/tf" @@ -44,8 +44,8 @@ # uses nroff format; set MANTYPE=cat if your man uses pre-formatted # vt100 "catman" pages. Default is "cat". -# MANTYPE="nroff" -# MANPAGE="/usr/local/man/man1/tf.1" +MANTYPE="nroff" +MANPAGE="/usr/man/man6/tf.6" ### Flags. @@ -110,7 +110,7 @@ # by removing the leading "#". # CC=cc -# CCFLAGS="-g" +CCFLAGS="-O2 -g -Wall" ### Stripping. --- tf-4.0s1.orig/unix/tfconfig +++ tf-4.0s1/unix/tfconfig @@ -168,18 +168,18 @@ # The cd;pwd is needed to normalize the directory name in case of links, etc. DIR1=`echo $TF | sed 's;/[^/]*$;;'` -DIR1=`cd $DIR1 && pwd` +#DIR1=`cd $DIR1 && pwd` DIR2=`echo $LIBDIR | sed 's;/[^/]*$;;'` -DIR2=`cd $DIR2 && pwd` +#DIR2=`cd $DIR2 && pwd` DIR3=`echo $SYMLINK | sed 's;/[^/]*$;;'` -DIR3=`cd $DIR3 && pwd` +#DIR3=`cd $DIR3 && pwd` -if [ -z "$DIR1" ] || [ -z "$DIR2" ] || [ -z "$DIR3" ]; then +if [ -z "$DIR1" ] || [ -z "$DIR2" ]; then echo "Error in directory." exit 1; fi -DIR1=`cd $DIR1 && pwd || { echo "Error in directory $DIR1."; false; }` +#DIR1=`cd $DIR1 && pwd || { echo "Error in directory $DIR1."; false; }` BUILDTREE=`cd .. && pwd` if echo "${DIR1}/" | egrep "^${BUILDTREE}/" >/dev/null 2>&1 || @@ -482,6 +482,14 @@ echo "I can't find . Filename '~user' expansion won't be supported." fi +### Find zlib.h +if echo '#include ' >test.c; ${CPP} test.c >/dev/null 2>&1; then + echo "#define MUDCOMPRESS" >&4 + echo "Found ." +else + echo "I can't find . The Mud Client Compression Protocol will not be supported." +fi + ### Figure out how to do varadic args. if [ "$STD_C" = "1" ] || [ "$GNU_C" = "1" ]; then if echo '#include ' >test.c; ${CPP} test.c >/dev/null 2>&1; then @@ -758,6 +766,12 @@ echo "/* warning: tfconfig couldn't find connect() */" >&4 fi +### Test for zlib for mud compression +if eval "${LIBTEST} -lz ${LIBS} >/dev/null 2>&1" && test -f ${AOUT}; then + echo "Will link with -lz." + LIBS="-lz $LIBS" +fi + ### Test for SOCKS firewall proxy server. if [ -n "$SOCKS" ]; then # SOCKS uses res_init(), so we need -lresolv if there is one. --- tf-4.0s1.orig/debian/changelog +++ tf-4.0s1/debian/changelog @@ -0,0 +1,216 @@ +tf (1:4.0s1-17) unstable; urgency=low + + * Acknowledge NMU, thank you Andreas! (Closes: Bug#300360) + * Remove /usr/doc/tf if old tf package left it around (Closes: Bug#320103) + * Moved menu file to /usr/share/menu + + -- Jan Niehusmann Fri, 26 Aug 2005 19:52:58 +0200 + +tf (1:4.0s1-16.1) unstable; urgency=low + + * NMU durring BSP + * Fix for gcc 4.0 from Andreas Jochens (Closes: #300360) + + -- Blars Blarson Sat, 6 Aug 2005 05:08:37 +0000 + +tf (1:4.0s1-16) unstable; urgency=low + + * Move tf manpage to section 1, as tf is now linked to /usr/bin/tf, + and tf 5 won't be in /usr/games at all. + + -- Jan Niehusmann Sun, 9 Jan 2005 02:43:27 +0100 + +tf (1:4.0s1-15) unstable; urgency=low + + * Support alternatives for tf (in /usr/bin/tf) (Closes: Bug#288632) + + -- Jan Niehusmann Fri, 7 Jan 2005 14:36:18 +0100 + +tf (1:4.0s1-14) unstable; urgency=low + + * Fixed segfault if MAIL is not set. (Closes: Bug#169015) + + -- Jan Niehusmann Thu, 12 Aug 2004 08:32:34 +0200 + +tf (1:4.0s1-13) unstable; urgency=low + + * New maintainer + * Add support for Mud Client Compression Protocol (patch from + http://inphobia.net/openbsd/patches/tinyfugue-openbsd-mccp-patch.gz) + (Closes: Bug#169970, Bug#176250) + * Fix lintian warning about manpage-section-missmatch + * Don't create /usr/doc link in postinst + * Set Standards-Version to 3.6.1.0 + + -- Jan Niehusmann Thu, 12 Aug 2004 02:01:44 +0200 + +tf (1:4.0s1-12) unstable; urgency=high + + * Removed buggy SSL patch. (Closes: Bug#147146) + + -- Brian Mays Thu, 16 May 2002 05:39:30 -0400 + +tf (1:4.0s1-11) unstable; urgency=low + + * Applied SSL patch from http://zozo.org.uk/pages.shtml?page=tinyfugue. + (Closes: Bug#145453) + + -- Brian Mays Tue, 14 May 2002 13:57:49 -0400 + +tf (1:4.0s1-10) unstable; urgency=medium + + * Modified postinst to ignore an existing /usr/doc/$package directory. + + -- Brian Mays Wed, 20 Mar 2002 11:24:06 -0500 + +tf (1:4.0s1-9) unstable; urgency=low + + * Fixed symlink /usr/doc -> ../share/doc. + * Fixed reference to GPL. + * Improved stripping of binaries. + * Removed icon=none from menu file. + * Fixed file permissions. + + -- Brian Mays Sun, 3 Feb 2002 13:02:24 -0500 + +tf (1:4.0s1-8) unstable; urgency=low + + * Recompiled to fix library problems. (Closes: Bug#119472) + + -- Brian Mays Tue, 13 Nov 2001 15:00:42 -0500 + +tf (1:4.0s1-7) unstable; urgency=low + + * Rebuilt with libncurses5. (Closes: Bug#74501) + + -- Brian Mays Tue, 24 Oct 2000 12:28:54 -0400 + +tf (1:4.0s1-6) frozen unstable; urgency=low + + * Added build-time dependencies. + + -- Brian Mays Mon, 17 Jan 2000 14:03:59 -0500 + +tf (1:4.0s1-5) unstable; urgency=low + + * Fixed FHS /usr/doc -> /usr/share/doc transition scheme. + + -- Brian Mays Fri, 1 Oct 1999 14:28:05 -0400 + +tf (1:4.0s1-4) unstable; urgency=low + + * Modified tf to know the new FHS file locations. (Closes: Bug#45400) + + -- Brian Mays Sat, 18 Sep 1999 10:59:55 -0400 + +tf (1:4.0s1-3) unstable; urgency=low + + * Changed file locations (in /usr/man and /usr/doc) to comply with + the FHS. (Closes: Bug#44945) + + -- Brian Mays Thu, 16 Sep 1999 20:25:36 -0400 + +tf (1:4.0s1-2) unstable; urgency=low + + * Rebuilt with correct libraries. (Closes: Bug#37827) + + -- Brian Mays Tue, 18 May 1999 19:27:37 -0400 + +tf (1:4.0s1-1) unstable; urgency=low + + * New upstream version. + + -- Brian Mays Sun, 21 Mar 1999 20:47:04 -0500 + +tf (1:4.0g3-1) unstable; urgency=low + + * New upstream version. + + -- Brian Mays Fri, 5 Feb 1999 13:12:16 -0500 + +tf (1:4.0g2-1) frozen unstable; urgency=low + + * Worlds without type or mfile now use corresponding field of + "default" world. + * Improved prompt detection heuristics for typeless worlds. + * /addworld can reset fields other than host and port for "(unnamedN)" + worlds. + * Clarified scope rules in "/help /for". + * Fixed fatal error when reconnecting in a DISCONNECT hook. + + -- Brian Mays Fri, 20 Nov 1998 15:10:00 -0500 + +tf (1:4.0g1-1) frozen unstable; urgency=low + + * New upstream source. + + -- Brian Mays Wed, 11 Nov 1998 08:55:22 -0500 + +tf (1:4.0b3-2) unstable; urgency=low + + * Rebuilt to account for name change in package libncurses4. + + -- Brian Mays Sun, 1 Nov 1998 14:15:22 -0500 + +tf (1:4.0b3-1) unstable; urgency=low + + * New upstream version. + + -- Brian Mays Fri, 16 Oct 1998 11:36:25 -0400 + +tf (1:4.0b2-1) unstable; urgency=low + + * New upstream version. + + -- Brian Mays Fri, 14 Aug 1998 10:48:21 -0400 + +tf (1:3.5b4-4) unstable; urgency=low + + * Removed old FSF address from copyright file. + + -- Brian Mays Thu, 12 Feb 1998 17:56:05 -0500 + +tf (1:3.5b4-3) unstable; urgency=low + + * Libc6 release. + * fixed spell bug (Bug#10431). + + -- Brian Mays Tue, 5 Aug 1997 18:30:35 -0400 + +tf (1:3.5b4-2) unstable; urgency=low + + * Fixed Debian menu support. + + -- Brian Mays Wed, 28 May 1997 16:57:18 -0400 + +tf (1:3.5b4-1) unstable; urgency=low + + * New upstream source. + * Added Debian menu support. + + -- Brian Mays Sat, 19 Apr 1997 18:59:02 -0400 + +tf (1:3.5b1-2) unstable; urgency=low + + * Added assert-working-epoch to preinst. (see Bug#7448) + * Removed some "foolproofing" from the unix/tfconfig script intended to + check the existance of directories and normalize the directory name in + case of links, etc. (fixes Bug#7450) + + -- Brian Mays Mon, 17 Feb 1997 23:17:26 -0500 + +tf (1:3.5b1-1) unstable; urgency=low + + * New upstream version. + * Added epoch number. + * Renamed /usr/doc/tf/CHANGES to changelog. + + -- Brian Mays Tue, 28 Jan 1997 11:34:00 -0500 + +tf (3.5a20-1) unstable; urgency=low + + * New upstream version + * New maintainer + * New source format (2.1.1.0) + + -- Brian Mays Fri, 27 Sep 1996 08:09:52 -0400 --- tf-4.0s1.orig/debian/postinst +++ tf-4.0s1/debian/postinst @@ -0,0 +1,12 @@ +#!/bin/sh -e + +if [ "$1" = configure ]; then + if test -x /usr/bin/update-menus; then update-menus; fi + + update-alternatives --install /usr/bin/tf tf /usr/games/tf 50 --slave /usr/share/man/man1/tf.1.gz tf.1.gz /usr/share/man/man1/tf4.1.gz +fi + +if ( [ "$1" = configure ] || [ "$1" = upgrade ] ) && [ -L /usr/doc/tf ] && \ + dpkg --compare-versions "$2" le "1:4.0s1-16.1"; then + rm -f /usr/doc/tf +fi --- tf-4.0s1.orig/debian/control +++ tf-4.0s1/debian/control @@ -0,0 +1,19 @@ +Source: tf +Section: games +Priority: optional +Maintainer: Jan Niehusmann +Build-Depends: libncurses-dev, zlib1g-dev +Standards-Version: 3.6.1.0 + +Package: tf +Architecture: any +Depends: ${shlibs:Depends} +Description: Tinyfugue MUD client for TinyMUDs, DikuMUDs, and LPMUDs + TinyFugue (also known as "Fugue" or "TF") is a line-based client + designed for connecting to MUD servers (note: LP, Diku, and other + servers which use prompts require "/lp on"; see /help prompts). + . + TinyFugue is larger than most MUD clients, but has many more features + and is much more flexible. The goal is to provide the most + functionality in a client that still maintains the user-friendliness + of Tinytalk. --- tf-4.0s1.orig/debian/rules +++ tf-4.0s1/debian/rules @@ -0,0 +1,80 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# debian/rules file - for tf +# Copyright 1996-2002 by Brian Mays +# Patterned after the hello package by Ian Jackson. + +package=tf + +build: + $(checkdir) + echo y | ./unixmake files + touch build + +clean: + $(checkdir) + $(RM) build + ./unixmake distclean + $(RM) -r *~ */*~ debian/tmp debian/files* debian/subst* + +binary-indep: checkroot build + $(checkdir) + +binary-arch: checkroot build + $(chechdir) + $(RM) -r debian/tmp + install -d debian/tmp debian/tmp/DEBIAN + install -d debian/tmp/usr/share/doc/$(package) + install -d debian/tmp/usr/share/doc/$(package)/examples +# Install Debian package control information files + install debian/preinst debian/postinst debian/postrm \ + debian/prerm debian/tmp/DEBIAN/. +# Install directories + install -d debian/tmp/usr/games \ + debian/tmp/usr/share/games \ + debian/tmp/usr/share/man/man1 \ + debian/tmp/usr/share/menu +# Install files + cd src && $(MAKE) install \ + TF=$(shell pwd)/debian/tmp/usr/games/tf \ + LIBDIR=$(shell pwd)/debian/tmp/usr/share/games/tf \ + MANPAGE=$(shell pwd)/debian/tmp/usr/share/man/man1/tf4.1 + chmod 644 debian/tmp/usr/share/games/tf/* + strip -R.note -R.comment debian/tmp/usr/games/tf +# Install documentation + mv debian/tmp/usr/share/games/tf/CHANGES \ + debian/tmp/usr/share/doc/$(package)/changelog + mv debian/tmp/usr/share/games/tf/tfrc \ + debian/tmp/usr/share/doc/$(package)/examples/. + install -m644 README debian/tmp/usr/share/doc/$(package)/. +# Install changelog & copyright + install -m644 debian/menu debian/tmp/usr/share/menu/$(package) + install -m644 debian/changelog \ + debian/tmp/usr/share/doc/$(package)/changelog.Debian + gzip -9vr debian/tmp/usr/share/doc/$(package)/* + gzip -9v debian/tmp/usr/share/man/*/* + install -m644 debian/copyright debian/tmp/usr/share/doc/$(package)/. +# Determine shared library dependencies + dpkg-shlibdeps src/tf +# Genereate deb file + dpkg-gencontrol -isp + chown -R root.root debian/tmp + chmod -R g-ws debian/tmp + dpkg-deb --build debian/tmp .. + +define checkdir + test -f src/$(package).h -a -f debian/rules +endef + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: binary binary-arch binary-indep clean checkroot --- tf-4.0s1.orig/debian/copyright +++ tf-4.0s1/debian/copyright @@ -0,0 +1,58 @@ +This is the Debian GNU/Linux prepackaged version of Tinyfugue -- a MUD +client. This version of TinyFugue was written by Ken Keys +. + +This package was put together by Andrew Howell , +from sources obtained from: + ftp://ftp.tcp.com/pub/mud/Clients/tinyfugue/ + +This package has been modified by Brian Mays . +Modifications of tf package for Debian GNU/Linux Copyright (C) 1996-2002 +Brian Mays and are released under the GPL (on Debian systems see +"/usr/share/common-licenses/GPL"). + +Changes: + * added Debian GNU/Linux package maintenance system files + * changed destination directories to /usr/games and /usr/lib/games/tf + * removed some "foolproofing" from the unix/tfconfig script intended + to check the existance of directories and normalize the directory + name in case of links, etc. + +tf is Copyright (C) 1993, 1994, 1995 Ken Keys. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in "/usr/share/common-licenses/GPL". + +The regexp package used by tf is Copyright (c) 1986 by University of +Toronto. + + This is an altered version. Changes include: + + 1. Minor changes in regexp.h for cleaner integration into TinyFugue, + which should have no effect on the package's portability. + + 2. The original Makefile has been renamed original.mak; the + new Makefile contains only enough to compile regexp.o for use with + TinyFugue. + + Permission is granted to anyone to use this software for any purpose + on any computer system, and to redistribute it freely, subject to the + following restrictions: + + 1. The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from defects in it. + + 2. The origin of this software must not be misrepresented, either by + explicit claim or by omission. + + 3. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. --- tf-4.0s1.orig/debian/menu +++ tf-4.0s1/debian/menu @@ -0,0 +1,2 @@ +?package(tf):needs="text" section="Games/Adventure" \ + title="TinyFugue" command="/usr/games/tf" --- tf-4.0s1.orig/debian/prerm +++ tf-4.0s1/debian/prerm @@ -0,0 +1,8 @@ +#!/bin/sh -e + +if [ "$1" = remove ]; then + pkg=tf + if [ -L /usr/doc/$pkg ]; then rm -f /usr/doc/$pkg; fi + + update-alternatives --remove tf /usr/games/tf +fi --- tf-4.0s1.orig/debian/postrm +++ tf-4.0s1/debian/postrm @@ -0,0 +1,5 @@ +#!/bin/sh -e + +if [ "$1" = remove ]; then + if test -x /usr/bin/update-menus; then update-menus; fi +fi --- tf-4.0s1.orig/debian/preinst +++ tf-4.0s1/debian/preinst @@ -0,0 +1,3 @@ +#! /bin/sh -e + +dpkg --assert-working-epoch