/* version control information */
#include "config.h"
#include "mbuf.h"
#include "usock.h"
#include "session.h"
#include "files.h"
#include "cmdparse.h"
#include "commands.h"

#define VERSION "1.10"

#ifdef UNIX
char Version[] = "KO4KS-TNOS/Linux v"VERSION;
char shortversion[] = "TNOS"VERSION"/L";
char statversion[] = " TNOS/L v"VERSION" [%2d] ";
#else
char Version[] = "KO4KS-TNOS v"VERSION;
char shortversion[] = "TNOS"VERSION;
char statversion[] = " TNOS v"VERSION" [%2d] ";
#endif
#if (defined(MAILBOX) || defined(MBFWD))
#ifdef FBBFWD
char MboxIdFwdFBB[] = "[TNOS-"VERSION"-FHIMT$]\n";
char MboxIdFBB[] = "[TNOS-"VERSION"-FHIM$]\n";
#endif
char MboxIdFwd[] = "[TNOS-"VERSION"-HIMT$]\n";
char MboxId[] = "[TNOS-"VERSION"-HIM$]\n";
#endif

#if !defined(VERSION_ON_FILE) || defined(VERSION_FILE_BUILD)
#ifdef TNOS_68K
static char VIA[] = "standard serial I/O devices";
#else
#ifndef UNIX
static char VIA[] = "8250/16450/16550";
#endif
#endif
#endif

char Version2[] = "This version by Brian A. Lantz, KO4KS\n";

#if defined(TNOS)
#ifdef BETA
#define STATE "beta-test"
#define TRAILER "                             distribute and DIE!!\n"
#else
#define STATE "  release"
#define TRAILER ""
#endif
char DFAR Tnosversion[] = "               T  N  O  S    -  Tampa Network Operating System\n                           "STATE" version "VERSION"\n"TRAILER"\n";
#endif

