/*** Ex.c ****************************************************************
* @Ram-Rez¡ Public Domain By Adan L. Ramirez II BIX:ramrez 
* Compiler: LATTICE { lc -Lt -m1 -O Ex.c };
* Revision 01.0 89/03/25 02:30:00 @Ram-Rez¡
* Description: Executes a command file that contains commands
* Format: Ex <command-file>
**************************************************************************/

#include <libraries/dosextens.h>
#include <stdio.h>

main(argc,argv)
int argc;
char *argv[];
{
	struct Process *process,*FindTask();
	struct CommandLineInterface *cli;
        struct FileHandle *input,*Open();
	process = (struct Process *)FindTask(0L);
	cli     = (struct CommandLineInterface *)BADDR(process->pr_CLI);
	if(argc == 1||argc > 2)
	  {
		write(fileno(stdout),"Ex <command-file>\n",19);
		exit(0);
	  }
	if(input = Open(argv[1], MODE_OLDFILE))
	  {
 	        cli->cli_CurrentInput  = (BPTR)input;
                exit(1); 
	  }
	write(fileno(stdout),"Ex: Cannot Open File\n",22);
	exit(0);
 }





