/* version.c */
#include <stdio.h>
#include <ctype.h>
#include "mb.h"

extern char optflags[];     
extern struct Window *mywindow ;    /* ptr to applications window */
extern short od ;     /* device is open so it can be closed */

#define IBM_VERSION "7.20"
#define AMI_VERSION "q"
#define DATE_VERSION "10-Dec-1993"

/* This string is only for the "version" program */
static  char *sys_version =
       "\0$VER: C-BBS V" IBM_VERSION AMI_VERSION " (" DATE_VERSION ")";

/* Original version strings from distribution
char  *ver = "\nC-BBS V7.2, 30 JAN 1992\n\n";
char  *vers = "[CBBS-7.20-H$]\n";
*/

/* Version strings for Amiga Multi-Port version */
char  *ver = "\nAMIGA Multi-Port C-BBS V" IBM_VERSION AMI_VERSION ", "
                  DATE_VERSION " (VE5VA)\n\n";
/* Version string for putting on the R: line */
char *vstring = "AMIGA C-BBS V" IBM_VERSION AMI_VERSION;
/* This string MUST have exactly two hyphens in it so that the code in
   mbinit which removes the B will work if #C is set
*/
#ifndef MCH_ZOO
char  *vers = "[C_BBS-" IBM_VERSION AMI_VERSION "-IBFMH$]\n";
#else
char  *vers = "[C_BBS-" IBM_VERSION AMI_VERSION "-ZIBFMH$]\n";
#endif

extern char hostport;

/* Window titles for the various versions (no such thing in the distribution
   version so there's no need to look for MCH_AMIGA
*/

#ifdef MCH_SYSOP

/* Title for the SYSOP version */
char *title = " SYSOP V" IBM_VERSION AMI_VERSION;

#else
/* Title for multi-port version */

char *title = " C-BBS V" IBM_VERSION AMI_VERSION ;
#endif

extern char *fwdfile;
short gotmail = 0;
char titlestr[80];
char conn_call[10];
char conn_direction = ' ';
short versions = 0;
window_title(i,j)
short i,j;
{
   register int k,l;
   if(od == 0)return;
   if(!optflags[5])return;
   if((k = i) < 0)k = 0;
   if((l = j) < 0)l = 0;
   sprintf(titlestr,"%c%6s %5d/%-4d %14s #%c    %13s    %-10s",
                     conn_direction,conn_call,
                     k,l,
                     title,hostport,
                     gotmail? "You have mail":"",
                     fwdfile?fwdfile:"");
   setwtitles(titlestr);
}
user_title(p)
char *p;
{
   register int i;
   register char *q,*r;
   q = conn_call;
   r = titlestr;
   if(*p)*r++ = conn_direction;
   else  *r++ = ' ';
   for(i=0;i<ln_call && *p;i++,p++) {
      *r++ = *q++ = *p;
   }
   for(;i<ln_call;i++)*r++ = *q++ = ' ';
   setwtitles(titlestr);
}

