h59260
s 00001/00001/00104
d D 1.3 80/09/09 02:20:55 lcd 3 2
c Changed "struct" command to "table"
e
s 00002/00000/00103
d D 1.2 80/09/07 13:19:50 lcd 2 1
c Added Strinit call
e
s 00103/00000/00000
d D 1.1 80/05/15 14:27:03 lcd 1 0
e
u
sunix
lcd
U
t
T
I 1
#

#include "globals.h"


/*
 *	init.c: intialization and clean up
 */

CONST	char	*_S_init	"%W%";

	char	*defdmp		"KER.dump";
	char	*defout		"KER.out";
	char	*deflst		"a.lst";

VAR	char	dump[ MAXFILELENGTH ];
	char	aout[ MAXFILELENGTH ];
	char	alst[ MAXFILELENGTH ];


/*
 *	cant: can't open up file
 */

PROCEDURE cant( filename )

CONST	char	*filename;

BEGIN	printf("Can't open %s\n", filename );
	exit( 2 );
END

/*
 *	initialize: set initialization
 */

PROCEDURE initialize( argc, argv )

CONST	integer	argc;
	char	**argv;

BEGIN	/*
	 *	set up default file names
	 */

	move( defdmp, dump, size( defdmp ) );
	move( defout, aout, size( defout ) );
	move( deflst, alst, size( deflst ) );

	IF argc > 4
	THEN	printf("Usage: kerndb [ dump file [ a.out [ a.lst ] ] ]\n");
		exit(1);
	END;

	IF argc > 3
	THEN	move( argv[3], alst, size( argv[3] ) );
	END;

	IF argc > 2
	THEN	move( argv[2], aout, size( argv[2] ) );
	END;

	IF argc > 1
	THEN	move( argv[1], dump, size( argv[1] ) );
	END;

	o_alst = fopen( alst, "r" );
	o_aout = fopen( aout, "r" );
	o_dump = fopen( dump, "r" );

	IF o_alst == NULL
	THEN	cant( alst );
     ELSIF o_aout == NULL
	THEN	cant( aout );
     ELSIF o_dump == NULL
	THEN	cant( dump );
	END;

	command = NOCMD;

	mode = OCTAL;
	step = 2;
	addr = 0L;
	dsplysz = 0L;

	syminit();

	pptinit();

I 2
D 3
	Strinit();
E 3
I 3
	tabinit();
E 3

E 2
	rdreg();
END


/*
 *	cleanup: close all open descriptors
 */

PROCEDURE cleanup()

BEGIN	fclose( o_alst );
	fclose( o_aout );
	fclose( o_dump );
END
E 1
