/*
 * 4m v2.15 (globals.c)
 * (C) Copyright 1990 by Carrick Sean Casey
 * (C) Copyright 1993 by Scott Chasin and Michaeljon Miller
 *
 * 3-24-93 See file COPYING for copyright information.
 *
 * Global definitions
 */

#include "4m.h"
#include "../common/ipcf.h"
#include "ctcp.h"

#if defined(HAS_SYSLIMITS) || defined(HAS_LIMITS) 
#ifdef HAS_SYSLIMITS
#  include <sys/limits.h>
# endif
#if defined(HAS_LIMITS)
#  include <limits.h>
# endif
#else
#if defined (MACHBSD)
#else
#   include <values.h>
#   define  ULONG_MAX (long)MAXLONG
#endif
#endif

/* non-global definitions */
char packetbuffer[USER_BUF_SIZE]; /* packet buffer */
char messagebuffer[1024]; /* generic large buffer */
char messagebuffer2[256]; /* generic large buffer */
char inputbuffer[MAX_INPUTSTR - 1];

/* global defs */
char *inputbuf = inputbuffer;
char *pp = packetbuffer;  /* packet pointer */
char *pbuf = packetbuffer + 1;  /* packet buffer pointer */
char *mbuf = messagebuffer; /* message buffer */
char *mbuf2 = messagebuffer2; /* message buffer */
char *myloginid = 0;  /* login id of user */
char *topic = 0;
char continued = 0;
char msg_from[14];
char nick[MAX_NICKLEN + 1];
char *gecos;
char group[MAX_GROUPLEN + 1];
char mode[15];
char awaymsg[MAX_INPUTSTR - 20];
char msg_str[MAX_INPUTSTR + 1];
char mbox[128];
char config_file[128];

NAMLIST *cmdalias, *notify, *execute, *cmd_history, *history;

int beeping = 0;  /* 1 if beeping turned on */
int away = FALSE;
int echoback = TRUE;
int connected = 0;  /* 1 when server validates us */
int whoflg = 0; /* just do a who at startup */
int linenumber = 0;

time_t startup_t = 0L;
time_t timestamp = (time_t) ULONG_MAX;  /* time of last mbox stat */

int m_whoheader = 1;  /* who header output */
int m_groupheader = 1;  /* group header output */
int m_nomesg = 0; /* turn off messages */
int m_watchtime = 0;  /* using boring time format */
int lines;
int cpos = 1;
int insert_mode = FALSE;
int ipos = 0;
int inverse = FALSE;
int scrolling = FALSE;
int dumb = 0;
int hidden = 0;
int mail = FALSE;
int hist_nav = 0;

char localhost[80];
unsigned long local_ip;

TTYINFO ttyinfo;
XFER xfer_tab[MAX_XFERS];
SECURE secure_tab[MAX_XFERS];

GLOBS gv = {
    CMDCHAR,  /* cmdchar */
    0,  /* verifyquit */
    0,  /* pauseonshell */
    1,  /* interactive */
    0,  /* paging */
    15, /* phistory */
    250,  /* bufferlines */
    50, /* history */
    "4m.log", /* logfile */
    0,  /* restricted */
    1,  /* beeps */
    "/bin/csh", /* default shell */
    1,  /* Editor beeps */
    "", /* Default host */
    (unsigned short) 6677,  /* Default port */
    "1",  /* Default group */
    "", /* Default nick */
    "<%N> %#",  /* Open message format */
    "<*%N*> %#",  /* Private message format */
    "(%N) %#",  /* secure message format */
    ">%N> %#",  /* Echoback private format */
    "^ %T [%@]  %C  Group: %G         %I %m^" /* Status Bar */
};
