tf5-5.0beta8/.git/
tf5-5.0beta8/.git/info/
tf5-5.0beta8/.git/logs/
tf5-5.0beta8/.git/logs/refs/heads/
tf5-5.0beta8/.git/objects/00/
tf5-5.0beta8/.git/objects/01/
tf5-5.0beta8/.git/objects/04/
tf5-5.0beta8/.git/objects/05/
tf5-5.0beta8/.git/objects/07/
tf5-5.0beta8/.git/objects/09/
tf5-5.0beta8/.git/objects/0a/
tf5-5.0beta8/.git/objects/0c/
tf5-5.0beta8/.git/objects/0e/
tf5-5.0beta8/.git/objects/12/
tf5-5.0beta8/.git/objects/13/
tf5-5.0beta8/.git/objects/14/
tf5-5.0beta8/.git/objects/16/
tf5-5.0beta8/.git/objects/17/
tf5-5.0beta8/.git/objects/19/
tf5-5.0beta8/.git/objects/1c/
tf5-5.0beta8/.git/objects/1d/
tf5-5.0beta8/.git/objects/1e/
tf5-5.0beta8/.git/objects/1f/
tf5-5.0beta8/.git/objects/20/
tf5-5.0beta8/.git/objects/21/
tf5-5.0beta8/.git/objects/23/
tf5-5.0beta8/.git/objects/27/
tf5-5.0beta8/.git/objects/29/
tf5-5.0beta8/.git/objects/2a/
tf5-5.0beta8/.git/objects/2b/
tf5-5.0beta8/.git/objects/2f/
tf5-5.0beta8/.git/objects/30/
tf5-5.0beta8/.git/objects/33/
tf5-5.0beta8/.git/objects/34/
tf5-5.0beta8/.git/objects/35/
tf5-5.0beta8/.git/objects/39/
tf5-5.0beta8/.git/objects/3c/
tf5-5.0beta8/.git/objects/3d/
tf5-5.0beta8/.git/objects/3f/
tf5-5.0beta8/.git/objects/40/
tf5-5.0beta8/.git/objects/41/
tf5-5.0beta8/.git/objects/42/
tf5-5.0beta8/.git/objects/44/
tf5-5.0beta8/.git/objects/46/
tf5-5.0beta8/.git/objects/47/
tf5-5.0beta8/.git/objects/48/
tf5-5.0beta8/.git/objects/4a/
tf5-5.0beta8/.git/objects/4d/
tf5-5.0beta8/.git/objects/4f/
tf5-5.0beta8/.git/objects/53/
tf5-5.0beta8/.git/objects/54/
tf5-5.0beta8/.git/objects/58/
tf5-5.0beta8/.git/objects/5b/
tf5-5.0beta8/.git/objects/5c/
tf5-5.0beta8/.git/objects/5e/
tf5-5.0beta8/.git/objects/5f/
tf5-5.0beta8/.git/objects/60/
tf5-5.0beta8/.git/objects/61/
tf5-5.0beta8/.git/objects/62/
tf5-5.0beta8/.git/objects/63/
tf5-5.0beta8/.git/objects/66/
tf5-5.0beta8/.git/objects/67/
tf5-5.0beta8/.git/objects/6c/
tf5-5.0beta8/.git/objects/6e/
tf5-5.0beta8/.git/objects/72/
tf5-5.0beta8/.git/objects/73/
tf5-5.0beta8/.git/objects/75/
tf5-5.0beta8/.git/objects/77/
tf5-5.0beta8/.git/objects/7a/
tf5-5.0beta8/.git/objects/7b/
tf5-5.0beta8/.git/objects/7c/
tf5-5.0beta8/.git/objects/7e/
tf5-5.0beta8/.git/objects/7f/
tf5-5.0beta8/.git/objects/81/
tf5-5.0beta8/.git/objects/84/
tf5-5.0beta8/.git/objects/86/
tf5-5.0beta8/.git/objects/87/
tf5-5.0beta8/.git/objects/88/
tf5-5.0beta8/.git/objects/8b/
tf5-5.0beta8/.git/objects/8c/
tf5-5.0beta8/.git/objects/8f/
tf5-5.0beta8/.git/objects/91/
tf5-5.0beta8/.git/objects/93/
tf5-5.0beta8/.git/objects/96/
tf5-5.0beta8/.git/objects/97/
tf5-5.0beta8/.git/objects/99/
tf5-5.0beta8/.git/objects/9a/
tf5-5.0beta8/.git/objects/9b/
tf5-5.0beta8/.git/objects/9c/
tf5-5.0beta8/.git/objects/9d/
tf5-5.0beta8/.git/objects/9e/
tf5-5.0beta8/.git/objects/a1/
tf5-5.0beta8/.git/objects/a3/
tf5-5.0beta8/.git/objects/a4/
tf5-5.0beta8/.git/objects/a6/
tf5-5.0beta8/.git/objects/a7/
tf5-5.0beta8/.git/objects/a8/
tf5-5.0beta8/.git/objects/a9/
tf5-5.0beta8/.git/objects/ab/
tf5-5.0beta8/.git/objects/ac/
tf5-5.0beta8/.git/objects/ae/
tf5-5.0beta8/.git/objects/b1/
tf5-5.0beta8/.git/objects/b2/
tf5-5.0beta8/.git/objects/b3/
tf5-5.0beta8/.git/objects/b7/
tf5-5.0beta8/.git/objects/b9/
tf5-5.0beta8/.git/objects/bb/
tf5-5.0beta8/.git/objects/bc/
tf5-5.0beta8/.git/objects/bd/
tf5-5.0beta8/.git/objects/bf/
tf5-5.0beta8/.git/objects/c0/
tf5-5.0beta8/.git/objects/c1/
tf5-5.0beta8/.git/objects/c2/
tf5-5.0beta8/.git/objects/c3/
tf5-5.0beta8/.git/objects/c5/
tf5-5.0beta8/.git/objects/c7/
tf5-5.0beta8/.git/objects/ca/
tf5-5.0beta8/.git/objects/ce/
tf5-5.0beta8/.git/objects/d1/
tf5-5.0beta8/.git/objects/d3/
tf5-5.0beta8/.git/objects/d4/
tf5-5.0beta8/.git/objects/d5/
tf5-5.0beta8/.git/objects/d8/
tf5-5.0beta8/.git/objects/d9/
tf5-5.0beta8/.git/objects/dc/
tf5-5.0beta8/.git/objects/dd/
tf5-5.0beta8/.git/objects/e1/
tf5-5.0beta8/.git/objects/e4/
tf5-5.0beta8/.git/objects/e5/
tf5-5.0beta8/.git/objects/e6/
tf5-5.0beta8/.git/objects/e7/
tf5-5.0beta8/.git/objects/e8/
tf5-5.0beta8/.git/objects/ea/
tf5-5.0beta8/.git/objects/eb/
tf5-5.0beta8/.git/objects/ed/
tf5-5.0beta8/.git/objects/ee/
tf5-5.0beta8/.git/objects/ef/
tf5-5.0beta8/.git/objects/f0/
tf5-5.0beta8/.git/objects/f4/
tf5-5.0beta8/.git/objects/f5/
tf5-5.0beta8/.git/objects/f6/
tf5-5.0beta8/.git/objects/f8/
tf5-5.0beta8/.git/objects/f9/
tf5-5.0beta8/.git/objects/fa/
tf5-5.0beta8/.git/objects/fb/
tf5-5.0beta8/.git/objects/fc/
tf5-5.0beta8/.git/objects/fd/
tf5-5.0beta8/.git/refs/heads/
tf5-5.0beta8/.git/refs/tags/
tf5-5.0beta8/autom4te.cache/
tf5-5.0beta8/macos/
tf5-5.0beta8/unix/
tf5-5.0beta8/win32/
/*************************************************************************
 *  TinyFugue - programmable mud client
 *  Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys
 *
 *  TinyFugue (aka "tf") is protected under the terms of the GNU
 *  General Public License.  See the file "COPYING" for details.
 ************************************************************************/
