// WhatKick 1.02 (C) 1991,1992 Conrad Sanderson
// Use precompiled headers and don't link this with anything

void _main()
{
	short ver;
	long script;

	struct FileHandle *input;
	struct Process *process;
	struct CommandLineInterface *cli;
	struct DosLibrary *DOSBase;

	if(!(DOSBase=(struct DosLibrary *)OldOpenLibrary("dos.library")))
		goto exit;

	ver=DOSBase->dl_lib.lib_Version;

	if(ver>34) script=(long)&("s:new-start");
	else script=(long)&("s:old-start");

	if(!(input = (struct FileHandle *)Open((char *)script,MODE_OLDFILE)))
		goto closedos;

	process = (struct Process *)FindTask(NULL); // casting sux severly
	cli = (struct CommandLineInterface *)BADDR(process->pr_CLI);

	if(cli->cli_CurrentInput !=Input() ) Close(cli->cli_CurrentInput);  // argh!
	cli->cli_CurrentInput  = (BPTR)input;

closedos:

	CloseLibrary(DOSBase);

exit:;
}
