Listing 3 (TESTLOCK.C) Testing Environment for Lock

//
//    TESTLOCK is calls FAKELOCK to learn the return values it
//    will create. By writing down the input string and the return
//    value they can be added to your program like they are in TESTPROG.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "fakelock.h"

void main( void )
{
  char instr[96];                     // input string
  char *mesg = "\rEnter string to test FAKELOCK (empty string to end): ";
  int key;                            // which lock to use
  int results;                        // return value from FAKELOCK
  char temp[96];                     // tempory place to get which lock
  
  printf( mesg );
  gets( instr );
  
  while ( strlen( instr ) > 0 )
  {
    printf("Which lock (1 or 2): ");
    gets( temp );
    
    key = atoi( temp );
    
    results = FAKELOCK( instr, key );
    
    printf("FAKELOCK results : %d\n", results );
    
    printf( mesg );
    gets( instr );
  }
}
/* End of File */