/*
 *	SLEEPnn.PRG  -- A utility to allow your Atari ST to take a nap
 *	so that your hard drive can have time to power up.
 *	Ideal for recovering a BBS automatically after a power
 * 	failure. Put this in the \auto\ folder of your FLOPPY drive,
 *	followed by your hard disk driver (AHDI.PRG, SUPBOOT.PRG, etc.)
 *	Name the program SLEEP15.PRG, SLEEP30.PRG, etc.
 */

#include <stdio.h>
#include <ctype.h>

#define VSN "1.0 \n Compiled with Sozobon C \n -- 04/30/1989\n"

main(argc, argv) 
int argc; char *argv[];
{
	int tm;
	char *ptr;

	printf("SLEEP version %s\n", VSN);
	printf("Public domain by Steve Yelvington\n");
	printf("UUCP: bungia!stag!thelake!steve\n\n");
	ptr = argv[0];
	while ( *ptr)
		++ptr;			/* find the end of the string */
	ptr -= 6;			/* back up nn.prg             */

	if ( isdigit(*ptr) )
		{
		tm = atoi(ptr);
		printf("%s: Pausing %d seconds\n", argv[0], tm);
		sleep(tm);
		}
	else 
		{
		printf("This is %s ... \n", argv[0]);
		printf("This program should be renamed    \n");
		printf("SLEEPnn.PRG, where nn is 00 to 99,\n");
		printf("two digits indicating how many    \n");
		printf("seconds you wish to wait for the  \n");
		printf("hard drive to get up to speed.    \n");
		printf("\n(Press any key to exit)         \n");
		getch();
		}
	
	exit(0);
}

