140865Sbostic /*-
2*62092Sbostic * Copyright (c) 1979, 1993
3*62092Sbostic * The Regents of the University of California. All rights reserved.
440865Sbostic *
540865Sbostic * %sccs.include.redist.c%
640865Sbostic */
71673Smckusick
840865Sbostic #ifndef lint
9*62092Sbostic static char sccsid[] = "@(#)PCSTART.c 8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111673Smckusick
125676Smckusic #include <signal.h>
131673Smckusick #include "h00vars.h"
145676Smckusic #include "libpc.h"
151673Smckusick
161673Smckusick /*
171673Smckusick * program variables
181673Smckusick */
191673Smckusick struct display _disply[MAXLVL];
201673Smckusick int _argc;
211673Smckusick char **_argv;
221673Smckusick long _stlim = 500000;
231673Smckusick long _stcnt = 0;
242180Smckusic long _seed = 1;
2510231Smckusick #ifdef ADDR32
261673Smckusick char *_minptr = (char *)0x7fffffff;
2710231Smckusick #endif ADDR32
2810231Smckusick #ifdef ADDR16
293016Smckusic char *_minptr = (char *)0xffff;
3010231Smckusick #endif ADDR16
311673Smckusick char *_maxptr = (char *)0;
321673Smckusick
331673Smckusick /*
341673Smckusick * file record variables
351673Smckusick */
361673Smckusick long _filefre = PREDEF;
371673Smckusick struct iorechd _fchain = {
381673Smckusick 0, 0, 0, 0, /* only use fchain field */
391673Smckusick INPUT /* fchain */
401673Smckusick };
411673Smckusick struct iorec *_actfile[MAXFILES] = {
421673Smckusick INPUT,
431673Smckusick OUTPUT,
441673Smckusick ERR
451673Smckusick };
461673Smckusick
471673Smckusick /*
481673Smckusick * standard files
491673Smckusick */
501673Smckusick char _inwin, _outwin, _errwin;
511673Smckusick struct iorechd input = {
521673Smckusick &_inwin, /* fileptr */
531673Smckusick 0, /* lcount */
541673Smckusick 0x7fffffff, /* llimit */
5542451Sbostic stdin, /* fbuf */
561673Smckusick OUTPUT, /* fchain */
571673Smckusick STDLVL, /* flev */
581673Smckusick "standard input", /* pfname */
597495Smckusick FTEXT|FREAD|SYNC|EOLN, /* funit */
601673Smckusick 0, /* fblk */
611673Smckusick 1 /* fsize */
621673Smckusick };
631673Smckusick struct iorechd output = {
641673Smckusick &_outwin, /* fileptr */
651673Smckusick 0, /* lcount */
661673Smckusick 0x7fffffff, /* llimit */
6742451Sbostic stdout, /* fbuf */
681673Smckusick ERR, /* fchain */
691673Smckusick STDLVL, /* flev */
701673Smckusick "standard output", /* pfname */
711673Smckusick FTEXT | FWRITE | EOFF, /* funit */
721673Smckusick 1, /* fblk */
731673Smckusick 1 /* fsize */
741673Smckusick };
751673Smckusick struct iorechd _err = {
761673Smckusick &_errwin, /* fileptr */
771673Smckusick 0, /* lcount */
781673Smckusick 0x7fffffff, /* llimit */
7942451Sbostic stderr, /* fbuf */
801673Smckusick FILNIL, /* fchain */
811673Smckusick STDLVL, /* flev */
821673Smckusick "Message file", /* pfname */
831673Smckusick FTEXT | FWRITE | EOFF, /* funit */
841673Smckusick 2, /* fblk */
851673Smckusick 1 /* fsize */
861673Smckusick };
871673Smckusick
PCSTART(mode)885676Smckusic PCSTART(mode)
895676Smckusic int mode;
901673Smckusick {
911673Smckusick /*
921673Smckusick * necessary only on systems which do not initialize
931673Smckusick * memory to zero
941673Smckusick */
951673Smckusick
961673Smckusick struct iorec **ip;
971673Smckusick
985676Smckusic /*
995676Smckusic * if running with runtime tests enabled, give more
1005676Smckusic * coherent error messages for FPEs
1015676Smckusic */
1025676Smckusic if (mode) {
1035676Smckusic signal(SIGFPE, EXCEPT);
1045676Smckusic }
1051673Smckusick for (ip = &_actfile[3]; ip < &_actfile[MAXFILES]; *ip++ = FILNIL);
1061673Smckusick }
107