/* $Id: tfio.h,v 35004.66 2007/01/13 23:12:39 kkeys Exp $ */

#ifndef TFIO_H
#define TFIO_H

#ifdef _POSIX_VERSION
# include <sys/types.h>
# define MODE_T mode_t
#else
# define MODE_T unsigned long
#endif

#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "pattern.h"
#ifndef S_IROTH
# define S_IWUSR 00200
# define S_IRUSR 00400
# define S_IRGRP 00040
# define S_IROTH 00004
#endif

/* TFILE types */
typedef enum { TF_NULL, TF_QUEUE, TF_FILE, TF_PIPE } TFILE_type_t;

/* Sprintf flags */
#define SP_APPEND   1	/* don't truncate first, just append */
#define SP_CHECK    2	/* make sure char* args won't SIGSEGV or SIGBUS */

typedef struct PhysLine {
    conString *str;
    int start;
    short len;
    short indent;
    char visible; /* line passed screen_filter() */
    char tmp;     /* should only be displayed once */
} PhysLine;

typedef struct Queue {
    List list;
} Queue;

struct Screen {
    int outcount;		/* lines remaining until pause */
    struct List pline;		/* already displayed physical lines */
/* pline invariant: if one pline corresponding to an lline is in the list,
 * all plines corresponding to that lline are in the list. */
    int npline;			/* number of physical lines in pline */
    int nlline;			/* number of logical lines in pline */
    int maxlline;		/* max number of logical lines in pline */
    int nback;			/* number of lines scrolled back */
    int nnew;			/* number of new lines */
    int nback_filtered;		/* number of filtered lines scrolled back */
    int nnew_filtered;		/* number of filtered new lines */
    ListEntry *top, *bot;	/* top and bottom of view in plines */
    ListEntry *maxbot;		/* last line in plines that bot has reached */
    int viewsize;		/* # of plines between top and bot, inclusive */
    int scr_wrapflag;		/* wrapflag used to wrap plines */
    int scr_wrapsize;		/* wrapsize used to wrap plines */
    int scr_wrapspace;		/* wrapspace used to wrap plines */
    int scr_wrappunct;		/* wrappunct used to wrap plines */
    Pattern filter_pat;		/* filter pattern */
    char filter_enabled;	/* is filter enabled? */
    char filter_sense;		/* 0 = negative, 1 = positive */
    char filter_attr;		/* filter by attributes? */
    char selflush;		/* selective flushing flag */
    char needs_refilter;	/* top and bot need to be recalculated */
    char partialview;		/* do not expand viewsize to fit terminal */
    char paused;		/* paused at a More prompt? */
    char active;		/* has new lines without the A attribute? */
};

