/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

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

#include	"init.h"
#include	<stdio.h>
#include	<machine/msequence.h>
#include	<task.h>
#include	<utils.h>
#include	<stream.h>
#include	<netutils.h>

extern void check_endian();
extern void init_longchar();
extern void init_utils();
extern void init_resolve();
extern void proc_recv_stream(char * msg);
extern int _main(int argc,char ** argv);

int
main(int argc,char ** argv)
{
char *exename;
char * msg;

	exename = argv[0];

	if(argc < 2){
		printf("too few argments.");
		return 0;
	}
	check_endian();
	init_task(INI_DONTWAITCHI);
	init_msequence();
	check_endian();
	init_tick();
	init_d_alloc();
	init_longchar();
	init_wct();
	init_stream();
	init_utils();
	init_netutils();
	init_resolve();

	if ( argv[1][0] == '+' ) {
		proc_recv_stream(&(argv[1][1]));
		argv ++;
		argc --;
	}
	argv[0] = exename;
	return _main(argc,argv);
}
