/*
 *	host.c
 *
 *	Amiga front-end for the mailer-type packages.  #define MAIN to
 *	be the routine you want to call when this code is run.  This
 *	module allows you to use longjmp( &dcpexit ) to return to main()
 *	and it sets up the environment and such for you.
 *
 *	$Id: host.c,v 1.1 90/01/16 10:25:41 crash Exp Locker: crash $
 */

#ifndef lint
static char RCSid[] = "$Id: host.c,v 1.1 90/01/16 10:25:41 crash Exp Locker: crash $";
#endif /* lint */

#include <stdio.h>
#include "host.h"

#ifndef _U
# include <ctype.h>
#endif

#include <setjmp.h>

#ifndef EACCES
# include <errno.h>
#endif

static char *curdir;
char *getcwd();
int chdir();

int	debuglevel;		/* debugging level */
jmp_buf	dcpexit;

main( argc, argv )
int	argc;
char *argv[];
{
	int ret = 0;

	/* Amiga specific prolog */
	loadenv();
	curdir = getcwd( NULL, 0 );

#ifdef CWDSPOOL
	chdir( spooldir );
#endif

	/* setup longjmp for error exit's */
	if ( setjmp( dcpexit ) == 0 )
		ret = MAIN( argc, argv );

	/* Amiga specific epilog */
	exitenv();
	chdir( curdir );
	exit( ret );
}


/* canonical name conversio routines
 *
 *	inportpath	canonical -> host
 *	exportpath	host -> canonical
 *
 *	host		your local pathname format
 *	canonical	unix style
 */

importpath( host, canon )
register char *host;
char *canon;
{
	strcpy( host, canon );
	if ( *host == '/' )
		*host = ':';
}

exportpath( canon, host )
char *host;
register char *canon;
{
	strcpy( canon, host );
	if ( *canon == ':' )
		*canon = '/';
}
