/************************************************************************/
/*                                                                      */
/* Copyright (c) 1988 -                                                 */
/*     The Rector and Visitors of the University of Virginia            */
/*                                                                      */
/* This code may not be distributed further without permission          */
/*      from the University of Virginia.                                */
/* This code is distributed WITHOUT ANY WARRANTY.  No claims are        */
/*      made as to whether it serves any particular purpose or even     */
/*      works at all.                                                   */
/*                                                                      */
/************************************************************************/

#include <stdio.h>
#include <signal.h>
#include "size.h"
#include "runtime.h"

int  _STMTNO = 0;
DISPLAY _DISPLAY;
int _ARGC;
char **_ARGV;
char *_FILENAME = "unknown";

extern void RT_xfloat(), RT_xpointer();
extern int close();

void
RT_startup(argc, argv)
	int argc;
	char **argv;
{
	register int i;

	/* make command line arguments available to run time routines */

	_ARGC = argc;
	_ARGV = argv;

	/* trap certain signals to run time system */

	signal(SIGFPE, RT_xfloat);
	signal(SIGEMT, RT_xpointer);
	signal(SIGBUS, RT_xpointer);
	signal(SIGSEGV, RT_xpointer);

	/* close extraneous file descriptors (some may be open) */

	for (i = 3; i < _NFILE; i++)
		(void) close(i);
}
