/*        *****   **   **    *****    **********     *****
         *******  **   **   *******   **********    *******
         **   **  **   **   **            **       ***   ***
         **       **   **    ****         **       **     **
         **       **   **      ***        **       **     **
         **   **  **   **        **       **       ***   *** 
         *******  *** ***   *******       **        *******
          *****    *****     *****        **         ***** 
*/

/*  this program sees if there was a file name of command
 line.  If so it loads settings from file.  Else it chains to
 termdeaf. */
#include	"equs.c"
#include	"data.c"


main (argc,argv)
	int	argc;
	char	*argv[];
{	int	fd;

	if ((argc > 1) & (strcmp (argv [1],"DDD") != 0))
		{
		fd = open (argv[1],0);
		if (fd == -1)
			printz ("Can't open file %s\n",argv[1]);
		else
			{
			keyinit();
			printz ("\nReading file %s\n",argv[1]);
			biginit();
			readtable (fd);
			curpos (23,0);
			if (ft.justUse) 
				{ if (ft.chsloc != 0)
					{ if (readUchar (fd) != -1)
						dnldUchset ();
					curpos (23,0);
					}
				  if (ft.kbdloc != 0)
					{ lg.Ukeyb = TRUE;
					  if (readKeyb (fd) != -1)
					  	dnldTranTable (KBD);
					curpos (23,0);
					}
				} /* file just contains user defined guys */
			else
				{ readscat (fd);
				  STscreen();
				curpos (23,0);
				  readfun (fd);
				  FKAllProg ();
				curpos (23,0);
				  readlang (fd);
				curpos (23,0);
				  if (lg.charset == 'U')
					{ if (readUchar (fd) == -1)
						lg.charset = '*';
					}
				  if (lg.Ukeyb == TRUE)
					{ if (readKeyb (fd) != -1)
					  	dnldTranTable (KBD);
					  else lg.Ukeyb = FALSE;
					}
				  loadchset(); /* loads language after its read */
				curpos (23,0);
				  emulcheck();
				} /* not just user file */
			}  /* good open */ 
		}  /* is entry on command line */
	else if ((argc > 1) & (strcmp (argv [1],"DDD") == 0))
		{ execl ("CUSTOM2","DDD",0);
		  execl ("A:CUSTOM2","DDD",0);
		} /* no command line */
	else
		{ exec ("CUSTOM2");
		  exec ("A:CUSTOM2");
		} /* no command line */

}

abort()
{ exit(); }
  