/***************
*
* txm\txm.c
*/
#define MAIN 1
#include "txm.h"
#define VERSION "V1.0.2"

/* 初期化 */
int init(char *name)
{
	char *path;

	path = ((strlen(name) > 33) ? jstrrchr(name, '\\')+1 : name);
	fprintf(stderr,"%s " VERSION " copyright (C) 1995 T.Nakatani\n", path);

	work = calloc(920, 1);
	if (work == NULL) {
		return (ERROR);
	}
	txmdir = work + 80;				/* 情報ファイル用ディレクトリ */
	logfile = work + 160;			/* マージ前ログファイル */
	head1 = work + 240;
	head2 = work + 320;
	workfile = work + 400;
	mfile = work + 480;
	mesname = work + 560;
	infofile = work + 640;
	line1 = work + 720;
	line2 = work + 820;

	return (NORMAL);
}

int main(int argc, char **argv)
{
	int errcode;
	if (!(errcode = init(argv[0]))) {
		swchk(argc - 1, &(argv[1]));
		errcode = smerge();
		free(work);
	}
	return (errcode);		/* 出口はここだけ */
}
