/* :ts=4
 *	Compatibility routines needed by relaynews.
 *
 *	$Id: amiga.c,v 1.3 90/05/28 15:51:09 crash Exp Locker: crash $
 *
 *	$Log:	amiga.c,v $
 * Revision 1.3  90/05/28  15:51:09  crash
 * RCS header cleanup and other misc cleanup
 * 
 * Revision 1.2  90/05/27  14:33:32  crash
 * changed $Header: Work:UUPC/Source/relay/RCS/amiga.c,v 1.3 90/05/28 15:51:09 crash Exp Locker: crash $ to $Id: amiga.c,v 1.3 90/05/28 15:51:09 crash Exp Locker: crash $ in "static char RCSid[]" statement
 * 
 * Revision 1.1  90/05/22  23:45:57  crash
 * Initial revision
 * 
 */

#ifndef lint
static char RCSid[] =
	"$Id: amiga.c,v 1.3 90/05/28 15:51:09 crash Exp Locker: crash $";
#endif

#ifdef VOID
# undef VOID					/* Was (probably) set on command line */
#endif

#include <stdio.h>
#include <libraries/dos.h>
#include "news.h"

#if defined(ckctpa) || defined(LATTICE)
# include <proto/exec.h>
#else
# include <functions.h>
#endif

int fork()
{
	return( -1 );
}

#ifndef LATTICE
int system(s)
char *s;
{
	warning("attempting system() call: '%s'", s);
	return( -1 );
}
#endif

#if 0
/*
 *	Somewhere I saw some code which was supposed to emulate the Un*x
 *	popen/pclose library calls...  Now where was that??  (Some device
 *	driver code, perhaps?)
 */
FILE *popen(name, mode)
char *name, *mode;
{
	if (index(mode, '+'))
		return( fopen(name, mode) );
	else {
		char buf[16];

		strcpy(buf, mode);
		strcat(buf, "+");
		return( fopen(name, buf) );
	}
}

int pclose(fp)
FILE *fp;
{
	return( fclose(fp) );
}
#endif

#ifdef LATTICE		/* Does Lattice have these yet?? */
int	chdir(path)
char *path;
{
	register struct FileLock *lock, *oldLock;

	lock = Lock(path, ACCESS_READ);
	if (!lock)
		return (int) IoErr();
	oldLock = CurrentDir(lock);
	if (oldLock)
		UnLock(oldLock);
	return 0;
}

int mkdir( name )
char *name;
{
	extern int errno;
	register struct FileLock *lock;

	lock = CreateDir( name );
	if ( !lock )
	   return errno;
	UnLock( lock );
	return 0;
}
#endif /* LATTICE */
