[comp.os.minix] reboot Atari -- the solution

klamer@mi.eltn.utwente.nl (Klamer Schutte) (05/07/91)

Here is a program which allows you to reboot back to tos on reset of
CTRL-ATL-DEL.
Note than some people (Frans, among others) don't need this program.
Neither did i before i had a harddisk. Is it in the software of the
TOS harddisk driver???

Anyhow, run this program as root, and your problems are solved.
I run this in /etc/rc.

Klamer (.signature at end)

/*
 *	$Id: tosreboot.c,v 1.1 1991/04/28 15:41:05 klamer Exp $
 *
 *	$Log: tosreboot.c,v $
 * Revision 1.1  1991/04/28  15:41:05  klamer
 * Initial revision
 *
 */

#include <sys/types.h> 
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

#define	DEVMEM		"/dev/mem"
#define	RESVALID	0x426

main()
{
	int	fd;
	long	null = 0;	/* not 0x31415926 */
	
	fd = open(DEVMEM,O_WRONLY);
	if (fd < 0)
	{
		perror(DEVMEM);
		exit(1);
	}
	
	if (lseek(fd, (off_t) RESVALID, SEEK_SET) != RESVALID)
	{
		/* exit on error: you don't want to write to random memory! */
		perror("seek");
		exit(1);
	}
	
	write(fd,&null,4);
	
	exit(0);
}
-- 
Klamer Schutte
Faculty of electrical engineering -- University of Twente, The Netherlands
klamer@mi.eltn.utwente.nl	{backbone}!mcsun!mi.eltn.utwente.nl!klamer