Listing 2

/*Program Test program to turn small letters into Caps.*/
/*R. McLaughlin*/

/*Includes*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <cm.h>  /*CHECK*MATE include*/
#include <setups.h> /*routines to set up serial port*/
#include <log.h>  /*routines to log on and off remote
system*/
/*Data Structures*/
#define FALSE 0
int i, correct;
char char_in[2], char_out [2];
char output[81];
char msg[100];

/*Code*/
main()
{
     CM_log("Start test of lower-to-upper");
        /*Put start message in test log.*/
     Set_line();  /*implementation dependent*/
     Log_in();    /*implementation dependent*/
     for(i=0;i<1000;i++)
     {
     while(isprint(char_out)=FALSE)
      {
    char_out= char rand();  /*send only printable
                         characters.*/
      }
         TX_chr(DEV1,char_out);
         TX_chr(DEV1,"\n");
         RX_chr(DEV1,char_in);
         if (islower(char_out)!=FALSE))
              {
              if((isupper(char_in)==FALSE) ||
                 (tolower(char_in)==char_out))
                 {
            sprintf(msg,"Sent %c, received %c. --
            FAILURE",char_out,char_in);
              CM_log(msg);
                 }
                 else
                 {
                 correct++;
                 }
              else
                 {
                 if(char_out==char_in)
                    {
                    correct++;
                    }
                    else
                    {
                 sprintf(msg,"Sent %c, received %c.
                 --  FAILURE",char_out,char_in);
                       CM_log(msg);
                    }
                 }
              }
    sprintf(msg,"Received %d correct
    characters.",correct);
     CM_log(msg);
     CM_log("Test Complete");
     Log_off();     /*implementation dependent*/
     Reset_devices();  /*implementation dependent*/
     exit(0);
}

 Note:  Implementation dependent code is not shown.