#include <stdio.h>

char cmd[2000];

int main(int argc, char **argv)
{
   int err;

   if ( argc < 2 )
   {
	  printf("Usage: %s CS355-circuitfile\n", argv[0]);
	  printf("Example: %s help-ALU\n", argv[0]);
	  exit(1);
   }

   err = chdir("/home/cs355000/priv/pj");
/*
   printf("err = %d\n", err);
*/
   if ( err == -1 )
   {
      printf("Error: permission bits set incorrectly\n");
      printf("Please alert professor....\n");
	  exit(1);
   }
   
   sprintf(cmd, "/home/cs355000/bin/logic-sim %s 2>&1 > /dev/null", 
				argv[1]);
/*
   printf("Running: %s\n", cmd);
*/
   system(cmd);

}

