/*
 *-----------------------------------------------------------------------------
 * Copyright 1994 DeltaLink bv
 *-----------------------------------------------------------------------------
 * Module Name : fl_prot.c
 * Version/Rev : 1.00
 * Author/Date : Leon Westervoort
 * Description : This is a ibrary of encryption and decryption routines for
 *               FactoryLink.
 *
 *-----------------------------------------------------------------------------
 */
#pragma warning( disable : 4121 )
#include <stdio.h>
#include <string.h>

#include <flib.h>
#include <modules.h>
#include "encrypt.h"


/*
 *-----------------------------------------------------------------------------
 * Function/Type: pro_optfile
 * Description  : checks if there is an option file with the module option
 *
 *------------------- Parameters, Variables, & Conditions ---------------------
 * Enter with   : 
 *
 * Exits with   : 
 *
 *-----------------------------------------------------------------------------
 */

int pro_optfile( OP_MODULE *module) {

  int       error;
  char      opt_dir[ MAX_FILE_NAME];


  /*
   * get the path to the option file
   */
  fl_getvar( "FLINK", opt_dir, MAX_FILE_NAME);
  switch (module->id)
  {
    case ISO_TP4:
    case IM_BAS:
    case XYCHART:
    case 99:
      strncat( opt_dir, "/opt/rld.opt", MAX_FILE_NAME - strlen( opt_dir));
      break;

    default:
      strncat( opt_dir, "/opt/delta.opt", MAX_FILE_NAME - strlen( opt_dir));
      break;
  }
  
  

	/* initialize the return values of the module structure */

	strcpy( module->dl_serial, "DEMO_RUN");
	module->dl_version[0] = 0;
	module->dl_version[1] = 0;

  /*
   * initialize options programming
   */
  if( ( error = init_option( opt_dir, OP_READ, fl_get_serial())) != OK)
    return error;

  error = search_option( module);

  /*
   * initialize options programming
   */
  exit_option();

  return error;
}