#ifdef ALLCMD
int
#ifdef PROTOTYPES
doversion(int argc,char *argv[],void *p)
#else
doversion(argc,argv,p)
int argc;
char *argv[];
void *p;
#endif
{
#if defined(VERSION_ON_FILE) && !defined(VERSION_FILE_BUILD)
	DisplayFile (VersionFile,Curproc->output);
#else
int k;

#ifdef VERSION_ON_FILE
#define tprintf printf
#ifdef UNIX
#undef tputs
#endif
#define tputs(str) fputs(str, stdout)
#endif

#ifndef TNOS_68K
    tprintf("TNOS %s, compiled %s %s, containing:\n" ,Version,__DATE__,__TIME__);
#else
    tprintf("TNOS %s, containing:\n" ,Version);
#endif
	tputs("TCP Servers:");

#ifndef SERVERS
	tputs("  None !\n");
#endif /* ! SERVERS */

#ifdef SERVERS
	tputs("  SMTP  FINGER  FTP");

#ifdef MAILBOX
	tputs("  TELNET");
#endif /* MAILBOX */

#ifdef ALLSERV
	tputs("  TTYLINK  QUOTE  DISCARD  ECHO");
#ifdef RLOGINSERV
	tputs("  RLOGIN");
#endif /* RLOGINSERV */
#endif /* ALLSERV */

	tputs("\n            ");
#ifdef ALLSERV
	tputs("  TIME  DAYTIME");
#endif /* ALLSERV */

#ifdef CALLSERVER
	tputs("  CALLBOOK (CD-ROM)");
#endif /* CALLSERVER */

#ifdef SAMCALLB
	tputs("  CALLBOOK (SAM)");
#endif /* SAMCALLB */

#ifdef CONVERS
	tputs("  CONVERS");
#endif /* CONVERS */

#ifdef NNTPS
	tputs("  NNTP");
#endif /* NNTPS */

#ifdef POP2SERVER
	tputs("  POP2");
#endif /* POP2SERVER */

#ifdef POP3SERVER
	tputs("  POP3");
#endif /* POP3SERVER */

#ifdef RDATE
	tputs ("  TIME");
#endif /* RDATE */

	tputs("\n");

#endif /* SERVERS */


    tputs("TCP Clients:  SMTP");

#ifdef ALLCMD
    tputs("  FINGER");
#endif

#ifdef ALLSESSIONS
	tputs("  FTP  TELNET");
#endif /* ALLSESSIONS */

#ifdef ALLSERV
	tputs("  TTYLINK");
#endif /* ALLSERV */

	tputs("  QUOTE  TIME  DAYTIME\n");

#if (defined(SAMCALLB) || defined(CALLCLI) || defined(CONVERS) || defined(NNTP) || defined(NNTPS) || defined(POP2CLIENT) || defined(POP3CLIENT) || defined(RLOGINCLI) || defined(RDATE))
	tputs("            ");

#ifdef CALLCLI
	tputs("  CALLBOOK (CD-ROM)");
#endif /* CALLCLI */

#ifdef SAMCALLB
	tputs("  CALLBOOK (SAM)");
#endif /* SAMCALLB */

#ifdef CONVERS
	tputs("  CONVERS");
#endif /* CONVERS */

#if (defined(NNTP) || defined(NNTPS))
	tputs("  NNTP");
#endif /* NNTP || NNTPS */

#ifdef POP2CLIENT
	tputs("  POP2");
#endif /* POP2CLIENT */

#ifdef POP3CLIENT
	tputs("  POP3");
#endif /* POP3CLIENT */

#ifdef RLOGINCLI
	tputs("  RLOGIN");
#endif /* RLOGINCLI */

	tputs("\n");
#endif /* CALLCLI || CONVERS || NNTP || NNTPS || POP2CLIENT || POP3CLIENT || RLOGINCLI || RDATE */


#ifdef LZW
    tputs("    with LZW compression for TCP sockets\n");
#endif /* LZW */

#if (defined(TCPACCESS) || defined(IPACCESS))
	tputs("    with ");

#ifdef TCPACCESS
	tputs("TCP");
#endif /* TCPACCESS */

#if (defined(TCPACCESS) && defined(IPACCESS))
	tputs("/");
#endif /* TCPACCESS && IPACCESS */

#ifdef IPACCESS
    tputs("IP");
#endif /* IPACCESS */

	tputs(" access controls\n");
#endif /* TCPACCESS || IPACCESS */


	tputs("UDP Servers:");

#if (!defined(DSERVER) && !defined(SERVERS) && !defined(BOOTP))
	tputs("  None !");
#endif /* ! DSERVER && ! SERVERS */

#ifdef DSERVER
	tputs("  DOMAIN NAMESERVER");
#endif /* DSERVER */

#ifdef SERVERS
	tputs("  REMOTE");
#endif /* SERVERS */
#ifdef	BOOTP
	tputs("  BOOTP");
#endif
	tputs("\n");


#ifdef TIPMAIL
	tputs("TIP Mailbox Server");
#ifdef XMODEM
	tputs(" with Xmodem file transfer");
#endif /* XMODEM */
	tputs("\n");
#endif /* TIPMAIL */


#ifdef MAILBOX
	tputs("Full Service BBS");

#if (defined(RMAIL) || defined(EXPIRY) || defined(MAILFOR) || defined(MBFWD) || defined(RLINE) || defined(WPAGES))
	tputs(" with:\n ");
#endif /* RMAIL || EXPIRY || MAILFOR || MBFWD || RLINE || WPAGES */

	k = 0;
#ifdef RMAIL
	tputs("   Remote Mailer (RMAIL)  ");
	++k;
#endif
#ifdef EXPIRY
	tputs("   Message and BID expiry ");
	++k;
#endif /* EXPIRY */

#ifdef MAILFOR
	tputs("   'Mail For' beaconing   ");
	++k;
#endif /* MAILFOR */

#ifdef MBFWD
	if (!(k % 3))
		tputs("\n ");
	tputs("   AX.25 mail forwarding  ");
	++k;
#endif /* MBFWD */

#ifdef RLINE
	if (!(k % 3))
		tputs("\n ");
	tputs("   'R:-line' compatibility");
	++k;
#endif /* RLINE */

#ifdef WPAGES
	if (!(k % 3))
		tputs("\n ");
	tputs("   'Pseudo-White Pages'   ");
	++k;
#endif
#ifdef FBBFWD
	if (!(k % 3))
		tputs("\n ");
	tputs("   'FBB-style' forwarding ");
#endif

	tputs("\n");

#endif /* MAILBOX */

#if (defined(CALLBOOK) || defined(AXIP) || defined(ENCAP))
	tputs("Internet Services:");

#if defined(CALLBOOK)
	tputs("  BBS Callbook Client");
#endif /* CALLBOOK */

#ifdef AXIP
	tputs("  AX.25 Digipeating (AXIP)");
#endif /* AXIP */

#ifdef ENCAP
	tputs("  IP Encapsulation");
#endif /* ENCAP */

	tputs("\n");
#endif /* CALLBOOK || AXIP || ENCAP */

	tputs("Assorted TNOS Features:\n");
	k = 0;
#ifdef CONVERS
	tputs("     Expanded Conference bridge        ");
	k++;
#endif
#ifdef REQSVR
	tputs("     Remote Request Server             ");
	k++;
#endif
	if (!(k % 2))
		tputs("\n");
	tputs("     ANSI Color Graphics               ");
	k++;
#ifdef SCREENSAVER
	if (!(k % 2))
		tputs("\n");
	tputs("     Local screen saver                ");
	k++;
#endif
#ifdef  TNOS
	if (!(k % 2))
		tputs("\n");
	tputs("     Virtual Memory storage routines   ");
	k++;
#endif
#ifdef TUTOR
	if (!(k % 2))
		tputs("\n");
	tputs("     Information/News/Tutorial Services");
#endif
	tputs("\n");


#ifdef HOPCHECK
	tputs("Hopcheck IP path tracing\n");
#endif /* HOPCHECK */

#ifdef RIP
	tputs("RIP Routing Protocol\n");
#endif /* RIP */

#ifdef RSPF
	tputs("Radio Shortest Path First Protocol (RSPF)\n");
#endif /* RSPF */

#ifdef RARP
	tputs("Reverse Address Resolution Protocol (RARP)\n");
#endif /* RARP */

#ifdef ASY
#ifdef UNIX
    tputs("Generic termios interface driver\n");
#else
    tprintf("Generic async (%s) interface driver\n", VIA);
#endif

#if (defined(KISS) || defined(AX25) || defined(NRS))
	tputs("Async interface drivers:");

#ifdef KISS
	tputs("  KISS TNC");
#endif /* KISS */

#ifdef AX25
	tputs("  AX.25");
#endif /* AX25 */

#ifdef NRS
	tputs("  NET/ROM TNC");
#endif /* NRS */

	tputs("\n");
#endif /* KISS || AX25 || NRS */

#endif /* ASY */

#ifdef NETROM
	tputs("NET/ROM network interface\n");
#endif /* NETROM */

#if (defined(PPP) || defined(SLIP))
	tputs("Async IP drivers:");

#ifdef PPP
	tputs("  Point-to-Point (PPP)");
#endif /* PPP */

#ifdef SLIP
	tputs("  Serial Line (SLIP)");
#endif /* SLIP */

#ifdef DIALER
    tputs(" - with dialer code");
#endif /* DIALER */
	tputs("\n");

#ifdef VJCOMPRESS
    tputs("      with Van Jacobson compression\n");
#endif /* VJCOMPRESS */

#endif /* PPP || SLIP */

#ifdef PACKET
	tputs("FTP Software's PACKET driver interface\n");
#endif /* PACKET */

#ifdef APPLETALK
	tputs("Appletalk interface for MacIntosh\n");
#endif /* APPLETALK */

#ifdef ARCNET
	tputs("ARCnet via PACKET driver\n");
#endif /* ARCNET */

#ifdef DRSI
	tputs("DRSI PCPA low-speed driver\n");
#endif /* DRSI */

#ifdef EAGLE
    tputs("Eagle card 8530 driver\n");
#endif /* EAGLE */

#ifdef ETHER
    tputs("Generic ethernet driver\n");
#endif /* ETHER */

#ifdef HAPN
	tputs("Hamilton Area Packet Network driver\n");
#endif /* HAPN */

#ifdef HS
	tputs("High speed (56 kbps) modem driver\n");
#endif /* HS */

#ifdef PACKETWIN
	tputs("Gracilis PackeTwin driver\n");
#endif /* PACKETWIN */

#ifdef PC_EC
	tputs("3-Com 3C501 Ethernet controller driver\n");
#endif /* PC_EC */

#ifdef PC100
	tputs("PAC-COM PC-100 driver\n");
#endif /* PC100 */

#ifdef PI
	tputs("PI SCC card with DMA driver (VE3IFB)\n");
#endif /* PI */

#ifdef SCC
    tputs("Generic SCC (8530) driver (PE1CHL)\n");
#endif /* SCC */

#ifdef SLFP
	tputs("SLFP via PACKET driver\n");
#endif /* SLFP */
    
#ifdef TRACE
	tputs("Hardware interface packet tracing code");
#ifdef MONITOR
	tputs(" - with user monitor mode");
#endif
	tputs("\n");
#endif /* TRACE */

#ifdef STKTRACE
	tputs("Stack tracing code\n");
#endif /* STKTRACE */

#ifdef MULTITASK
	tputs("Multitasking capability when shelling out to MS-DOS\n");
#endif /* MULTITASK */

#ifdef XSPAWN
	tputs("EMS/Disk swapping when shelling out to MS-DOS\n");
#endif
#ifdef UNIX
    tputs("Linux/Unix/POSIX modifications by Brandon S. Allbery\n");
#endif

#ifdef MONITOR
    tputs("User port monitor trace mode\n");
#endif

#ifdef TTYCALL
    tputs("AX.25 ttylink mode\n");
#endif

#ifdef AXBCSTR
    tputs("AX.25 broadcast strings\n");
#endif

#endif

#if 0
#if defined(VERSION_ON_FILE) && !defined(VERSION_FILE_BUILD)
	tprintf("\n%d sockets, %d sessions",Nusock,Nsessions);
#ifndef TNOS_68K
	tprintf (", %d interrupt buffers of %d bytes",Nibufs,Ibufsize);
#endif
	tputs("\n");
#endif
#endif
	return 0;
}
#endif /*ALLCMD*/