/* TF's analogue of stdio's FILE */
typedef struct TFILE {
    int id;
    struct ListEntry *node;
    TFILE_type_t type;
    char *name;
    union {
        Queue *queue;
        FILE *fp;
    } u;
    char buf[1024];
    int off, len;
    MODE_T mode;
    char tfmode;
    short warned;
    short autoflush;
} TFILE;


#ifndef HAVE_DRIVES
# define is_absolute_path(path) \
            ((path)[0] == '/' || (path)[0] == '~')
#else
# define is_absolute_path(path) \
            ((path)[0] == '/' || (path)[0] == '~' || \
            (is_alpha((path)[0]) && (path)[1] == ':'))
#endif


extern TFILE *loadfile;    /* currently /load'ing file */
extern int    loadline;    /* line number of /load'ing file */
extern int    loadstart;   /* line number of command start in /load'ing file */
extern TFILE *tfin;        /* tf input queue */
extern TFILE *tfout;       /* tf output queue */
extern TFILE *tferr;       /* tf error queue */
extern TFILE *tfalert;     /* tf alert file */
extern TFILE *tfkeyboard;  /* keyboard, where tfin usually points */
extern TFILE *tfscreen;    /* screen, where tfout & tferr usually point */
extern Screen*fg_screen;   /* current screen to which tf writes */
extern Screen*default_screen; /* default screen (unconnected or !virtscreen) */
extern int    read_depth;  /* depth of user kb reads */
extern int    readsafe;    /* safe to to a user kb read? */
extern PhysLine *plpool;   /* freelist of PhysLines */

#define operror(str)    eprintf("%s: %s", str, strerror(errno))
#define oputline(line)  tfputline(line, tfout)
#define tfputs(str, f)  tfnputs(str, -1, f)
#define oputs(str)      tfputs(str, tfout)
#define eputs(str)      tfputs(str, tferr)
#define tfputc(c, file) fputc((c), (file)->u.fp)
#define tfflush(file) \
    ((file->type==TF_FILE || file->type==TF_PIPE) ? fflush((file)->u.fp) : 0)

extern void   init_tfio(void);
extern Screen*new_screen(long size);
extern void   free_screen_lines(Screen *screen);
extern void   free_screen(Screen *screen);
extern char  *tfname(const char *name, const char *macname);
extern char  *expand_filename(const char *str);
extern TFILE *tfopen(const char *name, const char *mode);
extern int    tfclose(TFILE *file);
extern void   tfnputs(const char *str, int n, TFILE *file);
extern attr_t tfputansi(const char *str, TFILE *file, attr_t attrs);
extern int    tfputp(const char *str, TFILE *file);
extern void   tfputline(struct conString *line, TFILE *file);
extern void   vSprintf(struct String *buf, int flags,
                     const char *fmt, va_list ap);
extern void   Sprintf(struct String *buf, const char *fmt, ...)
		     format_printf(3, 4);
extern void   Sappendf(struct String *buf, const char *fmt, ...)
		     format_printf(2, 3);
extern void   oprintf(const char *fmt, ...) format_printf(1, 2);
extern void   tfprintf(TFILE *file, const char *fmt, ...)
                     format_printf(2, 3);
extern void   eprefix(String *buffer);
extern void   eprintf(const char *fmt, ...) format_printf(1, 2);
extern void   wprintf(const char *fmt, ...) format_printf(1, 2);
extern char   igetchar(void);
extern int    handle_tfopen_func(const char *name, const char *mode);
extern TFILE *find_tfile(const char *handle);
extern TFILE *find_usable_tfile(const char *handle, int mode);
extern int    tfreadable(TFILE *file);
extern struct String *tfgetS(struct String *str, TFILE *file);

extern void   hide_screen(Screen *screen);
extern void   unhide_screen(Screen *screen);
extern void   switch_screen(int quiet);

#endif /* TFIO_H */