#include <stdio.h>

#include "DeviceToolKits/Input.h"
#ifndef  TESTPROTO
#define  NO_PRAGMAS  1
#endif
#include "DeviceToolKits/proto/Input.h"
#include "DeviceToolKits/InputBase.h"

DTInput_t                  Unit0;
BYTE                       port;
BYTE                       type;
struct   GamePortTrigger   trigger;

main(argc,argv)
int   argc;
char  *argv[];
{
   long  status;

#ifdef   TESTSHARED
/*  Open the Input library  */

   DTInputOpen(DTINPUTREV);
#endif

/*  Try to initialize unit 0 of the Input  */

   printf("Move the mouse connector to the right port for this test.\n");
   fflush(stdout);

   if ((Unit0 = DTInputCreate(&status)) == NULL) {
      fprintf(stderr,"Error initializing unit 0 = %ld.\n",status);
      fflush(stderr);
      goto cleanup;
   }

   fprintf(stderr,"Unit0 = %lX\n",(long) Unit0);
   fflush(stderr);

/*  Set the input port to the right port  */

   port = 1;
   if ((status = DTInputSetMPort(Unit0,&port)) != 0) {
      fprintf(stderr,"Error setting unit 0 port = %ld,%ld.\n",
               status,Unit0->in_error);
      fflush(stderr);
      goto cleanup;
   }

/*  Wait while the user plays  */

   printf("In 30 seconds, the mouse will revert to the left port.\n");
   printf("Try moving the pointer with the mouse in the right port.\n");
   fflush(stdout);
   Delay(30L*60L);

/*  Set the input port back to the left port  */

   port = 0;
   if ((status = DTInputSetMPort(Unit0,&port)) != 0) {
      fprintf(stderr,"Error setting unit 0 port = %ld,%ld.\n",
               status,Unit0->in_error);
      fflush(stderr);
      goto cleanup;
   }

/*  Free the stuff  */

cleanup:
   DTInputFree(Unit0);
#ifdef   TESTSHARED
   DTInputClose();
#endif
}

